MantisBT - CMake
View Issue Details
0011719CMakeModulespublic2011-01-18 16:082016-06-10 14:31
Orion Poplawski 
James Bigler 
normalminoralways
closedmoved 
linuxFedora13
CMake 2.8.3 
 
0011719: FindCUDA should look for libcuda in /usr/lib{,64}/nvidia
The rpmfusion nvidia driver packages install libcuda.so in /usr/lib{,64}/nvidia. I think FindCUDA should add that to the search path.

diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 1547b19..e3c7533 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -567,7 +567,7 @@ endif()
 
 # 1.1 toolkit on linux doesn't appear to have a separate library on
 # some platforms.
-find_library_local_first(CUDA_CUDA_LIBRARY cuda "\"cuda\" library (older versions only).")
+find_library_local_first(CUDA_CUDA_LIBRARY cuda PATH_SUFFIXES nvdia DOC "\"cuda\" library (older
 
 # Add cuda library to the link line only if it is found.
 if (CUDA_CUDA_LIBRARY)
No tags attached.
gz ld.so.conf.d.tar.gz (695) 2011-01-19 18:12
https://public.kitware.com/Bug/file/3645/ld.so.conf.d.tar.gz
? nvidiafiles (2,142) 2011-01-20 13:39
https://public.kitware.com/Bug/file/3647/nvidiafiles
Issue History
2011-01-18 16:08Orion PoplawskiNew Issue
2011-01-18 16:11Brad KingAssigned To => James Bigler
2011-01-18 16:11Brad KingStatusnew => assigned
2011-01-18 16:13Orion PoplawskiNote Added: 0024895
2011-01-19 16:25James BiglerNote Added: 0024933
2011-01-19 16:35Orion PoplawskiNote Added: 0024934
2011-01-19 18:07James BiglerNote Added: 0024944
2011-01-19 18:12Orion PoplawskiFile Added: ld.so.conf.d.tar.gz
2011-01-19 18:13Orion PoplawskiNote Added: 0024945
2011-01-20 13:26James BiglerNote Added: 0024961
2011-01-20 13:39Orion PoplawskiFile Added: nvidiafiles
2012-02-03 09:06Emil StyrkeNote Added: 0028458
2016-06-10 14:28Kitware RobotNote Added: 0041780
2016-06-10 14:28Kitware RobotStatusassigned => resolved
2016-06-10 14:28Kitware RobotResolutionopen => moved
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0024895)
Orion Poplawski   
2011-01-18 16:13   
Oops, typo in there. nvdia should be nvidia.
(0024933)
James Bigler   
2011-01-19 16:25   
Orion, thanks for your interest.

As far as I can tell this is a non-standard installation of the driver. NVIDIA nor the distro maintainers (RedHat and Fedora) support RPMFusion. I don't feel it's a maintainable practice to add paths for every possible location someone may decided to put the driver. I'm surprised they can put it in a different location and have applications that depend on it link properly at run-time.

Please look at the documentation for CMake's find_library() for ways of adding additional system paths for CMake to search in. find_library_local_first() will call find_library() allowing CMake to look in all of the locations it knows about (see the docs again to see where find_library looks).
(0024934)
Orion Poplawski   
2011-01-19 16:35   
Well, as far as I know, rpmfusion is *the* recommended way to install the nvidia binary drivers on Fedora, so it is not at all uncommon. Run time is handled via /etc/ld.so.conf.d/. Anyway, it is your call. -DCMAKE_LIBRARY_PATH=/usr/lib/nvidia certainly works as well.
(0024944)
James Bigler   
2011-01-19 18:07   
I'm curios what the contents of /etc/ld.so.conf.d are. Could you paste it in or attach it if it's really large?

I'm trying to decide if I should bring up CMake using this information somehow to help locate libraries on the system, since distributions can put things in non-standard locations and this seems like a candidate for a list of these locations.
(0024945)
Orion Poplawski   
2011-01-19 18:13   
Hard to say it that is a good idea or not. As runtime does not always equal what you want at build time. Anyway, I've attached the contents of mine. Obviously this could be very different depending on what packages are installed.
(0024961)
James Bigler   
2011-01-20 13:26   
Could you attach the list of files that are installed by the nvidia driver RPM? I'm trying to determine where the 32 and 64 bit cuda libraries are.
(0028458)
Emil Styrke   
2012-02-03 09:06   
I can add that the same issue is present on Ubuntu (11.10 in my case), but here the location is /usr/lib/nvidia-current.

/etc/ld.so.conf:
  include /etc/ld.so.conf.d/*.conf

/etc/ld.so.conf.d//x86_64-linux-gnu_GL.conf:
  /usr/lib/nvidia-current
  /usr/lib32/nvidia-current

I think it would be a good idea to have CMake parse the ld.so.conf, at least for the cuda driver lib.
(0041780)
Kitware Robot   
2016-06-10 14:28   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.