I'm having problems linking a project using nvcc. They occur with symbols defined inside the project. I have some function symbols defined in the cuda_bvh_constru.o file. This is the nm output for the relevant functions:
nm cuda_bvh_constru.o | grep update
0000000000001376 t _ZN20BVHConstructionState14updateGeometryERK6float3S2_
0000000000000b70 t _ZN20BVHConstructionState19updateGeometry_wobbER6float3S1_
These symbols are need on the cuda_bvhexports.o file but always appears undefined:
nm cuda_bvhexports.o | grep update
U _ZN20BVHConstructionState14updateGeometryERK6float3S2_
U _ZN20BVHConstructionState19updateGeometry_wobbER6float3S1_
I'm using the eclipse IDE to make a CUDA project and the generated linking instruction with the relevants object files in bold is:
nvcc -L/usr/lib/llvm-2.8/lib -L/home/viniciusdasilva/NVIDIA_GPU_Computing_SDK/C/lib -L/home/viniciusdasilva/NVIDIA_GPU_Computing_SDK/C/common/lib/linux -L"/home/viniciusdasilva/workspace/CyberX3D/Debug" -L"/home/viniciusdasilva/workspace/PQP_v1.3/lib" -o "continuous_collision_detection" ./src/Matrix.o ./src/bvh_kernels.o ./src/cpu_bvh_constru.o **./src/cuda_bvh_constru.o** **./src/cuda_bvhexports.o** ./src/cuda_collision.o ./src/cuda_make_grid.o ./src/cuda_rss_constru.o ./src/cuda_timer.o ./src/cudasort.o ./src/geometry.o ./src/importer_utility.o ./src/lbvh.o ./src/lbvh2.o ./src/linux_functions.o ./src/main.o ./src/plyfile.o ./src/plyfunctions.o ./src/radixsort.o ./src/scene.o ./src/transform.o -lPQP -lcutil_x86_64 -lcudpp_x86_64 -lCyberX3D -lpthread -lrt -lGLEW -lboost_thread -lboost_serialization -lboost_wserialization -lboost_filesystem -lboost_system -lglut -ldl -lm -lLLVMTransformUtils -lLLVMipa -lLLVMSystem -lLLVMMC -lLLVMCore -lLLVMSupport -lLLVMAnalysis -lLLVMTarget -lLLVMAsmParser -lLLVMX86Disassembler -lLLVMInstCombine -lLLVMX86AsmParser -lLLVMX86AsmPrinter -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmP开发者_运维百科rinter -lLLVMX86Info -lLLVMJIT -lLLVMExecutionEngine -lLLVMCodeGen -lLLVMScalarOpts -locelot
I can't figure out why these symbols aren't being discovered by the linker, since I think the objects are being passed correctly. Is there a specific order I need to put these objects in? Or is it something else?
order must be:
cuda_bvhexports.o cuda_bvh_constru.o
Why does the order in which libraries are linked sometimes cause errors in GCC?
If putting the cuda_bvhexports.o in front of cuda_bvh_constru.o doesn't work you could try putting all of your object files in a static library then pass that to the linker.
精彩评论