c++ - CMake does not properly find CUDA library -


i'm trying build program requires cuda. cmake script supply:

cmake -d cuda_toolkit_root_dir=/usr/local/cuda .. 

cuda found , cmake runs normally:

staudt ~/workspace/clutbb/cluster/build $ cmake -d cuda_toolkit_root_dir=/usr/local/cuda ..                                                                                   -- found cuda: /usr/local/cuda (found version "6.5")  -- found intel tbb -- boost version: 1.56.0 -- found following boost libraries: --   iostreams --   program_options -- looking include file pthread.h -- looking include file pthread.h - found -- looking pthread_create -- looking pthread_create - not found -- looking pthread_create in pthreads -- looking pthread_create in pthreads - not found -- looking pthread_create in pthread -- looking pthread_create in pthread - found -- found threads: true   -- not find sdl (missing:  sdl_library sdl_include_dir)  -- configuring done -- generating done -- build files have been written to: /home/i11/staudt/workspace/clutbb/cluster/build 

but linker step fails:

staudt ~/workspace/clutbb/cluster/build $ make [ 69%] built target cluster linking cxx executable clu cmakefiles/clu.dir/clu.cpp.o: in function `initcuda(int&, cuctx_st*&, int const&)': clu.cpp:(.text+0x517): undefined reference `cuinit' clu.cpp:(.text+0x52b): undefined reference `cudeviceget' clu.cpp:(.text+0x53f): undefined reference `cuctxcreate_v2' clu.cpp:(.text+0x559): undefined reference `cudevicegetname' clu.cpp:(.text+0x55e): undefined reference `cuctxsynchronize' cmakefiles/clu.dir/clu.cpp.o: in function `exitcuda(int&, cuctx_st*&)': clu.cpp:(.text+0x684): undefined reference `cuctxdestroy_v2' cmakefiles/clu.dir/clu.cpp.o: in function `main': clu.cpp:(.text.startup+0x1092): undefined reference `cuctxdestroy_v2' clu.cpp:(.text.startup+0x10d1): undefined reference `cuctxsynchronize' clu.cpp:(.text.startup+0x10e1): undefined reference `cuctxsynchronize' collect2: error: ld returned 1 exit status make[2]: *** [bin/clu] fehler 1 make[1]: *** [bin/cmakefiles/clu.dir/all] fehler 2 make: *** [all] fehler 2 

the required library @ /usr/local/cuda/lib64/stubs/libcuda.so, how can point out cmake or make?

in archive have posted, there multiple project hierarchies. actual error have posted in question occurring during compile , linking of clu project based on clu.cpp in clutbb/cluster/bin directory.

in same directory, there cmakelists.txt file. file governs particular level of project hierarchy.

in particular cmakelists.txt file, there following section:

cuda_add_executable(clu clu.cpp) target_link_libraries(clu ${cuda_library} ${tbb_library} ${boost_libraries} rt) target_link_libraries(clu cluster) 

try modifying middle line above to:

target_link_libraries(clu ${cuda_library} ${tbb_library} ${boost_libraries} rt cuda) 

this should fix missing -lcuda in linker command line. may still necessary give path libcuda.so on machine, may not necessary, depending on how machine environment set up.


Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -