Shihab Shihab - 1 month ago 11
Linux Question

FTDI D2XX library works with Ubuntu, but shows error on ezsdk cross compilation

I want to write a program to read from an FTDI device using the D2XX library in ezsdk 6.0 BeagleBoard.

I use Ubuntu 12.04 LTS (Precise Pangolin) for compilation.

I downloaded libftd2xx1.1.12.tar.gz from http://www.ftdichip.com


  • Unpacked the archive

  • Copied arm926 lib files to \usr\local\lib

  • Created a symbolic link with proper permission and

  • cross compiled
    with the arm-linux-gnueabihf-gcc toolchain



I followed (http://www.ftdichip.com/Drivers/D2XX/Linux/ReadMe-linux.txt) and on cross compiling it shows the error 'cannot find -lftd2xx'

shihab@shihab:~/Downloads/release/examples$ make -B CC=arm-linux-gnueabihf-gcc
for n in BitMode EEPROM/erase EEPROM/read EEPROM/write EEPROM/user/read EEPROM/user/size EEPROM/user/write Events LargeRead MultiThread SetVIDPID Simple Timeouts ; do make -C $n || exit 1; done
make[1]: Entering directory `/home/shihab/Downloads/release/examples/BitMode'
arm-linux-gnueabihf-gcc main.c -o bitmode -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
/usr/lib/gcc/arm-linux-gnueabihf/4.6/../../../../arm-linux-gnueabihf/bin/ld: cannot find -lftd2xx
collect2: ld returned 1 exit status
make[1]: *** [bitmode] Error 1
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/BitMode'
make: *** [subdirs] Error 1
shihab@shihab:~/Downloads/release/examples$


But when I followed it for i386 architecture it compiles fine


  • Unpacked the archive

  • Copied i386 lib files to \usr\local\lib

  • Created a symbolic link with proper permission and

  • compiled gcc



it compiles fine.

shihab@shihab:~/Downloads/release/examples$ make -B
for n in BitMode EEPROM/erase EEPROM/read EEPROM/write EEPROM/user/read EEPROM/user/size EEPROM/user/write Events LargeRead MultiThread SetVIDPID Simple Timeouts ; do make -C $n || exit 1; done
make[1]: Entering directory `/home/shihab/Downloads/release/examples/BitMode'
gcc main.c -o bitmode -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/BitMode'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/erase'
gcc main.c -o erase -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/erase'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/read'
gcc main.c -o read -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/read'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/write'
gcc main.c -o write -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/write'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/user/read'
gcc main.c -o readua -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/user/read'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/user/size'
gcc main.c -o sizeua -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/user/size'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/EEPROM/user/write'
gcc main.c -o writeua -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/EEPROM/user/write'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/Events'
gcc main.c -o events -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/Events'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/LargeRead'
gcc main.c -o largeread -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/LargeRead'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/MultiThread'
gcc main.c -o multi -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/MultiThread'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/SetVIDPID'
gcc main.c -o setVIDPID -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/SetVIDPID'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/Simple'
gcc main.c -o simple -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/Simple'
make[1]: Entering directory `/home/shihab/Downloads/release/examples/Timeouts'
gcc main.c -o timeouts -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Leaving directory `/home/shihab/Downloads/release/examples/Timeouts'
shihab@shihab:~/Downloads/release/examples$ cd EEPROM/read/
shihab@shihab:~/Downloads/release/examples/EEPROM/read$ ./read
Library version = 0x10112
Opening port 0
FT_Open(0) failed
shihab@shihab:~/Downloads/release/examples/EEPROM/read$


There is no 'cannot find -lftd2xx' error, and it compiles fine.

I am new to Linux; what is wrong with my steps?

Answer

You need to unload ftdi_ser module (by rmmod ftdi_sio before you can use the ftd2xx library. As the kernel loads the ftdi_sio module automatically, you may need to put it on a blacklist.

The library published on the FTDI homepage is not compiled for arm-hf. A version compiled for arm_hf is available here