FTDI驱动程序库运行失败 [英] FTDI driver library fail on run
问题描述
4使用Raspian Wheezy对Raspberry Pi B进行编程.我的pi带有FTDI usb/串行芯片FT231X的定制子板.我找到了该设备的驱动程序(FTD2xx.1.1.12),其中提供了一些示例程序.根据文档,我将驱动程序(.a和.so)安装到/usr/loca/lib,然后运行示例程序之一.这是使用SSH客户端(即不是来自Netbeans)完成的.编译错误,程序运行无误.现在,当我尝试将静态库包含在我的Netbeans构建中时,它可以正常运行,但是当我尝试运行(调试或发布版本)时,它无法运行,并返回错误加载共享库时出错:libftd2xx.so:无法打开共享目标文件:没有这样的文件或目录.RUN FAILED(退出值127,总时间203ms)".首先,当我在Netbeans中的静态.a库中进行链接时,为什么要寻找共享库?
4 to program a Raspberry Pi B with Raspian Wheezy. My pi has custom daughter board with an FTDI usb/serial chip FT231X. I located a driver for this device ( FTD2xx.1.1.12 ) which comes with a few example programs. As per the docs I installed the drivers ( .a and .so ) to /usr/loca/lib and then ran one of the example programs. This was done using the SSH client ie not from Netbeans. There o build errors and the program ran without errors. Now when I try and include the static library in my Netbeans build it builds OK but when I attempt to run ( debug or release build ) it does not run and returns an error "error while loading shared libraries:libftd2xx.so : cannot open shared object file: No such file or directory. RUN FAILED ( exit value 127, total time 203ms )". Firstly why is it looking for the shared library when I linked in the static .a library in Netbeans?
推荐答案
在尝试编译示例之一的纯C语言中,我遇到了类似的问题. 我在做
I had a similar issue in plain c trying to compile one of the examples. I was doing
gcc main.c -o ftdiTest -lftd2xx
,但遇到相同的错误.
使用rpath
标志编译可解决问题:
but ran into the same error.
using the rpath
flag compiling solved the problem:
gcc main.c -o ftdiTest -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
我不是真的需要它,但是将LD_LIBRARY_PATH
设置为/usr/local/lib
可能会有所帮助.
I'm not if it's actually needed, but setting the LD_LIBRARY_PATH
to /usr/local/lib
might help.
在使用libftd2xx运行应用程序之前,需要使用sudo
和ftdi_sio
和usbserial
驱动程序(如果存在)运行可执行文件.这是自述文件上的一句话:
The executable will need be run with sudo
and ftdi_sio
and usbserial
drivers need to be unloaded if present before running the app using libftd2xx. Here's a quote from the Readme on it:
如果出现消息"FT_Open失败": 也许内核会自动为该驱动程序加载另一个驱动程序 FTDI USB设备.
If the message "FT_Open failed" appears: Perhaps the kernel automatically loaded another driver for the FTDI USB device.
`sudo lsmod`
If "ftdi_sio" is listed:
Unload it (and its helper module, usbserial), as follows.
`sudo rmmod ftdi_sio`
`sudo rmmod usbserial`
Otherwise, it's possible that libftd2xx does not recognise your
device's Vendor and Product Identifiers. Call FT_SetVIDPID before
calling FT_Open/FT_OpenEx/FT_ListDevices.
这也应该在c ++中起作用(我在 OpenFrameworks 项目中使用了相同的方法)
This should work in c++ too (I've used the same in an OpenFrameworks project)
此外,我还记得Raspberry PI1(armv6)上的库存在一些问题,并通过电子邮件发送了FTDI支持.他们提供了重新编译的库,该库可以正常工作.同一库可在Raspberry PI2(armv7)上运行
Also, I remember having some issues with the library on Raspberry PI1 (armv6) and emailed FTDI support. They supplied a recompiled library which worked. The same library works on Raspberry PI2(armv7)
这篇关于FTDI驱动程序库运行失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!