CMake 始终无法找到静态库?谁能

尝试把这个静态库文件

/home/song/Work/NVDW/samples/src/speedbump/source/sbd_yolov2_detect.a

和其他driveworks的文件link起来,但是始终报错。谁可以帮帮忙看看为什么?谢谢

/usr/bin/c++   -gsplit-dwarf -Wall -Wunused -Wunused-value -Wunused-parameter -g   -Wl,--no-undefined -Wl,--as-needed CMakeFiles/speedBump.dir/gen_main.cu.o  -o speedBump  -L/home/song/Work/NVDW/samples/src/speedbump/source -Wl,-rpath,/home/song/Work/NVDW/samples/src/speedbump/source:/usr/local/cuda/lib64:/usr/local/driveworks-2.2/targets/x86_64-Linux/lib /usr/local/cuda/lib64/libcudart.so /usr/local/driveworks-2.2/targets/x86_64-Linux/lib/libdriveworks.so /usr/local/driveworks-2.2/targets/x86_64-Linux/lib/libdriveworks_visualization.so /usr/local/cuda/lib64/libcudart.so /usr/lib/x86_64-linux-gnu/libcublas.so ../../framework/libsamples_allocator.a ../../framework/libsamples_framework.a -Wl,-Bstatic -lsbd_yolov2_detect ../../../3rdparty/src/glfw/libglfw-src.a -Wl,-Bdynamic -ldl -lpthread /usr/lib/x86_64-linux-gnu/libSM.so /usr/lib/x86_64-linux-gnu/libICE.so /usr/lib/x86_64-linux-gnu/libX11.so /usr/lib/x86_64-linux-gnu/libXext.so /usr/lib/x86_64-linux-gnu/libXxf86vm.so /usr/lib/x86_64-linux-gnu/libXinerama.so /usr/lib/x86_64-linux-gnu/libXcursor.so /usr/lib/x86_64-linux-gnu/libXrandr.so ../../../3rdparty/src/lodepng/liblodepng-src.a -ldrm /usr/local/cuda/lib64/libcudart.so ../../../3rdparty/src/glew/libglew-src.a -lGLU -lGL 
[build] /usr/bin/ld: cannot find -lsbd_yolov2_detect

error log:

[main] Building folder: samples 
[build] Starting build
[proc] Executing command: /usr/bin/cmake --build /home/song/Work/NVDW/samples/build --config Debug --target all -- -j 8
[build] -- Could NOT find EGL (missing:  EGL_LIBRARY EGL_INCLUDE_DIR) 
[build] -- Building with TRT version  and cudnn version 7.5.1.14
[build] -- Building GLFW for X11 (static)
[build] -- Driveworks Samples install dir: /home/song/Work/NVDW/samples/build/install
[build] -- Found Driveworks 
[build] -- Configuring done
[build] -- Generating done
[build] -- Build files have been written to: /home/song/Work/NVDW/samples/build
[build] [  4%] Built target samples_allocator
[build] [  9%] Built target glew-src
[build] [ 14%] Built target lodepng-src
[build] [ 50%] Built target glfw-x11
[build] [ 52%] Built target update_cuda_deps
[build] [ 54%] Built target glfw-src
[build] [ 95%] Built target samples_framework
[build] [ 97%] Linking CXX executable speedBump
[build] /usr/bin/ld: cannot find -lsbd_yolov2_detect
[build] collect2: error: ld returned 1 exit status
[build] src/speedbump/source/CMakeFiles/speedBump.dir/build.make:344: recipe for target 'src/speedbump/source/speedBump' failed
[build] make[2]: *** [src/speedbump/source/speedBump] Error 1
[build] make[1]: *** [src/speedbump/source/CMakeFiles/speedBump.dir/all] Error 2
[build] CMakeFiles/Makefile2:464: recipe for target 'src/speedbump/source/CMakeFiles/speedBump.dir/all' failed
[build] Makefile:83: recipe for target 'all' failed
[build] make: *** [all] Error 2
[build] Build finished with exit code 2
c++

1个回答

看一下是32位还是64位
readelf -h
https://blog.csdn.net/yfldyxl/article/details/81566279

bobhuang
bobhuang 回复weixin_41871265: 可能是因为这个:-lsbd_yolov2_detect 会寻找 libsbd_yolov2_detect.a, 而不是sbd_yolov2_detect.a
5 个月之前 回复
weixin_41871265
大大的开发 下面是.a的,确实是64位的
5 个月之前 回复
weixin_41871265
大大的开发 ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: REL (Relocatable file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x0 Start of program headers: 0 (bytes into file) Start of section headers: 27512 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 0 (bytes) Number of program headers: 0 Size of section headers: 64 (bytes) Number of section headers: 23 Section header string table index: 22
5 个月之前 回复
weixin_41871265
大大的开发 看了一下,是上面这个样子的
5 个月之前 回复
weixin_41871265
大大的开发 ELF Header: Magic: 7f 45 4c 46 02 01 01 03 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - GNU ABI Version: 0 Type: DYN (Shared object file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x126e0 Start of program headers: 64 (bytes into file) Start of section headers: 6024856 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 8 Size of section headers: 64 (bytes) Number of section headers: 35 Section header string table index: 34
5 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐