Linker Error Undefined Reference Linking To Library Path


Open Source Installation library linking error undefined reference message
bj/x86_64/release/vectorAddDrv.cpp.o: In function `CleanupNoFailure()':
vectorAddDrv.cpp:(.text+0x161): undefined reference to `cuMemFree_v2'
vectorAddDrv.cpp:(.text+0x175): undefined reference to `cuMemFree_v2'
vectorAddDrv.cpp:(.text+0x189): undefined reference to `cuMemFree_v2'
obj/x86_64/release/vectorAddDrv.cpp.o: In function `main':
vectorAddDrv.cpp:(.text+0x5cb): undefined reference to `cuInit'
vectorAddDrv.cpp:(.text+0x697): undefined reference to `cuDeviceGetCount'
vectorAddDrv.cpp:(.text+0x91b): undefined reference to `cuDeviceComputeCapability'
vectorAddDrv.cpp:(.text+0x938): undefined reference to `cuDeviceGetName'
collect2: ld returned 1 exit status
make[1]: *** [../../bin/linux/release/vectorAddDrv] Error 1
make[1]: Leaving directory `/root/NVIDIA_GPU_Computing_SDK/C/src/vectorAddDrv'
make: *** [src/vectorAddDrv/Makefile.ph_build] Error 2

"Undefined Reference" & "collect2:ld retured 1 exit status " indicate
Required Function is missing in specified library path.
So we have to use the exact library.
In these scenario Library it was renamed like 
1) into the (To resolve the error message /usr/bin/ld: cannot find -lcuda but it cause the undefined reference error message).
2)or use lower version library
Note: To find out  which library has these function ?
Refer the path /x86_64/release/vectorAddDrv.cpp check ldflags.

To Install Exact Library 
glut - Library mean
# ldconfig -p | grep --color glut (libc6,x86-64) => /usr/X11R6/lib64/ (libc6,x86-64) => /usr/lib64/
cuda - LIbrary [ But the system doesn't have cuda library it has only cudart]
# ldconfig -p | grep --color cuda (libc6,x86-64) => /usr/local/cuda/lib64/ (libc6,x86-64) => /usr/local/cuda/lib64/

Important Commands
ld - GNU Linker
ldd - List of dependencices.[Study more about ldd]
ltrace - library call tracer
/etc/ - library cache. which is used to speed up the linking. povray
ldconfig -v [ Verbose mode - Print version number- name of each directory as it is scanned]

No comments:
Write comments