libftdi and libftd2xx - revision 2571 - ubuntu

Hi, I tried yesterday to compile OpenOCD but following errors occured.

./configure --enable-parport --enable-parport-ppdev --enable-ft2232_libftdi

.

.

checking Build & Link with libftdi… configure: error: Cannot build & run test program using libftdi

.

.

./configure --enable-parport --enable-parport-ppdev --enable-ft2232_ftd2xx --with-ftd2xx-linux-tardir=/home/grzes/openocd/libftd2xx0.4.16

configure script ends with no complain but make gives such error:

.

.

/bin/sh …/libtool --tag=CC --mode=link gcc -std=gnu99 -g -O2 -I/home/grzes/openocd/libftd2xx0.4.16 -Wall -Wstrict-prototypes -Wformat-security -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Werror -o openocd main.o libopenocd.la -ldl /home/grzes/openocd/libftd2xx0.4.16/static_lib/libftd2xx.a.0.4.16 -lpthread

libtool: link: gcc -std=gnu99 -g -O2 -I/home/grzes/openocd/libftd2xx0.4.16 -Wall -Wstrict-prototypes -Wformat-security -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Werror -o openocd main.o /home/grzes/openocd/libftd2xx0.4.16/static_lib/libftd2xx.a.0.4.16 ./.libs/libopenocd.a -ldl -lpthread

./.libs/libopenocd.a(ft2232.o): In function `ft2232_quit’:

/home/grzes/openocd/src/jtag/ft2232.c:2773: undefined reference to `FT_Close’

./.libs/libopenocd.a(ft2232.o): In function `ft2232_write’:

/home/grzes/openocd/src/jtag/ft2232.c:347: undefined reference to `FT_Write’

./.libs/libopenocd.a(ft2232.o): In function `ft2232_init_ftd2xx’:

/home/grzes/openocd/src/jtag/ft2232.c:1809: undefined reference to `FT_SetVIDPID’

/home/grzes/openocd/src/jtag/ft2232.c:1839: undefined reference to `FT_OpenEx’

/home/grzes/openocd/src/jtag/ft2232.c:1903: undefined reference to `FT_SetLatencyTimer’

/home/grzes/openocd/src/jtag/ft2232.c:1909: undefined reference to `FT_GetLatencyTimer’

/home/grzes/openocd/src/jtag/ft2232.c:1919: undefined reference to `FT_SetTimeouts’

/home/grzes/openocd/src/jtag/ft2232.c:1925: undefined reference to `FT_SetBitMode’

/home/grzes/openocd/src/jtag/ft2232.c:1931: undefined reference to `FT_GetDeviceInfo’

/home/grzes/openocd/src/jtag/ft2232.c:1871: undefined reference to `FT_ListDevices’

/home/grzes/openocd/src/jtag/ft2232.c:1882: undefined reference to `FT_ListDevices’

/home/grzes/openocd/src/jtag/ft2232.c:1809: undefined reference to `FT_SetVIDPID’

/home/grzes/openocd/src/jtag/ft2232.c:1847: undefined reference to `FT_OpenEx’

./.libs/libopenocd.a(ft2232.o): In function `ft2232_purge_ftd2xx’:

/home/grzes/openocd/src/jtag/ft2232.c:1960: undefined reference to `FT_Purge’

./.libs/libopenocd.a(ft2232.o): In function `ft2232_read’:

/home/grzes/openocd/src/jtag/ft2232.c:385: undefined reference to `FT_Read’

collect2: ld returned 1 exit status

make[3]: *** [openocd] Error 1

make[3]: Leaving directory `/home/grzes/openocd/src’

make[2]: *** [all-recursive] Error 1

make[2]: Leaving directory `/home/grzes/openocd/src’

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/home/grzes/openocd’

make: *** [all] Error 2

I’ve already followed workaround in viewtopic.php?t=16477&start=0&postdays= … ft2232quit but it doesn’t work for me.

Any ideas? :frowning:

I have same problem.

When running the ./configure scripts try having an ftd2xx device installed and plugged into your USB port that is using the same exact version of the ftd2xx drivers you are compiling with. Otherwise the check and test for ftd2xx.lib will fail and you will get an error like this:

checking for ftd2xx.lib exists (win32)... checking whether ftd2xx library works. 
.. configure: error: Cannot build & run test program using ftd2xx.lib

Libftdi is available through synaptic/apt.

Try ```
sudo apt-get install libftdi-dev


Also OpenOCD is available via the package manager, but it's too old. So I downloaded v0.1.0 and compiled with ```
./configure --enable-ft2232_libftdi

and works.

Thanks inventore123, now I can compile with libftdi.

I verified that I can compile both 0.2.0 and 0.3.0, but still without ftd2xx.

Let me explain a bit more in detail.

libftdi and ftd2xx are two libraries to talk to FTDI devices. libftdi is opensource, so it is available through apt-get, while ftd2xx is closed source, so you have to download it from the FTDI website and install it manually.

Both libraries install an .so file, which is the equivalent of .dll files on windows. These files end up in /usr/lib or /usr/local/lib which is roughly the equivalent of C:\Windows\system32, that is, where most dynamic libraries end up.

In addition, also some .h files are installed to /usr/include or /usr/local/include (a directory that has no equivalent on windows) These .h files are C/C++ header files necessary to successfully compile an application (eg. OpenOCD) that uses such libraries.

Another interesting thing is that when you install something with a package manager, libraries have two versions, one is libfoo, the other libfoo-dev. The -dev version is intended for developers, so it installs also the .h files, while the non -dev version installs only the .so files. That’s why I told you to install libftdi-dev: because to successfully compile OpenOCD you need the .h file.

So if you can’t compile with ftd2xx it means that libftd2xx.so is not in /usr/lib and/or the files ftd2xx.h and WinTypes.h are not in /usr/include.

Please note that while you can have both libraries installed, since they do not interfere with each other, when you compile OpenOCD you have to make a decision: either you tell it to use libftdi, or ftd2xx, but not both.

As a last note, I use libftdi since contrary to what many people say, it is not that much slower than ftd2xx, and being opensource, it is better supported on Linux.

If you choose ftd2xx, please report on this forum if you get it successfully working :smiley:

Glad you were able to build openocd, incarsecurity. Now that you have it working, does it work when you run it as an ordinary user, or only as sudo?

(apolgies for the cross-post. Desperate times…)

hsutherl:
Glad you were able to build openocd, incarsecurity. Now that you have it working, does it work when you run it as an ordinary user, or only as sudo?

If you can't run as a regular user but can as root (sudo), check the udev rules file for the JTAG device you're using. The permissions should allow anyone to access that device.

inventore123:
Let me explain a bit more in detail.

libftdi and ftd2xx are two libraries to talk to FTDI devices. libftdi is opensource, so it is available through apt-get, while ftd2xx is closed source, so you have to download it from the FTDI website and install it manually.

Both libraries install an .so file, which is the equivalent of .dll files on windows. These files end up in /usr/lib or /usr/local/lib which is roughly the equivalent of C:\Windows\system32, that is, where most dynamic libraries end up.

Well, the closed source library will only end up where you put it.

inventore123:
In addition, also some .h files are installed to /usr/include or /usr/local/include (a directory that has no equivalent on windows) These .h files are C/C++ header files necessary to successfully compile an application (eg. OpenOCD) that uses such libraries.

Another interesting thing is that when you install something with a package manager, libraries have two versions, one is libfoo, the other libfoo-dev. The -dev version is intended for developers, so it installs also the .h files, while the non -dev version installs only the .so files. That’s why I told you to install libftdi-dev: because to successfully compile OpenOCD you need the .h file.

So if you can’t compile with ftd2xx it means that libftd2xx.so is not in /usr/lib and/or the files ftd2xx.h and WinTypes.h are not in /usr/include.

Not quite so. That’s only if you’re not telling the linker where the library is to be found. We can use the ‘–with-ftd2xx-linux-tardir’ option to do just that. I still can’t link, even if I do so.