Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re^2: RFC: Setting up a minGW compiling envronment for Perl 5.10

by Bloodrage (Monk)
on Mar 02, 2008 at 23:39 UTC ( #671552=note: print w/ replies, xml ) Need Help??

in reply to Re: RFC: Setting up a minGW compiling envronment for Perl 5.10
in thread RFC: Setting up a minGW compiling envronment for Perl 5.10

With all the library files renamed with s/.lib$/.a/i the output is now (I now run dmake twice, which reduces the output to just the failed parts), hmm... no -L"G:\GTK\lib", so my GTK libraries are not being handed to the compiler by dmake?
dlltool --def Glib.def --output-exp dll.exp g++ -o blib\arch\auto\Glib\Glib.dll -Wl,--base-file -Wl,dll.base -mdll + -s -L"G:\strawberry\perl\lib\CORE" -L"G:\strawberry\c\lib" Glib.o GE +rror.o GUtils.o GLog.o GType.o GBoxed.o GObject.o GValue.o GClosure.o + GSignal.o GMainLoop.o GIOChannel.o GParamSpec.o GKeyFile.o GBookmark +File.o gperl-gtypes.o -Wl,--image-base,0x69080000 G:\strawberry\perl +\lib\CORE\libperl510.a G:\strawberry\c\lib\libmsvcrt.a G:\strawberry\ +c\lib\libmoldname.a G:\strawberry\c\lib\libkernel32.a G:\strawberry\c +\lib\libuser32.a G:\strawberry\c\lib\libgdi32.a G:\strawberry\c\lib\l +ibwinspool.a G:\strawberry\c\lib\libcomdlg32.a G:\strawberry\c\lib\li +badvapi32.a G:\strawberry\c\lib\libshell32.a G:\strawberry\c\lib\libo +le32.a G:\strawberry\c\lib\liboleaut32.a G:\strawberry\c\lib\libnetap +i32.a G:\strawberry\c\lib\libuuid.a G:\strawberry\c\lib\libws2_32.a G +:\strawberry\c\lib\libmpr.a G:\strawberry\c\lib\libwinmm.a G:\strawbe +rry\c\lib\libversion.a G:\strawberry\c\lib\libodbc32.a G:\strawberry\ +c\lib\libodbccp32.a dll.exp Glib.o:Glib.c:(.text+0x10e): undefined reference to `g_return_if_fail_ +warning' Glib.o:Glib.c:(.text+0x177): undefined reference to `g_filename_from_u +tf8_utf8' Glib.o:Glib.c:(.text+0x1a6): undefined reference to `g_free' Glib.o:Glib.c:(.text+0x213): undefined reference to `g_filename_to_utf +8_utf8' Glib.o:Glib.c:(.text+0x23b): undefined reference to `g_free' Glib.o:Glib.c:(.text+0x338): undefined reference to `g_malloc' # SNIP! cut out another thousand "undefinde reference to" gperl-gtypes.o:gperl-gtypes.c:(.text+0xe2): undefined reference to `g_ +enum_register_static' gperl-gtypes.o:gperl-gtypes.c:(.text+0x112): more undefined references + to `g_enum_register_static' follow collect2: ld returned 1 exit status dmake: Error code 129, while making 'blib\arch\auto\Glib\Glib.dll'

Replies are listed 'Best First'.
Re^3: RFC: Setting up a minGW compiling envronment for Perl 5.10
by Bloodrage (Monk) on Mar 02, 2008 at 23:50 UTC

    Appending -L"G:\GTK\lib" to these lines in the Makefile like so:

    LDDLFLAGS = -mdll -s -L"G:\strawberry\perl\lib\CORE" -L"G:\strawberry\ +c\lib" -L"G:\GTK\lib" LDFLAGS = -s -L"G:\strawberry\perl\lib\CORE" -L"G:\strawberry\c\lib" - +L"G:\GTK\lib"

    Makes no difference to the output from dmake except that these libs are now included :(

      Makes no difference to the output from dmake except that these libs are now included

      Well ... all that you have done is to provide the *location* of those libs. Apparently, therefore, the build process is not even trying to find those libs - and you'll have to tell it to do that with -lglib (assuming the glib library is named glib.a or libglib.a). There are probably other libraries that need to be explicitly linked in, too - but start by just trying to get those glib undefined references fixed. That should (at least) greatly reduce the number of undefined references that you get.


        Ok, the library in question is G:\GTK\lib\glib-2.0.a so I assume that somewhere I've got to hand -lglib-2.0 over to the Makefile, dmake, or the compiler.

        Looking at the header of the Makefile shows me that indeed CPAN informed Makefile.PL and MakeMaker what's going on, but the Makefile.PL may not have done anything useful with it. Joy.

        # MakeMaker Parameters: # ABSTRACT_FROM => q[] # DL_FUNCS => { Glib=>[] } # SNIP! # INC => q[-IG:/GTK/include/glib-2.0 -IG:/GTK/lib/glib-2.0/include + -I.] # LIBS => q[-LG:/GTK/lib -lgobject-2.0 -lglib-2.0 -lintl -liconv - +lgthread-2.0] # SNIP! # --- MakeMaker post_initialize section:

        ...but -lglib-2.0 isn't found again in the Makefile.

        At the bottom of the Makefile is the EXTRALIBS and LDLOADLIBS, so I appended G:\GTK\lib\glib-2.0.a to those strings.

        Success! To a degree. the "undefined reference" errors have reduced from around a thousand to ~300. Now to figure out which other libs are needed. Hmm... those one's listed in the Makefile header snippet above look like prime suspects... especially the ones beginning with 'g'...

        Adding those changes my error log to:

        um... which looks successful...

        The conclusion from this is that:

        • My compile environment is complete.
        • The standard makefiles need help
        • syphilis is godlike
        • ...and I am his profit

        PS: That I've never seriously jiggered about a Makefile before and that I inferred that this is what I should do from syphilis' comment is just more evidence that I'm fucking psychic :P

        PPS: Putting your compiler-onna-stick in a different computer and having it assigned a different drive letter breaks your nicely fixed up files. Bother.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://671552]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (3)
As of 2016-07-01 21:20 GMT
Find Nodes?
    Voting Booth?
    What is your favorite alternate name for a (specific) keyboard key?

    Results (17 votes). Check out past polls.