Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

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

by syphilis (Canon)
on Mar 02, 2008 at 11:23 UTC ( #671483=note: print w/ replies, xml ) Need Help??


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

..this issue is avoided in this case by using Strawberry Perl, which presumably comes with the very same compiler that was used to compile Strawberry Perl (gcc in the form of minGW)

That is correct ... but just to confuse you, you should be able to use the very same compiler (and the very same dmake) with recent ActiveState builds of perl.

Also... is there a compiler flag that redirects the output to a log file

I use:

perl Makefile.PL >p.txt 2>&1 dmake >d.txt 2>&1 dmake test >t.txt 2>&1 dmake install >i.txt 2>&1
Then check the relevant file (ie p.txt, d.txt, t.txt, or i.txt) to get the output.

I haven't tried to build GTK2 (nor do I presently intend to), but your "precompiled Gtk2 and Glib, binaries and libraries as provided by the Sourceforge Project" should be usable with your MinGW (though you might need to additionally link to some of the MinGW libs - eg libgcc.a ... error messages would be handy). You shouldn't need "the include and lib directories from the Windows Platform SDK" - and I would suggest making them invisible (to begin with, anyway). Usually, a lot of the problems with these modules is that the authors feel obliged to try to guess where the external libraries are located. It's a regrettable state of affairs ... often a result of a misguided attempt to get the module to build via the automated CPAN.pm build procedure. Anyway ... let's start by looking at your 'dmake' output. What is it ?

Cheers,
Rob


Comment on Re: RFC: Setting up a minGW compiling envronment for Perl 5.10
Download Code
Re^2: RFC: Setting up a minGW compiling envronment for Perl 5.10
by Bloodrage (Monk) on Mar 02, 2008 at 20:37 UTC

    First I'll quickly cover generating my Makefile. When I do exactly as you instructed I get this output for generating my Makefile:

    ...but when I use CPAN to generate the makefile, which explicitly passes a more complete set of include and lib paths to Makefile.PL (because of the program I've mentioned earlier) I get this output:

    Which has none of the "No library found" warnings. So I'll continue with the CPAN generated Makefile.

Re^2: RFC: Setting up a minGW compiling envronment for Perl 5.10
by Bloodrage (Monk) on Mar 02, 2008 at 20:47 UTC

    I'm making Glib first as I suspect that Gtk may be dependent on it. Following your instructions here is the rather copious output from dmake >d.txt 2>&1:

      undefined reference to ....

      Looks like the glib libraries are not being found. If you're using Strawberry Perl, and libraries that were built with Visual Studio, then you probably need to change the '.lib' extensions to '.a'.

      Cheers,
      Rob

        Fantastic. I did not know to do this. A quick little script:

        ...and that's done.

        Update The code now handles files ending in .dll.lib and renames them to .a as well...(and files that have been misnamed .dll.a, oh and properly escapes the .)

Re^2: RFC: Setting up a minGW compiling envronment for Perl 5.10
by Bloodrage (Monk) on Mar 02, 2008 at 23:39 UTC
    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?

      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.

        Cheers,
        Rob
Re^2: RFC: Setting up a minGW compiling envronment for Perl 5.10
by Bloodrage (Monk) on Mar 03, 2008 at 07:25 UTC

    A Quick recap for those who can't be bothered drilling down through the reply tree to it's darkest depths. We have successfully compiled Glib by first renaming all the library files s/.lib/.a/i (here's a program), then appending the Glib libraries to EXTRALIBS and LDLOADLIBS in the Makefile. This is dispite Makefile.PL being given this information by CPAN and MakeMaker.

    Hence for any required Glib|Gtk library file, $ENV{'GTK_BASEPATH'}.'\lib\'.$lib_file has to be appended to the end of LDLOADLIBS in the Makefile.

      perl -V:lib_ext

        Which results in the output lib_ext='.a'; which we knew all along. Do you have a suggestion for adding '.lib', '.Lib', and '.LIB' to this setting? These are common variants in library distributions.

Re^2: RFC: Setting up a minGW compiling envronment for Perl 5.10
by Bloodrage (Monk) on Mar 03, 2008 at 08:04 UTC

    Righty, after repeating the key steps, to make sure it's repeatable, not at all because when you change your compiler-onna-stick to a new machine with a new drive letter, your hand-crafted Makefile is now broken...

    The next step; dmake test >t.txt 2>&1:

    deee deed dah dee... this takes a while

    Hmm, gets to test 9 and just hangs. (and only fails 6/12 of the 64-bit tests). I'll post this so far and see if it finishes.

    A quick look at 9.t makes me suspect that test 9 is for the timeout and thread yielding handling stuff. If I delete it all the other tests succeed except some in 64-bit.t and filename.t

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (11)
As of 2014-12-27 09:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (176 votes), past polls