I have tracked down one of the strange link error that I
am getting from libtool. It is caused by what (IMHO) seems
to be a bug in libtool, -l arguments are silently removed
from the link line is the libtool script can not locate
the library file. Here is an example of the problem I am
seeing.
/bin/sh ../libtool --mode=link i386-mingw32msvc-gcc -DBUILD_TkGS
-I/home/mo/project/tk/win -I/home/mo/project/tk/xlib -DUSE_TCL_STUBS
-I/home/mo/project/tcl/generic -I/home/mo/project/tk/generic -I/home/
mo/project/tkgs/src -I/home/mo/project/tkgs/src/generic -g -O2
-o libtkgs.la -rpath /tmp/tkgs_Xmingw/lib -no-undefined -avoid-version
-L/home/mo/project/build/tcl_Xmingw -ltclstub84d
-L/home/mo/project/build/tk_Xmingw -ltkstub84d
-lgdi32 tkgs.lo tkgsColor.lo tkgsDrawable.lo tkgsFont.lo tkgsInit.lo
tkgsObj.lo tkgsWinInit.lo drivers/ps/libtkgs_ps.la
drivers/canvas/libtkgs_canvas.la drivers/win32/libtkgs_win32.la
There is quite a lot there, but focus on the -lgdi32 argument. It
is passed into the libtool script, but it does not seem to
make it into the .dll link step:
make
...
*** Warning: This library needs some functionality provided by -lgdi32.
*** 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.
*** 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.
generating symbol list for `libtkgs.la'
...
i386-mingw32msvc-gcc -Wl,--base-file,.libs/libtkgs.dll-base
-Wl,-e,_DllMainCRTStartup@12 -o .libs/libtkgs.dll .libs/tkgs.o
.libs/tkgsColor.o .libs/tkgsDrawable.o .libs/tkgsFont.o .libs/tkgsInit.o
.libs/tkgsObj.o .libs/tkgsWinInit.o -L/home/mo/project/build/tcl_Xmingw
-ltclstub84d -L/home/mo/project/build/tk_Xmingw -ltkstub84d
drivers/ps/.libs/libtkgs_ps.a drivers/canvas/.libs/libtkgs_canvas.a
drivers/win32/.libs/libtkgs_win32.a
/usr/local/project/install/Xmingwin/bin/../lib/gcc-lib/i386-mingw32msvc/2.95.2/../../../../i386-mingw3
2msvc/bin/ld: warning: cannot find entry symbol _DllMainCRTStartup@12;
defaulting to 00401000
drivers/win32/.libs/libtkgs_win32.a(tkgsWin.o.b): In function
`FreeWinDrawableIntRep':
/home/mo/project/tkgs/src/drivers/win32/tkgsWin.c:106: undefined
reference to `DeleteObject@4'
/home/mo/project/tkgs/src/drivers/win32/tkgsWin.c:109: undefined
reference to `DeleteObject@4'
drivers/win32/.libs/libtkgs_win32.a(tkgsWin.o.b): In function
`WinTkGS_GetPenFromDrawable':
/home/mo/project/tkgs/src/drivers/win32/tkgsWin.c:137: undefined
reference to `CreatePen@12'
Note how the-lgdi32 argument never makes it into the link line for the
.dll. This
seems to be related to the warning about dlopening. I am not sure why libtool
would this it would be ok to drop this -l argument from the link line. It
seem
like the libtool script just could not find the location of my gdi32 library:
/home/mo/project/install/Xmingwin/i386-mingw32msvc/lib/libgdi32.a
Does anyone have any idea what is going on here? I guess I could
pass -L/home/mo/project/install/Xmingwin/i386-mingw32msvc/lib in
but that seems really lame because the compiler should be doing
this for me. Libtool is just not letting the compiler do its
job because it does not pass the -l argument.
Mo DeJong
Red Hat Inc