autoconf libtool library linker path incorrect (need drive-letter) for MinGW ld.exe in Cygwin

Posted by Tam Toucan on Stack Overflow See other posts from Stack Overflow or by Tam Toucan
Published on 2010-03-20T23:12:11Z Indexed on 2010/03/20 23:21 UTC
Read the original article Hit count: 416

Filed under:
|
|
|

I use autoconf and when the target is mingw I was using the -mno-cygwin flag. This has been removed so I'm trying to using the mingw tool chain. The problem is the linker isn't finding my libraries

/bin/sh ../../../libtool --tag=CXX   --mode=link mingw32-g++  -g -Wall -pedantic -DNOMINMAX -D_REENTRANT -DWIN32 -I /usr/local/include/w32api  -L/usr/local/lib/w32api -o testRandom.exe testRandom.o -L../../../lib/Random -lRandom
libtool: link: mingw32-g++ -g -Wall -pedantic -DNOMINMAX -D_REENTRANT -DWIN32 -I /usr/local/include/w32api -o .libs/testRandom.exe testRandom.o  -L/usr/local/lib/w32api -L/home/Tam/src/3DS_Games/lib/Random -lRandom
D:\cygwin\opt\MinGW\bin\..\lib\gcc\mingw32\3.4.5\..\..\..\..\mingw32\bin\ld.exe: cannot find -lRandom

To link this from the command line using the mingw linker the -L path needs the drive letter i.e

mingw32-ld testRandom.o -LD:/home/Tam/src/3DS_Games/lib/Random -lRandom

works. The -L path is generated from the makefile.am's which have

LDADD = -L$(top_builddir)/lib/Random -lRandom

However I can't find how to set top_builddir to a relative path or to start it with the drive letter (my autoconf skills are weak).

As a tempoary "solution" I have removed the use of libtool. I could hack a $(DRIVE_LETTER) infront of every -L option, but I'd like to find something better.

© Stack Overflow or respective owner

Related posts about libtool

Related posts about mingw