0

为了向外部设备发送命令,我使用了 FTDI 的 TTL-232R-3V3 线。我想在那里设置特定的路径到高或低。不需要奇偶校验位或停止位。

我的操作系统是 Ubuntu Linux 13.04。

我想开发一个可以发送这些命令的 Java 或 C 应用程序。但是当我尝试为电线安装驱动程序时出现错误:

我按照这个说明,我决定安装 D2XX 驱动程序。我想我已经成功安装了步骤 2.1 中描述的共享对象和静态库,无论如何我没有收到任何错误消息。

但是当我尝试编译示例代码时,如步骤 3 中所述,我得到以下执行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]: Betrete Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/BitMode'
gcc main.c -o bitmode -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib  
make[1]: Verlasse Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/BitMode'
make[1]: Betrete Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/erase'
gcc main.c -o erase -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Verlasse Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/erase'
make[1]: Betrete Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/read'
gcc main.c -o read -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Verlasse Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/read'
make[1]: Betrete Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/write'
gcc main.c -o write -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Verlasse Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/write'
make[1]: Betrete Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/user/read'
gcc main.c -o readua -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Verlasse Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/user/read'
make[1]: Betrete Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/user/size'
gcc main.c -o sizeua -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Verlasse Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/user/size'
make[1]: Betrete Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/user/write'
gcc main.c -o writeua -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Verlasse Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/EEPROM/user/write'
make[1]: Betrete Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/Events'
gcc main.c -o events -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Verlasse Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/Events'
make[1]: Betrete Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/LargeRead'
gcc main.c -o largeread -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Verlasse Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/LargeRead'
make[1]: Betrete Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/MultiThread'
gcc main.c -o multi -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
make[1]: Verlasse Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples/MultiThread'
gcc main.c -o multi -Wall -Wextra -L. -lftd2xx -Wl,-rpath /usr/local/lib
/usr/bin/ld: /tmp/ccoAsrRg.o: undefined reference to symbol     'pthread_create@@GLIBC_2.2.5'
/usr/bin/ld: note: 'pthread_create@@GLIBC_2.2.5' is defined in DSO /lib/x86_64-linux-    gnu/libpthread.so.0 so try adding it to the linker command line
/lib/x86_64-linux-gnu/libpthread.so.0: could not read symbols: Ungültiger Vorgang
collect2: Fehler: ld gab 1 als Ende-Status zurück
make[1]: *** [multi] Fehler 1
make[1]: Verlasse Verzeichnis '/home/robin/Dokumente/Java/Stepper/lib/release/examples    /MultiThread'
make: *** [subdirs] Fehler 1

我该如何解决这个错误?有人使用过这种线和 Linux 吗?提前致谢!

4

1 回答 1

0

某些示例或其依赖项之一正在使用 pthreads,但未为此配置 Makefile。

编辑 Makefile 并添加-pthreadCFLAGSLDFLAGS. 您可以通过添加行来做到这一点

CFLAGS += -pthread
LDFLAGS += -pthread

但是,您可能根本不需要 D2XX 库。/dev/ttyUSBFTDI内核驱动程序应该创建一个您可以像使用“真实”串行端口一样使用的设备。

于 2013-07-17T16:25:07.757 回答