libftdi Archives

Subject: Re: compile static application, libftdi-0.20

From: Anders Larsen <al@xxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 30 Jun 2015 21:42:17 +0200
Hi,

On 2015-06-30 21:06, gobo wrote:
my project code has been tested with dynamic libraries built with the command
line below and they work as expected.

    gcc -o traffic -L. -Wl,-rpath=/mnt/nas3/proj/usbbb/code/test20
traffic.c -lftdi

the next step was to build using a static libftdi. the archive file was moved
from src/.libs to my code directory.  compile command:

    gcc -static -o traffic traffic.c -L. -lftdi

with this command i get undefined references to all of the libftdi functions.
./libftdi.a(ftdi.o): In function `ftdi_usb_close_internal':
/proj/usbbb/code/test20/libftdi-0.20/src/ftdi.c:68: undefined
reference to `usb_close'
./libftdi.a(ftdi.o): In function `ftdi_usb_find_all':
/proj/usbbb/code/test20/libftdi-0.20/src/ftdi.c:272: undefined
reference to `usb_init'

you need to link against libusb to get 'usb_init' and 'usb_close';

        gcc -static -o traffic traffic.c -L. -lftdi -lusb

should do the trick (the dynamic libftdi is already linked against libusb).

HTH,
cheers

Anders
--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx

Current Thread