Quantcast

compile static application, libftdi-0.20

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

compile static application, libftdi-0.20

gobo
hello everyone.

i'm experimenting with libftdi-0.20.  0.20 has been compiled on a test
box, but not
installed.

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'

the archive has the correct member:
$ ar -t libftdi.a
ftdi.o

can anyone explain what is wrong?  or what i'm doing wrong.

thanks.

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to [hidden email]  

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: compile static application, libftdi-0.20

Anders Larsen
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 [hidden email]

Loading...