Re: Linking problem when compiling under MinGW



Torsten Schoenfeld kirjoitti:
On Wed, 2006-10-04 at 17:36 +0300, Ari Jolma wrote:
I'm building Gtk2 under MinGW.
needed.  There's a hack for Win32 at the end of Gtk2's Makefile.PL,
maybe it can be adapted for MinGW.

I've got Glib-1.140, Cairo-1.01, and Gtk2-1.140 compiled with MinGW. I had to do some tricks:

* My win32 gtk stuff is from http://gladewin32.sourceforge.net and the export libs in it has names in the format lib*.dll.a. This seems to be something that Perl does not understand in ExtUtils::Liblist::Kid.pm. I fixed this in Makefile.PLs (Glib, Cairo, and Gtk2) to use the full names, for example replacing -lcairo with -lcairo.dll.a, with a simple split and join piece of code.

* The Makefile, which Makemaker makes for me does not make the export libraries for some reason. I had to add a third(!) $(LD) command to the $(INST_DYNAMIC) section, for example for Glib this is:

$(LD) -o Glib.dll $(LDDLFLAGS) $(LDFROM) -Wl,-out-implib,blib/arch/auto/Glib/libGlib.a $(EXPORT_LIST) $(OTHERLDFLAGS) $(MYEXTLIB) $(PERL_ARCHIVE) $(LDLOADLIBS) dll.exp

The point is to make the libGlib.a. The strange thing is that this makes also a Glib.dll, but it is not usable, the Glib.dll created by the 2nd $(LD) call has to be preserved. I named these lib*.a so I had to change the find_extra_libs hack in Gtk2 Makefile.PL accordingly. I also changed it to add libCairo.a to the LDLOADLIBS.

* The command lines the Makefile of Gtk2 tries to execute are too long. I shortened them by replacing a long list of .o files to xs/*.o.

With these changes the modules compile and work to some extent. The tests fail and hang but for my basic use the modules are ok. I probably need to create a libGtk2.a also for some modules which depend on Gtk2.

Ari

--
Prof. Ari Jolma
Geoinformaatio- ja paikannustekniikka
Geoinformation and positioning technology
Teknillinen Korkeakoulu / Helsinki University of Technology
POBox 1200, 02015 TKK, Finland
Email: ari.jolma at tkk.fi URL: http://www.tkk.fi/~jolma




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