Operating System - HP-UX
1833877 Members
1654 Online
110063 Solutions
New Discussion

Re: Perl with shared libperl.sl

 
SOLVED
Go to solution
marko asplund
Frequent Advisor

Perl with shared libperl.sl

i'm trying to build a Perl v5.005_03
binary with a shared libperl.sl on
HP-UX 11.00. building and installing
goes fine but the installed Perl binary is linked against the libperl.sl
located in the build and not the installation directory.

chatr /opt/local/perl/perl-5.005_03-a6/bin/perl | grep libperl

says

static /home/foo/tmp/perl/perl5.005_03/libperl.sl

when i delete the build directory and try to execute Perl i get the following error message:

/usr/lib/dld.sl: Can't open shared library: /home/aspa/tmp/perl/perl5.005_03/libperl.sl
/usr/lib/dld.sl: No such file or directory
Abort (core dumped)

Perl has been linked against the following libraries: -lpthread -lcl -lm. these seem to be required when using DBI & DBD::Oracle.

how do i correctly build a Perl binary with a shared libperl.sl on HP-UX?
7 REPLIES 7
Steven Gillard_2
Honored Contributor

Re: Perl with shared libperl.sl

Try the following sequence of commands:

1. Either add the libperl library path to the SHLIB_PATH environment variable, or alternatively you can re-link the executable specifying the +b option to ld to include the appropriate run-time path to search.

2. Enable the library for runtime path lookup:

$ chatr -l

3. Make sure the run-time path lookup options are enabled:

$ chatr +s enable +b enable

Hope this helps!

Regards,
Steve
Steve Steel
Honored Contributor

Re: Perl with shared libperl.sl

Hi


look at

http://pxr.perl.org/source/INSTALL

947
948 You can often recognize failures to build/use a shared libperl from error
949 messages complaining about a missing libperl.so (or libperl.sl in HP-UX),
950 for example:
951 18126:./miniperl: /sbin/loader: Fatal Error: cannot map libperl.so
952


Steve Steel
If you want truly to understand something, try to change it. (Kurt Lewin)
marko asplund
Frequent Advisor

Re: Perl with shared libperl.sl

thanks for your answers. i recompiled Perl (without the embedded path list) and tried adding the library path to SHLIB_PATH. i enabled SHLIB_PATH lookups with

chatr +s enable /opt/local/perl/perl-5.005_03-d1/bin/perl

and set SHLIB_PATH to /opt/local/perl/perl-5.005_03-d1/lib/5.00503/PA-RISC2.0/CORE

chatr says:

shared executable
shared library dynamic path search:
SHLIB_PATH enabled second
embedded path disabled first Not Defined
shared library list:
static /home/aspa/tmp/perl/perl5.005_03-d1/libperl.sl

but perl still won't start:

/usr/lib/dld.sl: Can't open shared library: /home/aspa/tmp/perl/perl5.005_03-d1/libperl.sl
/usr/lib/dld.sl: No such file or directory
Abort (core dumped)
Steven Gillard_2
Honored Contributor

Re: Perl with shared libperl.sl

The problem is the libperl library has not been enabled for runtime path lookup in the executable. I can see this because chatr lists it as "static" - it should be "dynamic". This occurs when the library is linked with -l: instead of just -l.

As per my earlier post, run the following command to fix this:

$ chatr -l

Regards,
Steve
marko asplund
Frequent Advisor

Re: Perl with shared libperl.sl

ok, now it works, thanks! my problem was that i specified the library path in the installation directory though it should have been in the build directory.

is there a way of "hard coding" the libperl.sl search path (in installation directory) to the perl executable without recompiling so that the SHLIB_PATH won't have to be set for every process which uses perl?
Steven Gillard_2
Honored Contributor
Solution

Re: Perl with shared libperl.sl

Not without relinking (that I know of, anyway). If you link with the +b option that will include the path in the runtime search list so you won't have to set SHLIB_PATH.

Regards,
Steve
marko asplund
Frequent Advisor

Re: Perl with shared libperl.sl

i added:

-Dldflags='-Wl,+b,/opt/local/perl/perl-5.005_03-d5/lib/5.00503/PA-RISC2.0/CORE::'

to the Perl configuration command line and rebuilt perl with a shared libperl.sl. after installation i ran:

chatr -l /home/aspa/tmp/perl/perl5.005_03-d5/libperl.sl /opt/local/
perl/perl-5.005_03-d5/bin/perl

and now perl runs without setting the SHLIB_PATH variable. thanks for the help.