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

I am adding a module XML::Parser statically in my Perl which I build from its source. To build Parser statically I removed DynaLoader and bootstrap from Parser.pm and Expat.pm files.

I have included LINKTYPE => 'static' in Makefile.PL. It builds successfully. But when i am trying to use this module after build its throwing error as "Undefined subroutine &XML::Parser::Expat::ParserCreate called at C:/Perl/lib/XML/Parser/Expat.pm line 66."

I have linked Expat.lib to my tool and included it as newXS("XML::Parser::Expat::bootstrap", boot_XML__Parser__Expat, file)

What goes wrong after building the module statically. I tested using 'nmake test_static' which fails but 'nmake test_dynamic' passes without any error.

  • Comment on Statically build XML Parser embedded in Perl

Replies are listed 'Best First'.
Re: Statically build XML Parser embedded in Perl
by choroba (Cardinal) on Nov 27, 2014 at 17:10 UTC
    Crossposted on StackOverflow. It's considered polite to inform about crossposting so people not attending both sites don't waste their efforts hacking a problem already solved at the other end of the Internet.
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ
Re: Statically build XML Parser embedded in Perl
by syphilis (Archbishop) on Nov 28, 2014 at 01:24 UTC
    I have included LINKTYPE => 'static' in Makefile.PL

    Did you do that for *both* of the Makefile.PL files - ie the one in the Expat folder as well ?
    Like Anonymous Monk, I'm thinking that this approach might have serious problems, but I've absolutely no experience to back up that expectation ... and I notice that the error is in relation to an XML::Parser::Expat function, not XML::Parser.

    AFTERTHOUGHT: looks like XML::Parser itself might be pure perl, which might make the LINKTYPE setting relevant only for the Expat/Makefile.PL ... which, I'm now guessing, you've already done.

    Cheers,
    Rob
Re: Statically build XML Parser embedded in Perl
by Anonymous Monk on Nov 27, 2014 at 21:35 UTC
Re: Statically build XML Parser embedded in Perl
by Jenda (Abbot) on Nov 28, 2014 at 11:52 UTC

    Erm ... why?

    What is the greater problem you want to solve and why do you think perl statically linked with XML::Parser is the solution?

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.