gcc - CUDA linking errors with g++ -
i have written makefile compiles multiple files , link them together. output of file:
g++ -c -wall -u debug -u file -u highpriority -u onlycuda -u cuda -u thread_num -u size -u inputfilename -d size=32 -d thread_num=4 -d cuda \ ../src/lib/decomp/nt_fft_decomp.cpp -std=c++0x -o nt_fft_decomp.o g++ -c -wall -u debug -u file -u highpriority -u onlycuda -u cuda -u thread_num -u size -u inputfilename -d size=32 -d thread_num=4 -d cuda \ ../src/lib/decomp/t_fft_decomp.cpp -std=c++0x -lpthread -o t_fft_decomp.o g++ -c -wall -u debug -u file -u highpriority -u onlycuda -u cuda -u thread_num -u size -u inputfilename -d size=32 -d thread_num=4 -d cuda \ ../src/lib/comp/snt_fft_comp.cpp -std=c++0x -o snt_fft_comp.o g++ -c -wall -u debug -u file -u highpriority -u onlycuda -u cuda -u thread_num -u size -u inputfilename -d size=32 -d thread_num=4 -d cuda \ ../src/lib/comp/st_fft_comp.cpp -std=c++0x -lpthread -o st_fft_comp.o g++ -c -wall -u debug -u file -u highpriority -u onlycuda -u cuda -u thread_num -u size -u inputfilename -d size=32 -d thread_num=4 -d cuda \ ../src/lib/comp/vnt_fft_comp.cpp -std=c++0x -o vnt_fft_comp.o g++ -c -wall -u debug -u file -u highpriority -u onlycuda -u cuda -u thread_num -u size -u inputfilename -d size=32 -d thread_num=4 -d cuda \ ../src/lib/comp/vt_fft_comp.cpp -std=c++0x -lpthread -o vt_fft_comp.o nvcc -c -u debug -u file -u highpriority -u onlycuda -u cuda -u thread_num -u size -u inputfilename -d size=32 -d thread_num=4 -d cuda \ ../src/lib/comp/cuda_fft_comp.cu -o cuda_fft_comp.o ptxas /tmp/tmpxft_00001e2d_00000000-5_cuda_fft_comp.ptx, line 93; warning : double not supported. demoting float g++ -c -wall -u debug -u file -u highpriority -u onlycuda -u cuda -u thread_num -u size -u inputfilename -d size=32 -d thread_num=4 -d cuda \ ../src/lib/globals.cpp -std=c++0x -o globals.o g++ -c -wall -u debug -u file -u highpriority -u onlycuda -u cuda -u thread_num -u size -u inputfilename -d size=32 -d thread_num=4 -d cuda \ ../src/main.cpp -std=c++0x -lpthread -o main.o in file included ../src/inlcude/fft.h:12:0, ../src/main.cpp:3: ../src/inlcude/comp/cuda_fft_comp.h:14:19: fatal error: cuda.h: no such file or directory compilation terminated. make: *** [main.o] error 1
i have added cuda lib , lib64 ld_library_path. , added -lcuda , -lcudart command.i don't why still generates error. ld_library_path :
somepath:/media/wiso/programs/setups/cuda/lib:/media/wiso/programs/setups/cuda/lib64:somepath
this command generates error :
g++ $(objects) -lcuda -lcudart -lpthread -o devicestest
in case line not generated error,these previous line too. 1 creates main.o:
g++ -c -wall $(codedefined) $(userdefined) $(main) -std=c++0x -lpthread -o main.o
codedefined , userdefined -u -d options main path main.cpp file
ld_library_path
has nothing compiling , linking. runtime direction of path load dynamic libraries.
you should add following switch (or similar) tell g++
find cuda include files:
-i/usr/local/cuda/include
Comments
Post a Comment