Re: Cannot build static libraries under mingw



On Sun, 2008-11-09 at 21:16 +0400, Alexander Shaduri wrote:
> Hello,
> 
> I'm having trouble building static glibmm with mingw
> cross-compiler (linux build, windows target).
> No problems with shared DLLs so far.
> 
> The configure line is
> ./configure --disable-shared --enable-static --target=i386-mingw32msvc \
> --host=i386-mingw32msvc --build=i686-linux --prefix=/opt/cross-tools
> 
> Make stops with:
> 
> .....
> Making all in giomm_simple
> make[3]: Entering directory `/0S/a11/0build/CROSS/mm-2.14-gcc43/glibmm-2.18.1/tests/giomm_simple'
> /bin/sh ../../libtool --tag=CXX   --mode=link i386-mingw32msvc-g++ -mms-bitfields  -O2 -march=i686 -mtune=generic -mms-bitfields -mms-bitfields -Wall -Wno-long-long   -o test.exe main.o  ../../glib/glibmm/libglibmm-2.4.la ../../gio/giomm/libgiomm-2.4.la -L/opt/cross-tools/i386-mingw32msvc/lib -L/target/lib -lsigc-2.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl
> i386-mingw32msvc-g++ -mms-bitfields -O2 -march=i686 -mtune=generic -mms-bitfields -mms-bitfields -Wall -Wno-long-long -o test.exe main.o  ../../glib/glibmm/.libs/libglibmm-2.4.a -L/opt/cross-tools/i386-mingw32msvc/lib -L/target/lib ../../gio/giomm/.libs/libgiomm-2.4.a -lgio-2.0 /0S/0tmp/0build/CROSS/mm-2.14-gcc43/glibmm-2.18.1/glib/glibmm/.libs/libglibmm-2.4.a /opt/cross-tools/i386-mingw32msvc/lib/libsigc-2.0.a -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lintl
> ../../gio/giomm/.libs/libgiomm-2.4.a(file.o):file.cc:(.text+0x1fbd): undefined reference to `__imp___ZN4Glib10ObjectBaseD2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(file.o):file.cc:(.text+0x2009): undefined reference to `__imp___ZN4Glib10ObjectBaseD2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(file.o):file.cc:(.text+0x20bd): undefined reference to `__imp___ZN4Glib10ObjectBaseD2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(file.o):file.cc:(.text+0x2114): undefined reference to `__imp___ZN4Glib10ObjectBaseD2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(file.o):file.cc:(.text+0x21a1): undefined reference to `__imp___ZN4Glib10ObjectBaseC2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(file.o):file.cc:(.text+0x2206): undefined reference to `__imp___ZN4Glib10ObjectBaseD2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(file.o):file.cc:(.text+0x22d1): undefined reference to `__imp___ZN4Glib10ObjectBaseC2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(file.o):file.cc:(.text+0x233f): undefined reference to `__imp___ZN4Glib10ObjectBaseD2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(file.o):file.cc:(.text+0x2421): undefined reference to `__imp___ZN4Glib10ObjectBaseC2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(file.o):file.cc:(.text+0x2486): undefined reference to `__imp___ZN4Glib10ObjectBaseD2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(file.o):file.cc:(.text$_ZN4Glib19wrap_auto_interfaceIN3Gio4FileEEEPT_P8_GObjectb[Gio::File* Glib::wrap_auto_interface<Gio::File>(_GObject*, bool)]+0x50): undefined reference to `__imp___ZN4Glib10ObjectBase20_get_current_wrapperEP8_GObject'
> ../../gio/giomm/.libs/libgiomm-2.4.a(inputstream.o):inputstream.cc:(.text+0x4ab): undefined reference to `__imp___ZN4Glib6ObjectD2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(inputstream.o):inputstream.cc:(.text+0x530): undefined reference to `__imp___ZN4Glib6ObjectD2Ev'
> 
> ----------------------------------------------------------
> About 70 KB of similar output follows.
> ----------------------------------------------------------
> 
> ../../gio/giomm/.libs/libgiomm-2.4.a(loadableicon.o):loadableicon.cc:(.text+0x5f1): undefined reference to `__imp___ZN4Glib10ObjectBaseC2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(loadableicon.o):loadableicon.cc:(.text+0x656): undefined reference to `__imp___ZN4Glib10ObjectBaseD2Ev'
> ../../gio/giomm/.libs/libgiomm-2.4.a(loadableicon.o):loadableicon.cc:(.text$_ZN4Glib19wrap_auto_interfaceIN3Gio12LoadableIconEEEPT_P8_GObjectb[Gio::LoadableIcon* Glib::wrap_auto_interface<Gio::LoadableIcon>(_GObject*, bool)]+0x50): undefined reference to `__imp___ZN4Glib10ObjectBase20_get_current_wrapperEP8_GObject'
> collect2: ld returned 1 exit status
> make[3]: *** [test.exe] Error 1
> make[3]: Leaving directory `/0S/a11/0build/CROSS/mm-2.14-gcc43/glibmm-2.18.1/tests/giomm_simple'
> 
> 
> I tried building both static and shared libraries together,
> but there seems to be some kind of binary incompatibility
> between them, because while the build succeeded, I got
> similar errors when linking my program against these static libraries.
> Seems to be related to marking functions with dllimport.

I don't think building gtkmm or glibmm as a static library is supported,
and I don't know anybody who had success with this. Is there a specific
reason why you can't simply use shared libraries?

> Thanks,
> Alexander

Armin




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]