Discussion:
[UrJTAG-dev] Trouble linking with ftd2xx.lib
Åke Rehnman
2012-10-14 11:01:25 UTC
Permalink
I had trouble linking with FTDI windows library. I finally had to resort to change the configure script, then rename the library to libftd2xx.a to get the linking to complete. It seems like the ftd2xx.lib is completely missing from the link command line.



Any Idea what the problem is?



/Ake



Making all in src/apps/jtag

make[2]: Entering directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

/bin/sh ../../../libtool --tag=CC --mode=link gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/liburjtag.la -lintl -lioperm -lreadline

libtool: link: gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/.libs/liburjtag.a -L/usr/local/lib -L/usr/lib/ncursesw -L/usr/lib /usr/local/lib/libusb-1.0.dll.a /usr/lib/libintl.dll.a /usr/lib/libiconv.dll.a /usr/lib/libioperm.dll.a /usr/lib/libpopt.dll.a -lreadline -L/usr/local/lib -L/usr/local/lib

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_flush':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:124: undefined reference to `***@16'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:160: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_read':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:222: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_connect':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:354: undefined reference to `***@4'

.

. a lot more of these

.

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:502: undefined reference to `***@12'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:509: undefined reference to `***@4'

../../../src/.libs/liburjtag.a(usbconnft232r.o): In function `usbconn_ft232r_close':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:529: undefined reference to `***@4'

collect2: ld returned 1 exit status

Makefile:420: recipe for target `jtag.exe' failed

make[2]: *** [jtag.exe] Error 1

make[2]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

Makefile:451: recipe for target `all-recursive' failed

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

make[1]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag'

Makefile:381: recipe for target `all' failed

make: *** [all] Error 2





Changed configure.ac



@@ -294,11 +295,14 @@

HAVELIBFTD2XX=yes

case $host in

*cygwin*|*mingw*)

+#akre

CFLAGS="$CFLAGS -I$with_ftd2xx"

- AS_IF([test -d "$with_ftd2xx/i386"], [

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

+ AS_IF([test -d "$with_ftd2xx/i386x"], [

FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+# FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ FTD2XXLIB="-lftd2xx $LIBS"

])

;;

*)
Peter Budny
2012-10-15 12:57:23 UTC
Permalink
Åke,



It’s not just you; I encountered this problem over a year ago. It seems that libtool is supposed to automatically determine the dependency on ftd2xx.lib, but doesn’t do so. It generated a dependency file that was basically empty. Unfortunately I don’t know libtool well enough to know how to fix it “correctly”.



I believe if you look in src/.libs/liburjtag.lai (or maybe it was just src/liburjtag.la?), you can see the dependencies that libtool generated. Mine looks like this:



# liburjtag.la - a libtool library file

# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1

#

# Please DO NOT delete this file!

# It is necessary for linking the library.



# The name that we can dlopen(3).

dlname=''



# Names of this library.

library_names=''



# The name of the static archive.

old_library='liburjtag.a'



# Linker flags that can not go in dependency_libs.

inherited_linker_flags=''



# Libraries that this one depends upon.

dependency_libs=''



# Names of additional weak libraries provided by this library

weak_library_names=''



# Version information for liburjtag.

current=0

age=0

revision=0



# Is this an already installed library?

installed=yes



# Should we warn about portability when linking against -modules?

shouldnotlink=no



# Files to dlopen/dlpreopen

dlopen=''

dlpreopen=''



# Directory that this library needs to be installed in:

libdir='/usr/local/lib'



Notice the complete lack of any mention of ftd2xx. (The file src/liburjtag.la only differs in “installed=no”.)
--
~ Peter Budny

Unicoi Systems

***@unicoi.com



From: Åke Rehnman [mailto:***@gmail.com]
Sent: Sunday, October 14, 2012 7:01 AM
To: urjtag-***@lists.sourceforge.net
Subject: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I had trouble linking with FTDI windows library. I finally had to resort to change the configure script, then rename the library to libftd2xx.a to get the linking to complete. It seems like the ftd2xx.lib is completely missing from the link command line.



Any Idea what the problem is?



/Ake



Making all in src/apps/jtag

make[2]: Entering directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

/bin/sh ../../../libtool --tag=CC --mode=link gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/liburjtag.la -lintl -lioperm -lreadline

libtool: link: gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/.libs/liburjtag.a -L/usr/local/lib -L/usr/lib/ncursesw -L/usr/lib /usr/local/lib/libusb-1.0.dll.a /usr/lib/libintl.dll.a /usr/lib/libiconv.dll.a /usr/lib/libioperm.dll.a /usr/lib/libpopt.dll.a -lreadline -L/usr/local/lib -L/usr/local/lib

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_flush':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:124: undefined reference to `***@16'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:160: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_read':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:222: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_connect':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:354: undefined reference to `***@4'

.

. a lot more of these

.

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:502: undefined reference to `***@12'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:509: undefined reference to `***@4'

../../../src/.libs/liburjtag.a(usbconnft232r.o): In function `usbconn_ft232r_close':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:529: undefined reference to `***@4'

collect2: ld returned 1 exit status

Makefile:420: recipe for target `jtag.exe' failed

make[2]: *** [jtag.exe] Error 1

make[2]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

Makefile:451: recipe for target `all-recursive' failed

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

make[1]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag'

Makefile:381: recipe for target `all' failed

make: *** [all] Error 2





Changed configure.ac



@@ -294,11 +295,14 @@

HAVELIBFTD2XX=yes

case $host in

*cygwin*|*mingw*)

+#akre

CFLAGS="$CFLAGS -I$with_ftd2xx"

- AS_IF([test -d "$with_ftd2xx/i386"], [

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

+ AS_IF([test -d "$with_ftd2xx/i386x"], [

FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+# FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ FTD2XXLIB="-lftd2xx $LIBS"

])

;;

*)
Colin O'Flynn
2012-11-06 16:26:58 UTC
Permalink
I recently went to build with f2xx, and came across this problem again.



Your “fixes” to the .ac file worked for me as well. I’d like to see this pushed into a real solution somehow though, as I’m sure it will frustrate many more people in the future, any ideas?



From: Peter Budny [mailto:***@unicoi.com]
Sent: October-15-12 9:57 AM
To: 'Åke Rehnman'; urjtag-***@lists.sourceforge.net
Subject: Re: [UrJTAG-dev] Trouble linking with ftd2xx.lib



Åke,



It’s not just you; I encountered this problem over a year ago. It seems that libtool is supposed to automatically determine the dependency on ftd2xx.lib, but doesn’t do so. It generated a dependency file that was basically empty. Unfortunately I don’t know libtool well enough to know how to fix it “correctly”.



I believe if you look in src/.libs/liburjtag.lai (or maybe it was just src/liburjtag.la?), you can see the dependencies that libtool generated. Mine looks like this:



# liburjtag.la - a libtool library file

# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1

#

# Please DO NOT delete this file!

# It is necessary for linking the library.



# The name that we can dlopen(3).

dlname=''



# Names of this library.

library_names=''



# The name of the static archive.

old_library='liburjtag.a'



# Linker flags that can not go in dependency_libs.

inherited_linker_flags=''



# Libraries that this one depends upon.

dependency_libs=''



# Names of additional weak libraries provided by this library

weak_library_names=''



# Version information for liburjtag.

current=0

age=0

revision=0



# Is this an already installed library?

installed=yes



# Should we warn about portability when linking against -modules?

shouldnotlink=no



# Files to dlopen/dlpreopen

dlopen=''

dlpreopen=''



# Directory that this library needs to be installed in:

libdir='/usr/local/lib'



Notice the complete lack of any mention of ftd2xx. (The file src/liburjtag.la only differs in “installed=no”.)
--
~ Peter Budny

Unicoi Systems

***@unicoi.com



From: Åke Rehnman [mailto:***@gmail.com]
Sent: Sunday, October 14, 2012 7:01 AM
To: urjtag-***@lists.sourceforge.net
Subject: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I had trouble linking with FTDI windows library. I finally had to resort to change the configure script, then rename the library to libftd2xx.a to get the linking to complete. It seems like the ftd2xx.lib is completely missing from the link command line.



Any Idea what the problem is?



/Ake



Making all in src/apps/jtag

make[2]: Entering directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

/bin/sh ../../../libtool --tag=CC --mode=link gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/liburjtag.la -lintl -lioperm -lreadline

libtool: link: gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/.libs/liburjtag.a -L/usr/local/lib -L/usr/lib/ncursesw -L/usr/lib /usr/local/lib/libusb-1.0.dll.a /usr/lib/libintl.dll.a /usr/lib/libiconv.dll.a /usr/lib/libioperm.dll.a /usr/lib/libpopt.dll.a -lreadline -L/usr/local/lib -L/usr/local/lib

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_flush':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:124: undefined reference to `***@16'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:160: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_read':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:222: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_connect':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:354: undefined reference to `***@4'

.

. a lot more of these

.

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:502: undefined reference to `***@12'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:509: undefined reference to `***@4'

../../../src/.libs/liburjtag.a(usbconnft232r.o): In function `usbconn_ft232r_close':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:529: undefined reference to `***@4'

collect2: ld returned 1 exit status

Makefile:420: recipe for target `jtag.exe' failed

make[2]: *** [jtag.exe] Error 1

make[2]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

Makefile:451: recipe for target `all-recursive' failed

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

make[1]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag'

Makefile:381: recipe for target `all' failed

make: *** [all] Error 2





Changed configure.ac



@@ -294,11 +295,14 @@

HAVELIBFTD2XX=yes

case $host in

*cygwin*|*mingw*)

+#akre

CFLAGS="$CFLAGS -I$with_ftd2xx"

- AS_IF([test -d "$with_ftd2xx/i386"], [

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

+ AS_IF([test -d "$with_ftd2xx/i386x"], [

FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+# FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ FTD2XXLIB="-lftd2xx $LIBS"

])

;;

*)
Åke Rehnman
2012-11-06 18:51:49 UTC
Permalink
A very interesting thread about windows import libraries, a bit old but addresses the problem. Unfortunately there’s no solution
.



http://lists.gnu.org/archive/html/libtool/2004-04/msg00050.html



/Ake



From: Colin O'Flynn [mailto:***@newae.com]
Sent: den 6 november 2012 17:27
To: 'Peter Budny'; 'Åke Rehnman'; urjtag-***@lists.sourceforge.net
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I recently went to build with f2xx, and came across this problem again.



Your “fixes” to the .ac file worked for me as well. I’d like to see this pushed into a real solution somehow though, as I’m sure it will frustrate many more people in the future, any ideas?



From: Peter Budny [mailto:***@unicoi.com]
Sent: October-15-12 9:57 AM
To: 'Åke Rehnman'; urjtag-***@lists.sourceforge.net
Subject: Re: [UrJTAG-dev] Trouble linking with ftd2xx.lib



Åke,



It’s not just you; I encountered this problem over a year ago. It seems that libtool is supposed to automatically determine the dependency on ftd2xx.lib, but doesn’t do so. It generated a dependency file that was basically empty. Unfortunately I don’t know libtool well enough to know how to fix it “correctly”.



I believe if you look in src/.libs/liburjtag.lai (or maybe it was just src/liburjtag.la?), you can see the dependencies that libtool generated. Mine looks like this:



# liburjtag.la - a libtool library file

# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1

#

# Please DO NOT delete this file!

# It is necessary for linking the library.



# The name that we can dlopen(3).

dlname=''



# Names of this library.

library_names=''



# The name of the static archive.

old_library='liburjtag.a'



# Linker flags that can not go in dependency_libs.

inherited_linker_flags=''



# Libraries that this one depends upon.

dependency_libs=''



# Names of additional weak libraries provided by this library

weak_library_names=''



# Version information for liburjtag.

current=0

age=0

revision=0



# Is this an already installed library?

installed=yes



# Should we warn about portability when linking against -modules?

shouldnotlink=no



# Files to dlopen/dlpreopen

dlopen=''

dlpreopen=''



# Directory that this library needs to be installed in:

libdir='/usr/local/lib'



Notice the complete lack of any mention of ftd2xx. (The file src/liburjtag.la only differs in “installed=no”.)
--
~ Peter Budny

Unicoi Systems

***@unicoi.com



From: Åke Rehnman [mailto:***@gmail.com]
Sent: Sunday, October 14, 2012 7:01 AM
To: urjtag-***@lists.sourceforge.net
Subject: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I had trouble linking with FTDI windows library. I finally had to resort to change the configure script, then rename the library to libftd2xx.a to get the linking to complete. It seems like the ftd2xx.lib is completely missing from the link command line.



Any Idea what the problem is?



/Ake



Making all in src/apps/jtag

make[2]: Entering directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

/bin/sh ../../../libtool --tag=CC --mode=link gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/liburjtag.la -lintl -lioperm -lreadline

libtool: link: gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/.libs/liburjtag.a -L/usr/local/lib -L/usr/lib/ncursesw -L/usr/lib /usr/local/lib/libusb-1.0.dll.a /usr/lib/libintl.dll.a /usr/lib/libiconv.dll.a /usr/lib/libioperm.dll.a /usr/lib/libpopt.dll.a -lreadline -L/usr/local/lib -L/usr/local/lib

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_flush':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:124: undefined reference to `***@16'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:160: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_read':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:222: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_connect':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:354: undefined reference to `***@4'

.

. a lot more of these

.

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:502: undefined reference to `***@12'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:509: undefined reference to `***@4'

../../../src/.libs/liburjtag.a(usbconnft232r.o): In function `usbconn_ft232r_close':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:529: undefined reference to `***@4'

collect2: ld returned 1 exit status

Makefile:420: recipe for target `jtag.exe' failed

make[2]: *** [jtag.exe] Error 1

make[2]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

Makefile:451: recipe for target `all-recursive' failed

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

make[1]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag'

Makefile:381: recipe for target `all' failed

make: *** [all] Error 2





Changed configure.ac



@@ -294,11 +295,14 @@

HAVELIBFTD2XX=yes

case $host in

*cygwin*|*mingw*)

+#akre

CFLAGS="$CFLAGS -I$with_ftd2xx"

- AS_IF([test -d "$with_ftd2xx/i386"], [

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

+ AS_IF([test -d "$with_ftd2xx/i386x"], [

FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+# FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ FTD2XXLIB="-lftd2xx $LIBS"

])

;;

*)
Åke Rehnman
2012-11-06 20:56:57 UTC
Permalink
I don’t know how I was able to make it so complicated. As it turns out libtool is perfectly able to handle windows libraries exactly the same way it does with regular libraries. Just link with –lftd2xx
 no renaming of libraries are required.



Here is a patch for you. Please try it and report back to the list.



/Ake



Index: configure.ac

===================================================================

--- configure.ac (revision 2035)

+++ configure.ac (working copy)

@@ -295,10 +296,11 @@

case $host in

*cygwin*|*mingw*)

CFLAGS="$CFLAGS -I$with_ftd2xx"

+ FTD2XXLIB="-lftd2xx"

AS_IF([test -d "$with_ftd2xx/i386"], [

- FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx/i386"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

])

;;

*)



From: Åke Rehnman [mailto:***@gmail.com]
Sent: den 6 november 2012 19:52
To: 'Colin O'Flynn'; 'Peter Budny'; 'urjtag-***@lists.sourceforge.net'
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



A very interesting thread about windows import libraries, a bit old but addresses the problem. Unfortunately there’s no solution
.



http://lists.gnu.org/archive/html/libtool/2004-04/msg00050.html



/Ake



From: Colin O'Flynn [mailto:***@newae.com]
Sent: den 6 november 2012 17:27
To: 'Peter Budny'; 'Åke Rehnman'; urjtag-***@lists.sourceforge.net
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I recently went to build with f2xx, and came across this problem again.



Your “fixes” to the .ac file worked for me as well. I’d like to see this pushed into a real solution somehow though, as I’m sure it will frustrate many more people in the future, any ideas?



From: Peter Budny [mailto:***@unicoi.com]
Sent: October-15-12 9:57 AM
To: 'Åke Rehnman'; urjtag-***@lists.sourceforge.net
Subject: Re: [UrJTAG-dev] Trouble linking with ftd2xx.lib



Åke,



It’s not just you; I encountered this problem over a year ago. It seems that libtool is supposed to automatically determine the dependency on ftd2xx.lib, but doesn’t do so. It generated a dependency file that was basically empty. Unfortunately I don’t know libtool well enough to know how to fix it “correctly”.



I believe if you look in src/.libs/liburjtag.lai (or maybe it was just src/liburjtag.la?), you can see the dependencies that libtool generated. Mine looks like this:



# liburjtag.la - a libtool library file

# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1

#

# Please DO NOT delete this file!

# It is necessary for linking the library.



# The name that we can dlopen(3).

dlname=''



# Names of this library.

library_names=''



# The name of the static archive.

old_library='liburjtag.a'



# Linker flags that can not go in dependency_libs.

inherited_linker_flags=''



# Libraries that this one depends upon.

dependency_libs=''



# Names of additional weak libraries provided by this library

weak_library_names=''



# Version information for liburjtag.

current=0

age=0

revision=0



# Is this an already installed library?

installed=yes



# Should we warn about portability when linking against -modules?

shouldnotlink=no



# Files to dlopen/dlpreopen

dlopen=''

dlpreopen=''



# Directory that this library needs to be installed in:

libdir='/usr/local/lib'



Notice the complete lack of any mention of ftd2xx. (The file src/liburjtag.la only differs in “installed=no”.)
--
~ Peter Budny

Unicoi Systems

***@unicoi.com



From: Åke Rehnman [mailto:***@gmail.com]
Sent: Sunday, October 14, 2012 7:01 AM
To: urjtag-***@lists.sourceforge.net
Subject: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I had trouble linking with FTDI windows library. I finally had to resort to change the configure script, then rename the library to libftd2xx.a to get the linking to complete. It seems like the ftd2xx.lib is completely missing from the link command line.



Any Idea what the problem is?



/Ake



Making all in src/apps/jtag

make[2]: Entering directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

/bin/sh ../../../libtool --tag=CC --mode=link gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/liburjtag.la -lintl -lioperm -lreadline

libtool: link: gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/.libs/liburjtag.a -L/usr/local/lib -L/usr/lib/ncursesw -L/usr/lib /usr/local/lib/libusb-1.0.dll.a /usr/lib/libintl.dll.a /usr/lib/libiconv.dll.a /usr/lib/libioperm.dll.a /usr/lib/libpopt.dll.a -lreadline -L/usr/local/lib -L/usr/local/lib

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_flush':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:124: undefined reference to `***@16'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:160: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_read':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:222: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_connect':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:354: undefined reference to `***@4'

.

. a lot more of these

.

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:502: undefined reference to `***@12'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:509: undefined reference to `***@4'

../../../src/.libs/liburjtag.a(usbconnft232r.o): In function `usbconn_ft232r_close':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:529: undefined reference to `***@4'

collect2: ld returned 1 exit status

Makefile:420: recipe for target `jtag.exe' failed

make[2]: *** [jtag.exe] Error 1

make[2]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

Makefile:451: recipe for target `all-recursive' failed

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

make[1]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag'

Makefile:381: recipe for target `all' failed

make: *** [all] Error 2





Changed configure.ac



@@ -294,11 +295,14 @@

HAVELIBFTD2XX=yes

case $host in

*cygwin*|*mingw*)

+#akre

CFLAGS="$CFLAGS -I$with_ftd2xx"

- AS_IF([test -d "$with_ftd2xx/i386"], [

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

+ AS_IF([test -d "$with_ftd2xx/i386x"], [

FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+# FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ FTD2XXLIB="-lftd2xx $LIBS"

])

;;

*)
Colin O'Flynn
2012-11-07 14:00:38 UTC
Permalink
Bam, your patch worked great. It does print this at some point but still links fine & works OK with my board.



*** Warning: linker path does not have real file for library -lftd2xx.

*** I have the capability to make that library automatically link in when

*** you link to this library. But I can only do this if you have a

*** shared version of the library, which you do not appear to have

*** because I did check the linker path looking for a file starting

*** with libftd2xx but no candidates were found. (...for file magic test)

*** The inter-library dependencies that have been dropped here will be

*** automatically added whenever a program is linked with this library

*** or is declared to -dlopen it.



*** Since this library must not contain undefined symbols,

*** because either the platform does not support them or

*** it was explicitly requested with -no-undefined,

*** libtool will only create a static version of it.



I made sure to check I didn’t have any of my old renamed libs hanging around.



BTW – does anyone think it might be useful to print a message if Cygwin/mingw is detected & ftd2xx is not, that people should see documentation about enabling that? I admitably was first a little confused about getting ftd2xx working, as had followed the instructions for Linux like an idiot.



From: Åke Rehnman [mailto:***@gmail.com]
Sent: November-06-12 4:57 PM
To: 'Colin O'Flynn'; 'Peter Budny'; urjtag-***@lists.sourceforge.net
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I don’t know how I was able to make it so complicated. As it turns out libtool is perfectly able to handle windows libraries exactly the same way it does with regular libraries. Just link with –lftd2xx
 no renaming of libraries are required.



Here is a patch for you. Please try it and report back to the list.



/Ake



Index: configure.ac

===================================================================

--- configure.ac (revision 2035)

+++ configure.ac (working copy)

@@ -295,10 +296,11 @@

case $host in

*cygwin*|*mingw*)

CFLAGS="$CFLAGS -I$with_ftd2xx"

+ FTD2XXLIB="-lftd2xx"

AS_IF([test -d "$with_ftd2xx/i386"], [

- FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx/i386"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

])

;;

*)



From: Åke Rehnman [mailto:***@gmail.com]
Sent: den 6 november 2012 19:52
To: 'Colin O'Flynn'; 'Peter Budny'; 'urjtag-***@lists.sourceforge.net'
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



A very interesting thread about windows import libraries, a bit old but addresses the problem. Unfortunately there’s no solution
.



http://lists.gnu.org/archive/html/libtool/2004-04/msg00050.html



/Ake



From: Colin O'Flynn [mailto:***@newae.com]
Sent: den 6 november 2012 17:27
To: 'Peter Budny'; 'Åke Rehnman'; urjtag-***@lists.sourceforge.net
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I recently went to build with f2xx, and came across this problem again.



Your “fixes” to the .ac file worked for me as well. I’d like to see this pushed into a real solution somehow though, as I’m sure it will frustrate many more people in the future, any ideas?



From: Peter Budny [mailto:***@unicoi.com]
Sent: October-15-12 9:57 AM
To: 'Åke Rehnman'; urjtag-***@lists.sourceforge.net
Subject: Re: [UrJTAG-dev] Trouble linking with ftd2xx.lib



Åke,



It’s not just you; I encountered this problem over a year ago. It seems that libtool is supposed to automatically determine the dependency on ftd2xx.lib, but doesn’t do so. It generated a dependency file that was basically empty. Unfortunately I don’t know libtool well enough to know how to fix it “correctly”.



I believe if you look in src/.libs/liburjtag.lai (or maybe it was just src/liburjtag.la?), you can see the dependencies that libtool generated. Mine looks like this:



# liburjtag.la - a libtool library file

# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1

#

# Please DO NOT delete this file!

# It is necessary for linking the library.



# The name that we can dlopen(3).

dlname=''



# Names of this library.

library_names=''



# The name of the static archive.

old_library='liburjtag.a'



# Linker flags that can not go in dependency_libs.

inherited_linker_flags=''



# Libraries that this one depends upon.

dependency_libs=''



# Names of additional weak libraries provided by this library

weak_library_names=''



# Version information for liburjtag.

current=0

age=0

revision=0



# Is this an already installed library?

installed=yes



# Should we warn about portability when linking against -modules?

shouldnotlink=no



# Files to dlopen/dlpreopen

dlopen=''

dlpreopen=''



# Directory that this library needs to be installed in:

libdir='/usr/local/lib'



Notice the complete lack of any mention of ftd2xx. (The file src/liburjtag.la only differs in “installed=no”.)
--
~ Peter Budny

Unicoi Systems

***@unicoi.com



From: Åke Rehnman [mailto:***@gmail.com]
Sent: Sunday, October 14, 2012 7:01 AM
To: urjtag-***@lists.sourceforge.net
Subject: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I had trouble linking with FTDI windows library. I finally had to resort to change the configure script, then rename the library to libftd2xx.a to get the linking to complete. It seems like the ftd2xx.lib is completely missing from the link command line.



Any Idea what the problem is?



/Ake



Making all in src/apps/jtag

make[2]: Entering directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

/bin/sh ../../../libtool --tag=CC --mode=link gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/liburjtag.la -lintl -lioperm -lreadline

libtool: link: gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/.libs/liburjtag.a -L/usr/local/lib -L/usr/lib/ncursesw -L/usr/lib /usr/local/lib/libusb-1.0.dll.a /usr/lib/libintl.dll.a /usr/lib/libiconv.dll.a /usr/lib/libioperm.dll.a /usr/lib/libpopt.dll.a -lreadline -L/usr/local/lib -L/usr/local/lib

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_flush':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:124: undefined reference to `***@16'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:160: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_read':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:222: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_connect':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:354: undefined reference to `***@4'

.

. a lot more of these

.

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:502: undefined reference to `***@12'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:509: undefined reference to `***@4'

../../../src/.libs/liburjtag.a(usbconnft232r.o): In function `usbconn_ft232r_close':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:529: undefined reference to `***@4'

collect2: ld returned 1 exit status

Makefile:420: recipe for target `jtag.exe' failed

make[2]: *** [jtag.exe] Error 1

make[2]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

Makefile:451: recipe for target `all-recursive' failed

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

make[1]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag'

Makefile:381: recipe for target `all' failed

make: *** [all] Error 2





Changed configure.ac



@@ -294,11 +295,14 @@

HAVELIBFTD2XX=yes

case $host in

*cygwin*|*mingw*)

+#akre

CFLAGS="$CFLAGS -I$with_ftd2xx"

- AS_IF([test -d "$with_ftd2xx/i386"], [

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

+ AS_IF([test -d "$with_ftd2xx/i386x"], [

FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+# FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ FTD2XXLIB="-lftd2xx $LIBS"

])

;;

*)
Colin O'Flynn
2012-11-16 21:46:33 UTC
Permalink
Is there a chance to get this patch committed? sorry I don’t know who has commit privileges to ask directly.



-Colin



From: Colin O'Flynn [mailto:***@newae.com]
Sent: November-07-12 10:01 AM
To: 'Åke Rehnman'; 'Peter Budny'; urjtag-***@lists.sourceforge.net
Subject: Re: [UrJTAG-dev] Trouble linking with ftd2xx.lib



Bam, your patch worked great. It does print this at some point but still links fine & works OK with my board.



*** Warning: linker path does not have real file for library -lftd2xx.

*** I have the capability to make that library automatically link in when

*** you link to this library. But I can only do this if you have a

*** shared version of the library, which you do not appear to have

*** because I did check the linker path looking for a file starting

*** with libftd2xx but no candidates were found. (...for file magic test)

*** The inter-library dependencies that have been dropped here will be

*** automatically added whenever a program is linked with this library

*** or is declared to -dlopen it.



*** Since this library must not contain undefined symbols,

*** because either the platform does not support them or

*** it was explicitly requested with -no-undefined,

*** libtool will only create a static version of it.



I made sure to check I didn’t have any of my old renamed libs hanging around.



BTW – does anyone think it might be useful to print a message if Cygwin/mingw is detected & ftd2xx is not, that people should see documentation about enabling that? I admitably was first a little confused about getting ftd2xx working, as had followed the instructions for Linux like an idiot.



From: Åke Rehnman [mailto:***@gmail.com]
Sent: November-06-12 4:57 PM
To: 'Colin O'Flynn'; 'Peter Budny'; urjtag-***@lists.sourceforge.net
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I don’t know how I was able to make it so complicated. As it turns out libtool is perfectly able to handle windows libraries exactly the same way it does with regular libraries. Just link with –lftd2xx
 no renaming of libraries are required.



Here is a patch for you. Please try it and report back to the list.



/Ake



Index: configure.ac

===================================================================

--- configure.ac (revision 2035)

+++ configure.ac (working copy)

@@ -295,10 +296,11 @@

case $host in

*cygwin*|*mingw*)

CFLAGS="$CFLAGS -I$with_ftd2xx"

+ FTD2XXLIB="-lftd2xx"

AS_IF([test -d "$with_ftd2xx/i386"], [

- FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx/i386"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

])

;;

*)



From: Åke Rehnman [mailto:***@gmail.com]
Sent: den 6 november 2012 19:52
To: 'Colin O'Flynn'; 'Peter Budny'; 'urjtag-***@lists.sourceforge.net'
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



A very interesting thread about windows import libraries, a bit old but addresses the problem. Unfortunately there’s no solution
.



http://lists.gnu.org/archive/html/libtool/2004-04/msg00050.html



/Ake



From: Colin O'Flynn [mailto:***@newae.com]
Sent: den 6 november 2012 17:27
To: 'Peter Budny'; 'Åke Rehnman'; urjtag-***@lists.sourceforge.net
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I recently went to build with f2xx, and came across this problem again.



Your “fixes” to the .ac file worked for me as well. I’d like to see this pushed into a real solution somehow though, as I’m sure it will frustrate many more people in the future, any ideas?



From: Peter Budny [mailto:***@unicoi.com]
Sent: October-15-12 9:57 AM
To: 'Åke Rehnman'; urjtag-***@lists.sourceforge.net
Subject: Re: [UrJTAG-dev] Trouble linking with ftd2xx.lib



Åke,



It’s not just you; I encountered this problem over a year ago. It seems that libtool is supposed to automatically determine the dependency on ftd2xx.lib, but doesn’t do so. It generated a dependency file that was basically empty. Unfortunately I don’t know libtool well enough to know how to fix it “correctly”.



I believe if you look in src/.libs/liburjtag.lai (or maybe it was just src/liburjtag.la?), you can see the dependencies that libtool generated. Mine looks like this:



# liburjtag.la - a libtool library file

# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1

#

# Please DO NOT delete this file!

# It is necessary for linking the library.



# The name that we can dlopen(3).

dlname=''



# Names of this library.

library_names=''



# The name of the static archive.

old_library='liburjtag.a'



# Linker flags that can not go in dependency_libs.

inherited_linker_flags=''



# Libraries that this one depends upon.

dependency_libs=''



# Names of additional weak libraries provided by this library

weak_library_names=''



# Version information for liburjtag.

current=0

age=0

revision=0



# Is this an already installed library?

installed=yes



# Should we warn about portability when linking against -modules?

shouldnotlink=no



# Files to dlopen/dlpreopen

dlopen=''

dlpreopen=''



# Directory that this library needs to be installed in:

libdir='/usr/local/lib'



Notice the complete lack of any mention of ftd2xx. (The file src/liburjtag.la only differs in “installed=no”.)
--
~ Peter Budny

Unicoi Systems

***@unicoi.com



From: Åke Rehnman [mailto:***@gmail.com]
Sent: Sunday, October 14, 2012 7:01 AM
To: urjtag-***@lists.sourceforge.net
Subject: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I had trouble linking with FTDI windows library. I finally had to resort to change the configure script, then rename the library to libftd2xx.a to get the linking to complete. It seems like the ftd2xx.lib is completely missing from the link command line.



Any Idea what the problem is?



/Ake



Making all in src/apps/jtag

make[2]: Entering directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

/bin/sh ../../../libtool --tag=CC --mode=link gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/liburjtag.la -lintl -lioperm -lreadline

libtool: link: gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/.libs/liburjtag.a -L/usr/local/lib -L/usr/lib/ncursesw -L/usr/lib /usr/local/lib/libusb-1.0.dll.a /usr/lib/libintl.dll.a /usr/lib/libiconv.dll.a /usr/lib/libioperm.dll.a /usr/lib/libpopt.dll.a -lreadline -L/usr/local/lib -L/usr/local/lib

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_flush':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:124: undefined reference to `***@16'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:160: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_read':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:222: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_connect':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:354: undefined reference to `***@4'

.

. a lot more of these

.

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:502: undefined reference to `***@12'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:509: undefined reference to `***@4'

../../../src/.libs/liburjtag.a(usbconnft232r.o): In function `usbconn_ft232r_close':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:529: undefined reference to `***@4'

collect2: ld returned 1 exit status

Makefile:420: recipe for target `jtag.exe' failed

make[2]: *** [jtag.exe] Error 1

make[2]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

Makefile:451: recipe for target `all-recursive' failed

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

make[1]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag'

Makefile:381: recipe for target `all' failed

make: *** [all] Error 2





Changed configure.ac



@@ -294,11 +295,14 @@

HAVELIBFTD2XX=yes

case $host in

*cygwin*|*mingw*)

+#akre

CFLAGS="$CFLAGS -I$with_ftd2xx"

- AS_IF([test -d "$with_ftd2xx/i386"], [

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

+ AS_IF([test -d "$with_ftd2xx/i386x"], [

FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+# FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ FTD2XXLIB="-lftd2xx $LIBS"

])

;;

*)
Åke Rehnman
2012-11-17 20:53:31 UTC
Permalink
It seem a bit slow on comments from the maintainers on contributions
 I also have the FT232R driver waiting for comments/approval.



/Ake





From: Colin O'Flynn [mailto:***@newae.com]
Sent: den 16 november 2012 22:47
To: 'Åke Rehnman'; 'Peter Budny'; urjtag-***@lists.sourceforge.net
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



Is there a chance to get this patch committed? sorry I don’t know who has commit privileges to ask directly.



-Colin



From: Colin O'Flynn [mailto:***@newae.com]
Sent: November-07-12 10:01 AM
To: 'Åke Rehnman'; 'Peter Budny'; urjtag-***@lists.sourceforge.net
Subject: Re: [UrJTAG-dev] Trouble linking with ftd2xx.lib



Bam, your patch worked great. It does print this at some point but still links fine & works OK with my board.



*** Warning: linker path does not have real file for library -lftd2xx.

*** I have the capability to make that library automatically link in when

*** you link to this library. But I can only do this if you have a

*** shared version of the library, which you do not appear to have

*** because I did check the linker path looking for a file starting

*** with libftd2xx but no candidates were found. (...for file magic test)

*** The inter-library dependencies that have been dropped here will be

*** automatically added whenever a program is linked with this library

*** or is declared to -dlopen it.



*** Since this library must not contain undefined symbols,

*** because either the platform does not support them or

*** it was explicitly requested with -no-undefined,

*** libtool will only create a static version of it.



I made sure to check I didn’t have any of my old renamed libs hanging around.



BTW – does anyone think it might be useful to print a message if Cygwin/mingw is detected & ftd2xx is not, that people should see documentation about enabling that? I admitably was first a little confused about getting ftd2xx working, as had followed the instructions for Linux like an idiot.



From: Åke Rehnman [mailto:***@gmail.com]
Sent: November-06-12 4:57 PM
To: 'Colin O'Flynn'; 'Peter Budny'; urjtag-***@lists.sourceforge.net
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I don’t know how I was able to make it so complicated. As it turns out libtool is perfectly able to handle windows libraries exactly the same way it does with regular libraries. Just link with –lftd2xx
 no renaming of libraries are required.



Here is a patch for you. Please try it and report back to the list.



/Ake



Index: configure.ac

===================================================================

--- configure.ac (revision 2035)

+++ configure.ac (working copy)

@@ -295,10 +296,11 @@

case $host in

*cygwin*|*mingw*)

CFLAGS="$CFLAGS -I$with_ftd2xx"

+ FTD2XXLIB="-lftd2xx"

AS_IF([test -d "$with_ftd2xx/i386"], [

- FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx/i386"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

])

;;

*)



From: Åke Rehnman [mailto:***@gmail.com]
Sent: den 6 november 2012 19:52
To: 'Colin O'Flynn'; 'Peter Budny'; 'urjtag-***@lists.sourceforge.net'
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



A very interesting thread about windows import libraries, a bit old but addresses the problem. Unfortunately there’s no solution
.



http://lists.gnu.org/archive/html/libtool/2004-04/msg00050.html



/Ake



From: Colin O'Flynn [mailto:***@newae.com]
Sent: den 6 november 2012 17:27
To: 'Peter Budny'; 'Åke Rehnman'; urjtag-***@lists.sourceforge.net
Subject: RE: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I recently went to build with f2xx, and came across this problem again.



Your “fixes” to the .ac file worked for me as well. I’d like to see this pushed into a real solution somehow though, as I’m sure it will frustrate many more people in the future, any ideas?



From: Peter Budny [mailto:***@unicoi.com]
Sent: October-15-12 9:57 AM
To: 'Åke Rehnman'; urjtag-***@lists.sourceforge.net
Subject: Re: [UrJTAG-dev] Trouble linking with ftd2xx.lib



Åke,



It’s not just you; I encountered this problem over a year ago. It seems that libtool is supposed to automatically determine the dependency on ftd2xx.lib, but doesn’t do so. It generated a dependency file that was basically empty. Unfortunately I don’t know libtool well enough to know how to fix it “correctly”.



I believe if you look in src/.libs/liburjtag.lai (or maybe it was just src/liburjtag.la?), you can see the dependencies that libtool generated. Mine looks like this:



# liburjtag.la - a libtool library file

# Generated by ltmain.sh (GNU libtool) 2.2.6b Debian-2.2.6b-2ubuntu1

#

# Please DO NOT delete this file!

# It is necessary for linking the library.



# The name that we can dlopen(3).

dlname=''



# Names of this library.

library_names=''



# The name of the static archive.

old_library='liburjtag.a'



# Linker flags that can not go in dependency_libs.

inherited_linker_flags=''



# Libraries that this one depends upon.

dependency_libs=''



# Names of additional weak libraries provided by this library

weak_library_names=''



# Version information for liburjtag.

current=0

age=0

revision=0



# Is this an already installed library?

installed=yes



# Should we warn about portability when linking against -modules?

shouldnotlink=no



# Files to dlopen/dlpreopen

dlopen=''

dlpreopen=''



# Directory that this library needs to be installed in:

libdir='/usr/local/lib'



Notice the complete lack of any mention of ftd2xx. (The file src/liburjtag.la only differs in “installed=no”.)
--
~ Peter Budny

Unicoi Systems

***@unicoi.com



From: Åke Rehnman [mailto:***@gmail.com]
Sent: Sunday, October 14, 2012 7:01 AM
To: urjtag-***@lists.sourceforge.net
Subject: [UrJTAG-dev] Trouble linking with ftd2xx.lib



I had trouble linking with FTDI windows library. I finally had to resort to change the configure script, then rename the library to libftd2xx.a to get the linking to complete. It seems like the ftd2xx.lib is completely missing from the link command line.



Any Idea what the problem is?



/Ake



Making all in src/apps/jtag

make[2]: Entering directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

/bin/sh ../../../libtool --tag=CC --mode=link gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/liburjtag.la -lintl -lioperm -lreadline

libtool: link: gcc -std=gnu99 -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith -gstabs+ -O0 -I/cygdrive/c/akre/urjtag/ftdi-cdm-drivers -o jtag.exe jtag.o ../../../src/.libs/liburjtag.a -L/usr/local/lib -L/usr/lib/ncursesw -L/usr/lib /usr/local/lib/libusb-1.0.dll.a /usr/lib/libintl.dll.a /usr/lib/libiconv.dll.a /usr/lib/libioperm.dll.a /usr/lib/libpopt.dll.a -lreadline -L/usr/local/lib -L/usr/local/lib

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_flush':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:124: undefined reference to `***@16'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:160: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_read':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:222: undefined reference to `***@16'

../../../src/.libs/liburjtag.a(libftd2xx.o): In function `usbconn_ftd2xx_connect':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/libftd2xx.c:354: undefined reference to `***@4'

.

. a lot more of these

.

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:502: undefined reference to `***@12'

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:509: undefined reference to `***@4'

../../../src/.libs/liburjtag.a(usbconnft232r.o): In function `usbconn_ft232r_close':

/cygdrive/c/akre/urjtag/urjtag/src/tap/usbconn/usbconnft232r.c:529: undefined reference to `***@4'

collect2: ld returned 1 exit status

Makefile:420: recipe for target `jtag.exe' failed

make[2]: *** [jtag.exe] Error 1

make[2]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag/src/apps/jtag'

Makefile:451: recipe for target `all-recursive' failed

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

make[1]: Leaving directory `/cygdrive/c/akre/urjtag/urjtag'

Makefile:381: recipe for target `all' failed

make: *** [all] Error 2





Changed configure.ac



@@ -294,11 +295,14 @@

HAVELIBFTD2XX=yes

case $host in

*cygwin*|*mingw*)

+#akre

CFLAGS="$CFLAGS -I$with_ftd2xx"

- AS_IF([test -d "$with_ftd2xx/i386"], [

+ LDFLAGS="$LDFLAGS -no-undefined -L$with_ftd2xx"

+ AS_IF([test -d "$with_ftd2xx/i386x"], [

FTD2XXLIB="$with_ftd2xx/i386/ftd2xx.lib"

],[

- FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+# FTD2XXLIB="$with_ftd2xx/ftd2xx.lib"

+ FTD2XXLIB="-lftd2xx $LIBS"

])

;;

*)
Loading...