我试图在Nsight Eclipse中使用libusb-1.0库。为此,我遵循了以下步骤:
-LLIBDIR' flag during linking and do at least one of the following: - Add LIBDIR to theLD_LIBRARY_PATH‘环境变量:-将LIBDIR添加到LD\_RUN\_PATH' environment variable During linking: - Use the-Wl、-rpath -Wl、LIBDIR’链接器标志-让系统管理员将LIBDIR添加到`/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我该怎么解决这个问题?
发布于 2014-12-24 21:58:26
我能够通过libusb开发邮件列表来解决我的问题。libusb库应该配置为64位主机上的目标。
我不得不为目标arm-linux-gnueabihf配置库,并且必须禁用udev。所以我用了命令,
/配置--主机=arm-linux-gnueabihf-前缀=/usr-禁用-静态-禁用-udev && make & make安装
我能够正确地配置libusb,它现在编译了。
https://stackoverflow.com/questions/27576181
复制相似问题