linux - FTDI D2XX 库适用于 Ubuntu,但在 ezsdk 交叉编译上显示错误

标签 linux shared-libraries ubuntu-12.04 cross-compiling ftdi

我想编写一个程序,使用 ezsdk 6.0 中的 D2XX 库从 FTDI 设备读取 BeagleBoard .

我使用Ubuntu 12.04用于编译的 LTS(精确穿山甲)。

我从http://www.ftdichip.com下载了libftd2xx1.1.12.tar.gz

  • 解压存档
  • 将arm926 lib文件复制到\usr\local\lib
  • 创建了具有适当权限的符号链接(symbolic link),并且
  • 交叉编译 使用arm-linux-gnueabihf-gcc工具链

我遵循( http://www.ftdichip.com/Drivers/D2XX/Linux/ReadMe-linux.txt )并在交叉编译时显示错误“找不到-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$

但是当我遵循 i386 架构时,它编译得很好

  • 解压存档
  • 将 i386 lib 文件复制到\usr\local\lib
  • 创建了具有适当权限的符号链接(symbolic link),并且
  • 编译gcc

它编译得很好。

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$

没有“找不到-lftd2xx”错误,并且编译正常。

我是 Linux 新手;我的步骤有什么问题吗?

最佳答案

您需要卸载ftdi_ser模块(通过rmmod ftdi_sio)才能使用ftd2xx库。当内核加载 ftdi_sio模块自动,您可能需要将其放入黑名单。

FTDI 主页上发布的库不是为arm-hf 编译的。为arm_hf编译的版本可用here

关于linux - FTDI D2XX 库适用于 Ubuntu,但在 ezsdk 交叉编译上显示错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18547189/

相关文章:

linux - 使用 shell 脚本填充 Excel 工作表列中的值

python - 结构非零返回代码 137

linux - 如何在 Linux 上取消关机?

c++ - 共享库的兼容性

ctypes回调函数抛出SIGSEGV

python - 如何列出 python 脚本运行时加载的 .so 文件?

sql - 将sql ddl文件上传到postgresql数据库

C pipe() 在调用一定次数后返回错误

linux - 如何将 ubuntu 终端输出重定向到文件?

cookies - Lynx 将其 cookie 存储在哪里?