Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Help with compiling glib

by frazap (Monk)
on Jun 22, 2016 at 10:28 UTC ( [id://1166233]=perlquestion: print w/replies, xml ) Need Help??

frazap has asked for the wisdom of the Perl Monks concerning the following question:

I have copied the *.dll.a files on *.a files in my c:/prog/gtk+/lib folder and in the sub folders.

I run
perl Makefile.pl INC="-IC:\prog\gtk+\include\glib-2.0 -IC:\prog\Gtk+\l +ib\glib-2.0\include" LIBS="-LC:/prog/gtk+/lib"
dmake fails with
"C:\strawberry\perl\bin\perl.exe" -MExtUtils::Command::MM -e cp_nonemp +ty -- Glib.bs blib\arch\auto\Glib\Glib.bs 644 [ LD blib\arch\auto\Glib\Glib.xs.dll ] Glib.o:Glib.c:(.text+0x85): undefined reference to `g_filename_display +_basename' Glib.o:Glib.c:(.text+0xb6): undefined reference to `g_free' Glib.o:Glib.c:(.text+0x195): undefined reference to `g_filename_displa +y_name' ...

Thanks for any suggestion !

François

Replies are listed 'Best First'.
Re: Help with compiling glib
by syphilis (Archbishop) on Jun 22, 2016 at 11:52 UTC
    These symbols are resolved (for me) by libglib-2.0.a (or libglib-2.0.dll.a).

    Your problem is that you specified (in your 'perl Makefile.PL command):
    LIBS="-LC:/prog/gtk+/lib"
    but that needs to be:
    LIBS="-LC:/prog/gtk+/lib -lglib-2.0"
    That should fix the undefined references that you've reported, but you might find there are then other undefined references (because I think you might need to link to other import libraries besides -lglib-2.0).

    If it's just a matter of installing Gtk2 on Strawberry Perl then the following should work:
    UPDATE: Adding --force (which I initially forgot about)
    ppm install http://www.sisyphusion.tk/ppm/Cairo.ppd --force ppm install http://www.sisyphusion.tk/ppm/Glib.ppd --force ppm install http://www.sisyphusion.tk/ppm/Pango.ppd --force ppm install http://www.sisyphusion.tk/ppm/Gtk2.ppd --force
    And if you then want Gtk2::GladeXML:
    ppm install http://www.sisyphusion.tk/ppm/Gtk2-GladeXML.ppd --force
    But, of course, if you're actually wanting to build those modules yourself, then the ppm packages don't really help you do that ;-)

    Cheers,
    Rob
      Hi Rob,

      Thanks for the links. I hoped to get a better understanding (?) in trying to compile this stuff myself... I thought that the copying trick (*.dell.a -> *.a) removed the need to gives the -lxxx in the LIBS parameter. That's not the case obviously.

      And what is the :nosearch added to the beginning of the LIBS parameter doing ? Is it this that can be used in place of the files copy ?

      Best François
        I hoped to get a better understanding (?) in trying to compile this stuff myself...

        Yes, that's the way to learn - though picking something as large as glib is just as likely to lead to "utter confusion" as to "understanding" ;-)
        (At least I sure am glad I didn't try to learn what I know by building glib.)

        I thought that the copying trick (*.dell.a -> *.a) removed the need to gives the -lxxx in the LIBS parameter

        No, no - you always need to give the -lxxx argument. But if you provide the -lxxx argument && the 'perl Makefile.PL' step emits the warning that no library was found for -lxxx && you know that libxxx.dll.a was in the library search path THEN you need to copy libxxx.dll.a to libxxx.a (because your version of ExtUtils::MakeMaker was obviously too stupid to equate -lxxx with libxxx.dll.a but will be quite capable of equating -lxxx with libxxx.a).

        And what is the :nosearch added to the beginning of the LIBS parameter doing ?

        Where in this thread is ":nosearch" mentioned ?
        Ok ... there are already 2 occurrences of the term in this post of mine, and I can see it in your previous post (to which I'm replying) but I can't see it anywhere else and I therefore don't see the relevance of the question.

        I reckon I've seen ":nosearch" in other places, but I don't know what it means and it's not something I've had to bother about in the past. Google can probably provide an explanation.

        Cheers,
        Rob
Re: Help with compiling glib
by Corion (Patriarch) on Jun 22, 2016 at 10:32 UTC

    Can you show us the actual line that dmake will run? It should start either with gcc or with ldd.

    My first step would be to look at what the Makefile written by Makefile.PL actually contains as the directories for LIBS and INC.

      Extralibs + Ldloadlibs are:
      EXTRALIBS = "C:\STRAWB~1\c\i686-w64-mingw32\lib\libmoldname.a" "C:\STR +AWB~1\c\i686-w64-mingw32 \lib\libkernel32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libuser32.a" " +C:\STRAWB~1\c\i686-w64-mingw32\lib\libgdi32.a" "C:\STRAWB~1\c\i686-w6 +4-mingw32\lib\libwinspool.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libc +omdlg32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libadvapi32.a" "C:\STR +AWB~1\c\i686-w64-mingw32\lib\libshell32.a" "C:\STRAWB~1\c\i686-w64-mi +ngw32\lib\libole32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\liboleaut32 +.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libnetapi32.a" "C:\STRAWB~1\c +\i686-w64-mingw32\lib\libuuid.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\ +libws2_32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libmpr.a" "C:\STRAWB +~1\c\i686-w64-mingw32\lib\libwinmm.a" "C:\STRAWB~1\c\i686-w64-mingw32 +\lib\libversion.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libodbc32.a" " +C:\STRAWB~1\c\i686-w64-mingw32\lib\libodbccp32.a" "C:\STRAWB~1\c\i686 +-w64-mingw32\lib\libcomctl32.a" LDLOADLIBS = "C:\STRAWB~1\c\i686-w64-mingw32\lib\libmoldname.a" "C:\ST +RAWB~1\c\i686-w64-mingw32\lib\libkernel32.a" "C:\STRAWB~1\c\i686-w64- +mingw32\lib\libuser32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libgdi32 +.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libwinspool.a" "C:\STRAWB~1\c +\i686-w64-mingw32\lib\libcomdlg32.a" "C:\STRAWB~1\c\i686-w64-mingw32\ +lib\libadvapi32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libshell32.a" +"C:\STRAWB~1\c\i686-w64-mingw32\lib\libole32.a" "C:\STRAWB~1\c\i686-w +64-mingw32\lib\liboleaut32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\lib +netapi32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libuuid.a" "C:\STRAWB +~1\c\i686-w64-mingw32\lib\libws2_32.a" "C:\STRAWB~1\c\i686-w64-mingw3 +2\lib\libmpr.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libwinmm.a" "C:\S +TRAWB~1\c\i686-w64-mingw32\lib\libversion.a" "C:\STRAWB~1\c\i686-w64- +mingw32\lib\libodbc32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libodbcc +p32.a" "C:\STRAWB~1\c\i686-w64-mingw32\lib\libcomctl32.a" BSLOADLIBS =

        To find out which line in your run of your Makefile blows up, scroll back up in your terminal history until you find the last (and likely unsuccessful) line invoking gcc or ldd.

        I will not follow random links to random websites linking to random archives containing maybe a random Makefile. The important thing is how it behaves in your environment, which is something only you can provide.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1166233]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (5)
As of 2024-04-19 04:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found