1

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œur
  • 37,241
  • 25
  • 195
  • 267
TimN
  • 11
  • 4

1 Answers1

0

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)

George Profenza
  • 50,687
  • 19
  • 144
  • 218