首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在Nsight Eclipse中链接libusb-1.0库?

在Nsight Eclipse中链接libusb-1.0库?
EN

Stack Overflow用户
提问于 2014-12-20 01:45:28
回答 1查看 1K关注 0票数 1

我试图在Nsight Eclipse中使用libusb-1.0库。为此,我遵循了以下步骤:

  1. 下载libusb-1.0tarball并安装在主机(Ubuntu)中。
  2. 根据libusb安装结束时的指示: 库已安装在: /usr/local/lib中,如果您碰巧希望链接到给定目录LIBDIR中的已安装库,则必须使用libtool并指定库的完整路径名,或者在执行过程中使用-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‘

我补充了以下内容:

  • “‘LIBDIR”和libusb.-1.0.so菜单工具->设置下的文件路径-> NVCC链接库->库->库搜索路径(-L)
  • LD_LIBRARY_PATH和LD_RUN_PATH环境变量
  • NVCC编译器->下的libusb.h路径包括->包含路径(-l)
  • -葡萄牙-1.0在NVCC链接器->杂项->其他标志下

当我在Nsight Eclipse中构建我的项目时,我会在控制台中得到以下错误。

代码语言:javascript
复制
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

我该怎么解决这个问题?

EN

回答 1

Stack Overflow用户

发布于 2014-12-24 21:58:26

我能够通过libusb开发邮件列表来解决我的问题。libusb库应该配置为64位主机上的目标。

我不得不为目标arm-linux-gnueabihf配置库,并且必须禁用udev。所以我用了命令,

/配置--主机=arm-linux-gnueabihf-前缀=/usr-禁用-静态-禁用-udev && make & make安装

我能够正确地配置libusb,它现在编译了。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27576181

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档