我试图将libusb-1.0库与Nsight Eclipse一起使用。我按照以下步骤进行操作:
根据libusb安装结束时的说明:
Libraries have been installed in:
/usr/local/lib
If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- Add LIBDIR to the `LD_LIBRARY_PATH' environment variable
During execution:
- Add LIBDIR to the `LD_RUN_PATH' environment variable
During linking:
- Use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- Have your system administrator add LIBDIR to `/etc/ld.so.conf'
我添加了以下内容:
当我在Nsight Eclipse中构建项目时,我在控制台中收到以下错误。
make all
Building file: ../src/sample.cu
Invoking: NVCC Compiler
/usr/local/cuda-6.5/bin/nvcc -I/usr/include/libusb-1.0 -G -g -O0 -ccbin arm-linux-gnueabihf-g++-4.6 -gencode arch=compute_20,code=sm_20 --target-cpu-architecture ARM -m32 -odir "src" -M -o "src/sample.d" "../src/sample.cu"
/usr/local/cuda-6.5/bin/nvcc -I/usr/include/libusb-1.0 -G -g -O0 --compile --relocatable-device-code=false -gencode arch=compute_20,code=compute_20 -gencode arch=compute_20,code=sm_20 --target-cpu-architecture ARM -m32 -ccbin arm-linux-gnueabihf-g++-4.6 -x cu -o "src/sample.o" "../src/sample.cu"
../src/sample.cu(71): warning: variable "data" was declared but never referenced
../src/sample.cu(71): warning: variable "data" was declared but never referenced
Finished building: ../src/sample.cu
Building target: sample
Invoking: NVCC Linker
/usr/local/cuda-6.5/bin/nvcc --cudart static -LLIBDIR -Xlinker --unresolved-symbols=ignore-in-shared-libs --relocatable-device-code=false -gencode arch=compute_20,code=compute_20 -gencode arch=compute_20,code=sm_20 --target-cpu-architecture ARM -m32 -ccbin arm-linux-gnueabihf-g++-4.6 -link -o "sample" ./src/sample.o -lusb-1.0
/usr/lib/../lib/libusb-1.0.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status
make: *** [sample] Error 1
我该如何解决这个问题?
答案 0 :(得分:1)
我能够在libusb开发邮件列表的帮助下修复我的问题。 应该在64位主机上为目标配置libusb库。
我必须为目标arm-linux-gnueabihf配置库,我必须禁用udev。 所以,我使用了命令
./ configure --host = arm-linux-gnueabihf --prefix = / usr --disable-static --disable-udev&&制造&& make install
我能够正确配置libusb并立即编译。