Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by syphilis (Canon)
on Mar 15, 2008 at 09:14 UTC ( #674345=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

I'm on the gtk-perl mailing list and the developers have acknowledged that the tests *will* fail under Windows

IIRC a number of the tests fail with errors along the lines of (eg, from gdk.t) Can't locate object method "get_xid" via package "Gtk2::Gdk::Window" at t/gdk.t line 108. Is that *really* a Windows-only error ?

I also think that having pkg-config and glib be mutually dependent (but separate) is bad software design ... though really brilliant April Fool's Day prank design. And I feel the same away about the need for Gtk2 to link to the auto/Cairo/Cairo.dll and auto/Glib/Glib.dll.

I have a question for you. I found I was able to link directly to either auto/Cairo/Cairo.dll or auto/Glib/Glib.dll ... but not both. Do you know why that is ? Presumably, it's a perl quirk/bug, since, if I build a C application using MinGW's gcc, I can link directly to as many dll's as is needed. But with the perl dll's, it seems that *one* is the limit.

I even went to the trouble of building a Foo module and a FooBar module - where FooBar had to link directly to the Foo.dll. And that worked fine. I then built a Bar module, and changed FooBar so that it needed to link directly to both Foo.dll and Bar.dll. It couldn't do that - I could get it to link to one or the other, but not both. So I created import libs (which I think is what you have done, too) and linking to them worked fine. I still don't see why linking to *more than one* dll should fail.

Cheers,
Rob


Comment on Re^2: RFC: Setting up a minGW compiling envronment for Perl 5.10
Download Code
Re^3: RFC: Setting up a minGW compiling envronment for Perl 5.10
by BrowserUk (Pope) on Mar 15, 2008 at 12:18 UTC
      Try adding the ld option -export-all-symbols

      As regards my simplistic test case where I have Foo, Bar, and FooBar modules (and where FooBar needs to link to Foo.dll and Bar.dll), both Foo.dll and Bar.dll already export the symbols ('foo' and 'bar', respectively) that FooBar needs to link to.

      Having installed Foo and Bar into C:/temp/perl, I can try to build FooBar in the following way:

      1)Run 'perl Makefile.PL';
      2) Open the generated Makefile and, to the LDLOADLIBS entry, append -LC:/temp/perl/lib/auto/Bar -lBar -LC:/temp/perl/lib/auto/Foo -lFoo;

      Running dmake then terminates with:
      FooBar.o:FooBar.c:(.text+0x1d): undefined reference to `foo' collect2: ld returned 1 exit status dmake: Error code 129, while making 'blib\arch\auto\FooBar\FooBar.dll +'
      If, in step 2) I instead reverse the order and append -LC:/temp/perl/lib/auto/Foo -lFoo -LC:/temp/perl/lib/auto/Bar -lBar to the LDLOADLIBS entry in the generated Makefile, then dmake terminates with:
      FooBar.o:FooBar.c:(.text+0x2b): undefined reference to `bar' collect2: ld returned 1 exit status dmake: Error code 129, while making 'blib\arch\auto\FooBar\FooBar.dll +'
      If I don't do *anything* to the generated Makefile, dmake terminates with:
      FooBar.o:FooBar.c:(.text+0x1d): undefined reference to `foo' FooBar.o:FooBar.c:(.text+0x2b): undefined reference to `bar' collect2: ld returned 1 exit status dmake: Error code 129, while making 'blib\arch\auto\FooBar\FooBar.dll +'
      I suspect that your suggestion of adding -export-all-symbols relates to the situation where Foo.dll and Bar.dll don't already export their symbols. In my case, both Foo.dll and Bar.dll already export their symbols, so I don't see that -export-all-symbols has anything to offer. (I know I don't have to ask you to correct me if I've missed the point :-)

      (This goes back to this thread - where, as you probably recall, you provided excellent help.)

      Hidden in readmore tags, below my sig, is the source to all three (Foo, Bar and FooBar) extensions ... for any who feel driven to test things out. It amazes me that Gtk2 resorts to this sort of thing ... I'm sure there are reasons for doing that ... as to whether they are *good* reasons ....

      Cheers,
      Rob

        It was after our discussion about ld linking directly against .dlls thatI went and browsed a few pages that google threw up, and I remember reading something about the export-all-symbols flag. It said something about it being enabled by default but disabled under certain conditions.

        When I saw your post and managed to locate a reference to the flag, to check the spelling, but not the page a read about the disabling of the default or the conditions, something to do with .def files. I don't have/use MinGW to try it out.

        I'll do another google and try to locate the discussion I saw before.

        Update: I found this page which discusses the stuff about that switch. I'm not sure if it is the same page I read before, but it rings bells. I'm also not able to determine in the abstract if it will have any affect on your example problem?


        Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
        "Science is about questioning the status quo. Questioning authority".
        In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2014-10-21 00:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (94 votes), past polls