Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.85k stars 523 forks source link

MM_Unix.pm LD_RUN_PATH nonsense on Solaris #2461

Closed p5pRT closed 20 years ago

p5pRT commented 23 years ago

Migrated from rt.perl.org#3891 (status was 'resolved')

Searchable as RT3891$

p5pRT commented 23 years ago

From @AlanBurlison

There are a few warts in MM_Unix.pm under both 5.6.0 and 5.7.0 related to linking on Solaris. Firstly\, the file contains the following snippet (and another very similar to it)​:

  # Brain dead solaris linker does not use LD_RUN_PATH?   # This fixes dynamic extensions which need shared libs   my $ldrun = '';   $ldrun = join ' '\, map "-R$_"\, split /​:/\, $self->{LD_RUN_PATH}   if ($^O eq 'solaris');

This is incorrect. The Solaris linker *does* use LD_RUN_PATH\, but the preferred mechanism is to use the -R linker flag. From the ld manpage​:

  -R path   A colon-separated list of directories used to specify   library search directories to the runtime linker. If   present and not NULL\, it is recorded in the output   object file and passed to the runtime linker. Multi-   ple instances of this option are concatenated together   with each path separated by a colon. ...

  LD_RUN_PATH   An alternative mechanism for specifying a runpath to   the link-editor (see -R option). If both LD_RUN_PATH   and the -R option are specified\, -R supersedes.

Brain dead programmer did not read manpage? ;-)

So if the -R flag is specified\, the LD_RUN_PATH is redundant. Also\, in the normal case LD_RUN_PATH and -R are set to "/lib"\, which is unnecessary\, and is liable to intefere with the operation of crle(1)​:

NAME   crle - configure runtime linking environment

SYNOPSIS   crle [ -64 ] [ -a name ] [ -c conf ] [ -f flags ] [   -i name ] [ -I name ] [ -g name ] [ -G name ] [ -l dir ]   [ -o dir ] [ -s dir ] [ -t [ ELF | AOUT ] ] [ -v ]

DESCRIPTION   The crle utility provides for the creation and display of a   runtime linking configuration file. Without any arguments\,   or with just the -c option\, crle displays the contents of   the configuration file. When used with any other options\, a   new configuration file is created. The configuration file is   read and interpreted by the runtime linker ld.so.1(1)\, dur-   ing process start-up and may contain the following informa-   tion​:

  Default Search Paths   The runtime linker uses a prescribed search path for   locating the dynamic dependencies of an object. This   search path starts with the components of any   LD_LIBRARY_PATH definition\, followed by the components   of an object's runpath and finally any defaults   specific to the object's type. This last component of   the search path can be expressed within the configura-   tion file. Note​: typical use of this facility should   augment any system defaults; see the -l and -s   options.

Alan Burlison

I suggest that on Solaris the correct fix is to remove all mention of -R and LD_RUN_PATH. Comments?