FTDI driver library fail on run

懵懂的女人 提交于 2019-12-11 10:08:09

问题


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?


回答1:


I had a similar issue in plain c trying to compile one of the examples. I was doing

gcc main.c -o ftdiTest -lftd2xx

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

I'm not if it's actually needed, but setting the LD_LIBRARY_PATH to /usr/local/lib might help.

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:

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.

This should work in c++ too (I've used the same in an OpenFrameworks project)

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)



来源:https://stackoverflow.com/questions/25056795/ftdi-driver-library-fail-on-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!