Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^5: Editing RPATH of Perl module XML::Parser

by Eliya (Vicar)
on Dec 14, 2011 at 19:22 UTC ( [id://943609]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Editing RPATH of Perl module XML::Parser
in thread Editing RPATH of Perl module XML::Parser

If you want it to take effect for XML::Parser::Expat, you have to put the declaration in ./Expat/Makefile.PL, not ./Makefile.PL.

For example, your ./Expat/Makefile.PL could read:

... WriteMakefile( NAME => 'XML::Parser::Expat', C => ['Expat.c'], LIBS => $libs, XSPROTOARG => '-noprototypes', VERSION_FROM => 'Expat.pm', LDDLFLAGS => $Config{lddlflags}." -Wl,-rpath,$ENV{ORIGIN}/../lib", + # <-- add this @extras );

Sample build session:

$ ORIGIN=/usr/local/foo/bar perl Makefile.PL Writing Makefile for XML::Parser::Expat Writing Makefile for XML::Parser $ make ... rm -f ../blib/arch/auto/XML/Parser/Expat/Expat.so LD_RUN_PATH="/lib" gcc -shared -O2 -L/usr/local/lib -fstack-protecto +r -Wl,-rpath,/usr/local/foo/bar/../lib Expat.o -o ../blib/arch/auto/ +XML/Parser/Expat/Expat.so \ -lexpat \ ... $ readelf -d ./blib/arch/auto/XML/Parser/Expat/Expat.so | grep Lib 0x000000000000000f (RPATH) Library rpath: [/usr/local/fo +o/bar/../lib] 0x000000000000001d (RUNPATH) Library runpath: [/usr/local/ +foo/bar/../lib]

Similarly with the dynamic_lib => { ... } variant:

WriteMakefile( NAME => 'XML::Parser::Expat', C => ['Expat.c'], LIBS => $libs, XSPROTOARG => '-noprototypes', VERSION_FROM => 'Expat.pm', dynamic_lib => { OTHERLDFLAGS => "-Wl,-rpath,$ENV{ORIGIN}/../lib" }, @extras );
$ ORIGIN=/usr/local/foo/bar perl Makefile.PL Writing Makefile for XML::Parser::Expat Writing Makefile for XML::Parser $ make ... rm -f ../blib/arch/auto/XML/Parser/Expat/Expat.so LD_RUN_PATH="/lib" gcc -shared -O2 -L/usr/local/lib -fstack-protecto +r Expat.o -Wl,-rpath,/usr/local/foo/bar/../lib -o ../blib/arch/auto/X +ML/Parser/Expat/Expat.so \ -lexpat \ ... $ readelf -d ./blib/arch/auto/XML/Parser/Expat/Expat.so | grep Lib 0x000000000000000f (RPATH) Library rpath: [/usr/local/fo +o/bar/../lib] 0x000000000000001d (RUNPATH) Library runpath: [/usr/local/ +foo/bar/../lib]

(Note the "-Wl,-rpath,/usr/local/foo/bar/../lib" part in the linking commands above, and its different position.)

Replies are listed 'Best First'.
Re^6: Editing RPATH of Perl module XML::Parser
by virtualdj (Initiate) on Dec 15, 2011 at 17:14 UTC

    Thank you very much! I missed that thing...

Re^6: Editing RPATH of Perl module XML::Parser
by Anonymous Monk on Dec 14, 2011 at 19:29 UTC

    Who's on first?

    Thanks for the chuckle Eliya

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (4)
As of 2024-03-29 06:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found