Bug 59186 - perl 5.8.2 portupgrade install error
Summary: perl 5.8.2 portupgrade install error
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Anton Berezin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-11 19:00 UTC by Shobaki sam.
Modified: 2003-11-12 08:22 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Shobaki sam. 2003-11-11 19:00:39 UTC
	when trying to compile perl 5.8.2 form ports, those errors occurs:

	------------------------------------------------------------------
	[...]
	Couldn't link /usr/local/bin/perl5.8.2 to /usr/local/bin/perl: No such file or directory 
  	/usr/local/bin/perl
	Couldn't copy /usr/local/bin/perl5.8.2 to /usr/local/bin/perl: No such file or directory
	[...]
	/usr/local/man/man1/s2p.1
	/usr/libexec/elf/strip: /usr/local/bin/perl: No such file or directory
	*** Error code 1

	Stop in /usr/ports/lang/perl5.8.
	*** Error code 1

	Stop in /usr/ports/lang/perl5.8.
	** Command failed [exit code 1]: /usr/bin/script -qa /tmp/portupgrade13052.0 make reinstall
	egrep: /var/db/pkg/perl-5.8.1_2/+CONTENTS: No such file or directory
	--->  Restoring the old version
	[...]
	** Fix the installation problem and try again.
	[Updating the pkgdb <format:bdb1_btree> in /var/db/pkg ... - 201 packages found 
	(-0 +1) . done]
	** The following packages were not installed or upgraded (*:skipped / !:failed)
        	! lang/perl5.8 (perl-5.8.1_2)   (install error)
	------------------------------------------------------------------

Fix: 

no known.
How-To-Repeat: 	
	Do perl upgrade : portupgrade perl-5.8.1_2
Comment 1 Anton Berezin freebsd_committer freebsd_triage 2003-11-11 19:09:55 UTC
Responsible Changed
From-To: freebsd-ports-bugs->tobez

Working with the originator on this one.
Comment 2 Anton Berezin freebsd_committer freebsd_triage 2003-11-11 20:46:31 UTC
On Tue, Nov 11, 2003 at 07:49:25PM +0100, Shobaki sam. wrote:

> 	when trying to compile perl 5.8.2 form ports, those errors occurs:
> 
> 	------------------------------------------------------------------
> 	[...]
> 	Couldn't link /usr/local/bin/perl5.8.2 to /usr/local/bin/perl: No such file or directory 
>   	/usr/local/bin/perl
> 	Couldn't copy /usr/local/bin/perl5.8.2 to /usr/local/bin/perl: No such file or directory
> 	[...]
> 	/usr/local/man/man1/s2p.1
> 	/usr/libexec/elf/strip: /usr/local/bin/perl: No such file or directory
> 	*** Error code 1

I don't know what is the exact reason why portupgrade is not happy.  It
might be a side effect of the _real_ problem.

You gave me build logs I requested, and:

On Tue, Nov 11, 2003 at 08:57:39PM +0100, Shobaki Sam. wrote:

> Here are the files you asked for.

[...]

> LD_LIBRARY_PATH=/usr/ports/lang/perl5.8/work/perl-5.8.2:/usr/lib:/usr/local/lib:/usr/X11R6/lib:/compat/linux/lib:/compat/linux/usr/lib:/compat/linux/usr/X11R6/lib cc -Wl,-E  -L/usr/local/lib -o miniperl  miniperlmain.o opmini.o -L. -lperl -lm -lcrypt -lutil -lc

[...]

> /usr/libexec/ld-elf.so.1: /usr/local/bin/perl: Undefined symbol "PL_exit_flags"
> *** Error code 1

This is your problem, I think.

Here is what I get in my test jail:

# unset LD_LIBRARY_PATH
# /usr/local/bin/perl -v
This is perl, v5.8.2 built for i386-freebsd
[...]
# LD_LIBRARY_PATH=/usr/lib ; export LD_LIBRARY_PATH
# /usr/local/bin/perl -v
/usr/libexec/ld-elf.so.1: /usr/local/bin/perl: Undefined symbol "PL_exit_flags"

Explanation:

Perl binary is compiled with "-Wl,-R/usr/local/lib/perl5/5.8.2/mach/CORE",
so that it knows how to find its own (correct).  -Rdirectory is
equivalent to -rpath directory in GNU ld, which incidentally is FreeBSD
ld(1).  The funny thing is that the manual page for ld(1) says that
-rpath takes precedence over LD_LIBRARY_PATH, but it looks like it is
not really the case on FreeBSD 4.9.

Indeed, looking at src/libexec/rtld-elf/rtld.c on a -stable system, we
can see, near the find_library() function, the following comment:

 * The search order is:
 *   rpath in the referencing file
 *   LD_LIBRARY_PATH
 *   ldconfig hints
 *   /usr/lib

Which follows by the following conflicting code:

    if ((pathname = search_library_path(name, ld_library_path)) != NULL ||
      (refobj != NULL &&
      (pathname = search_library_path(name, refobj->rpath)) != NULL) ||
      (pathname = search_library_path(name, gethints())) != NULL ||
      (pathname = search_library_path(name, STANDARD_LIBRARY_PATH)) != NULL)
    return pathname;

If you don't grok C:  this means that LD_LIBRARY_PATH is searched first,
and it should not.

Oh, by the way, -CURRENT has the same problem.

So, either rtld or rtld's docs need to be fixed, but an obvious
workaround for _your_ problem would be to unset LD_LIBRARY_PATH
globally, or at _least_ remove /usr/lib from it.  It is not needed there
anyway.

Cheers,
\Anton.
-- 
If I did know the future of Perl, and if I told you, you'd probably run
away screaming.  -- Larry Wall
Comment 3 Anton Berezin freebsd_committer freebsd_triage 2003-11-11 20:59:37 UTC
Ok, adding to that, the change of the search order was deliberate,
please see PR/28191 , http://www.freebsd.org/cgi/query-pr.cgi?pr=28191.

The documentation should be fixed.

You should stop using LD_LIBRARY_PATH indiscriminately (for the same
global effect with lower precedence just play with ldconfig at boot
time).

Cheers,
\Anton.
-- 
If I did know the future of Perl, and if I told you, you'd probably run
away screaming.  -- Larry Wall
Comment 4 Anton Berezin freebsd_committer freebsd_triage 2003-11-12 00:09:52 UTC
After sorting out the LD_LIBRARY_PATH problem, it turned out that, if
perl5.8.2 symlink already exists in ${PREFIX}/bin, the port fails to
actually install the binary.

I have committed a fix, please test it in your setup.

\Anton.
-- 
If I did know the future of Perl, and if I told you, you'd probably run
away screaming.  -- Larry Wall
Comment 5 Anton Berezin freebsd_committer freebsd_triage 2003-11-12 08:22:08 UTC
State Changed
From-To: open->closed

The originator confirms that the latest commit has fixed the problem. 
Thanks for your report!