Perl / perl5

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

Can't build perl with -Duseshrplib if /usr/bin/gcc is a perl script #6595

Closed p5pRT closed 17 years ago

p5pRT commented 21 years ago

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

Searchable as RT22941$

p5pRT commented 21 years ago

From alian@cpan.org

Created by alian@cpan.org

This is a bug report for perl from alian@​cpan.org\, generated with the help of perlbug 1.34 running under perl v5.8.0.

----------------------------------------------------------------- I can't build 5.8.1 nor blead with -Duseshrplib on Mandrake. saturne​:\~$ more /usr/bin/gcc #! /usr/bin/perl -w

# # colorgcc .... use Term​::ANSIColor; use IPC​::Open3;

At build time​: Can't locate Term/ANSIColor.pm in @​INC (@​INC contains​: /usr/local/lib/perl5/5.9.0/i686-linux /usr/local/lib/perl5/5.9.0 /usr/local/lib/perl5/site_perl/5.9.0/i686-linux /usr/local/lib/perl5/site_perl/5.9.0 /usr/local/lib/perl5/site_perl .) at /usr/bin/cc line 91. BEGIN failed--compilation aborted at /usr/bin/cc line 91. make[1]​: *** [DynaLoader.o] Error 2 make​: *** [lib/auto/DynaLoader/DynaLoader.a] Error 2

saturne​:\~/.cpanplus/5.8.0/build/Test-Smoke-1.17$ more /etc/mandrake-release Mandrake Linux release 8.1 (Raklet) for i586

Perl Info ``` Flags: category=core severity=low Site configuration information for perl v5.8.0: Configured by alian at Wed Feb 19 01:49:26 CET 2003. Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration: Platform: osname=linux, osvers=2.4.20, archname=i686-linux-thread-multi-64all-ld uname='linux saturne.alianet 2.4.20 #81 smp jeu déc 12 18:42:40 cet 2002 i686 unknown ' config_args='-Duseithreads -Duse64bitall -Duselongdouble -Duseshrplib -Dcf_email=alian@cpan.org -Dprefix=/usr/local/perl-5.8.0 -des' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=define usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2', cppflags='-D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -I/usr/local/include -I/usr/include/gdbm' ccversion='', gccversion='2.96 20000731 (Mandrake Linux 8.1 2.96-0.62mdk)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='long double', nvsize=12, Off_t='off_t', lseeksize=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib /usr/lib libs=-lnsl -lgdbm -ldl -lm -lpthread -lc -lcrypt -lutil perllibs=-lnsl -ldl -lm -lpthread -lc -lcrypt -lutil libc=/lib/libc-2.2.4.so, so=so, useshrplib=true, libperl=libperl.so gnulibc_version='2.2.4' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/local/perl-5.8.0/lib/5.8.0/i686-linux-thread-multi-64all-ld/CORE' cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib' Locally applied patches: @INC for perl v5.8.0: /usr/local/perl-5.8.0/lib/5.8.0/i686-linux-thread-multi-64all-ld /usr/local/perl-5.8.0/lib/5.8.0 /usr/local/perl-5.8.0/lib/site_perl/5.8.0/i686-linux-thread-multi-64all-ld /usr/local/perl-5.8.0/lib/site_perl/5.8.0 /usr/local/perl-5.8.0/lib/site_perl . Environment for perl v5.8.0: HOME=/home/alian LANG=fr LANGUAGE=fr_FR:fr LC_COLLATE=fr_FR@euro LC_CTYPE=fr_FR@euro LC_MESSAGES=fr_FR@euro LC_MONETARY=fr_FR@euro LC_NUMERIC=fr_FR@euro LC_TIME=fr_FR@euro LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/usr/local/perl-5.8.0/bin:/home/alian/bin:/usr/local/workplace/jakarta-ant-1.5.1/bin/:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/usr/games PERL_BADLANG (unset) SHELL=/bin/bash ```
p5pRT commented 21 years ago

From enache@rdslink.ro

On Mon\, Jul 14\, 2003 at 05​:35​:13AM -0000\, alian wrote​:

I can't build 5.8.1 nor blead with -Duseshrplib on Mandrake. saturne​:\~$ more /usr/bin/gcc #! /usr/bin/perl -w

# # colorgcc .... use Term​::ANSIColor; use IPC​::Open3;

Could you please try this ?

(that may not work\, and is\, of course\, lame - _all_ could be a perl script\, including /bin/sh :-))

Regards\, Adi

Inline Patch ```diff --- /arc/bleadperl/Makefile.SH 2003-07-05 01:58:12.000000000 +0300 +++ ./Makefile.SH 2003-07-14 23:17:49.000000000 +0300 @@ -114,6 +114,7 @@ exec "$@" EOT chmod 755 preload ldlibpth="$ldlibpth `pwd`/preload `pwd`/$libperl" + nopreload="LD_PRELOAD= " ;; os390) test -f /bin/env && ldlibpth="/bin/env $ldlibpth" ;; @@ -166,7 +167,7 @@ $spitshell >Makefile <
p5pRT commented 21 years ago

From alian@cpan.org

Adrian Enache (via RT) wrote​:

On Mon\, Jul 14\, 2003 at 05​:35​:13AM -0000\, alian wrote​:

I can't build 5.8.1 nor blead with -Duseshrplib on Mandrake. saturne​:\~$ more /usr/bin/gcc #! /usr/bin/perl -w

Could you please try this ?

(that may not work\, and is\, of course\, lame - _all_ could be a perl script\, including /bin/sh :-))

Regards\, Adi

--- /arc/bleadperl/Makefile.SH 2003-07-05 01​:58​:12.000000000 +0300 +++ ./Makefile.SH 2003-07-14 23​:17​:49.000000000 +0300 @​@​ -114\,6 +114\,7 @​@​ exec "$@​" EOT chmod 755 preload ldlibpth="$ldlibpth `pwd`/preload `pwd`/$libperl" + nopreload="LD_PRELOAD= " ;; os390) test -f /bin/env && ldlibpth="/bin/env $ldlibpth" ;; @​@​ -166\,7 +167\,7 @​@​ $spitshell >Makefile \<\<!GROK!THIS! # # I now supply perly.c with the kits\, so don't remake perly.c without byacc BYACC = $byacc -CC = $cc +CC = $nopreload $cc LD = $ld

LDFLAGS = $ldflags

This doesn't work​: ../../miniperl "-I../../lib" "-I../../lib" ../../lib/ExtUtils/xsubpp -noprototypes -typemap ../../lib/ExtUtils/typemap DynaLoader.xs > DynaLoader.xsc && mv DynaLoader.xsc DynaLoader.c cc -c -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm -I/usr/include/libelf -O2 -DVERSION=\"1.04\" -DXS_VERSION=\"1.04\" -fpic "-I../.." -DPERL_CORE -DLIBC="/lib/libc-2.2.4.so" DynaLoader.c Can't locate Term/ANSIColor.pm in @​INC (@​INC contains​: /usr/local/lib/perl5/5.9.0/i686-linux /usr/local/lib/perl5/5.9.0 /usr/local/lib/perl5/site_perl/5.9.0/i686-linux /usr/local/lib/perl5/site_perl/5.9.0 /usr/local/lib/perl5/site_perl .) at /usr/bin/cc line 91. BEGIN failed--compilation aborted at /usr/bin/cc line 91.

As dynaloader use miniperl & makefile.PL\, we lost nopreload​:

saturne​:/usr/local/workplace/perl/perl-current$ LD_LIBRARY_PATH=. ./miniperl -V -Ilib Summary of my perl5 (revision 5.0 version 9 subversion 0 patch 20159) configuration​:   Platform​:   osname=linux\, osvers=2.4.20\, archname=i686-linux   ....   Compiler​:   cc='cc'\, ccflags ='...

p5pRT commented 21 years ago

From @doughera88

On Tue\, 15 Jul 2003\, Alian wrote​:

Adrian Enache (via RT) wrote​:

On Mon\, Jul 14\, 2003 at 05​:35​:13AM -0000\, alian wrote​:

I can't build 5.8.1 nor blead with -Duseshrplib on Mandrake. saturne​:\~$ more /usr/bin/gcc #! /usr/bin/perl -w

For the time being\, one workaround would be to skip the perl wrapper around gcc\, and just use

  sh Configure -Dcc=/path/to/real/cc

Another thing that may help is to "smarten" Makefile.SH so that it only builds the preload script if it is necessary to do so. Or\, more simply\, perhaps we should make the script actually set LD_PRELOAD only if $archlib/CORE/$libperl already exists.

Try this (untested!)

Inline Patch ```diff --- perl-5.8.x/Makefile.SH Sat Jul 5 11:14:19 2003 +++ perl-5.8.x-andy/Makefile.SH Tue Jul 15 10:50:20 2003 @@ -104,6 +104,13 @@ case "$osname" in linux) + # If there is a pre-existing $libperl from a previous + # installation, Linux needs to use LD_PRELOAD to + # override the LD_LIBRARY_PATH setting. See the + # INSTALL file, under "Building a shared perl library". + # If there is no pre-existing $libperl, we don't need + # to do anything further. + if test -f $archlib/CORE/$libperl; then rm -f preload cat <<'EOT' > preload #! /bin/sh @@ -114,7 +121,8 @@ EOT chmod 755 preload ldlibpth="$ldlibpth `pwd`/preload `pwd`/$libperl" - ;; + fi + ;; os390) test -f /bin/env && ldlibpth="/bin/env $ldlibpth" ;; esac -- Andy Dougherty doughera@lafayette.edu ```
p5pRT commented 21 years ago

From enache@rdslink.ro

On Tue\, Jul 15\, 2003 at 10​:52​:58AM -0400\, Andy Dougherty wrote​:

Another thing that may help is to "smarten" Makefile.SH so that it only builds the preload script if it is necessary to do so. Or\, more simply\, perhaps we should make the script actually set LD_PRELOAD only if $archlib/CORE/$libperl already exists.

And then (when $archlib/CORE/$libperl really exists) would this work ;-) ?

FWIW\, I'll choose not to hardwire at all the dynamic library path in the perl binary. (harwiring paths may always prove to be a very bad idea). When testing\, LD_LIBRARY_PATH= is just enough to make all things work fine\, and after installing I run ldconfig with $archlib/CORE as its argument. (or other directory I like to move libperl.so to\, ex. /usr/lib).

(of course\, the problem is with binary distributions\, they'll have to do the same).

Regards\, Adi

p5pRT commented 21 years ago

From alian@cpan.org

For the time being\, one workaround would be to skip the perl wrapper around gcc\, and just use

sh Configure \-Dcc=/path/to/real/cc

Of course. But you must know you must do it. And the error message in the failed build isn't enough explicit. A note in a README.linux can be a good thing. (It's linux release specific\, I see this for Mandrake & Yellow Dog).

Another thing that may help is to "smarten" Makefile.SH so that it only builds the preload script if it is necessary to do so. Or\, more simply\, perhaps we should make the script actually set LD_PRELOAD only if $archlib/CORE/$libperl already exists.

Try this (untested!)

The patch at the end of this mail work perfect. It solve my problem. Thank you.

--- perl-5.8.x/Makefile.SH Sat Jul 5 11​:14​:19 2003 +++ perl-5.8.x-andy/Makefile.SH Tue Jul 15 10​:50​:20 2003 @​@​ -104\,6 +104\,13 @​@​

 case "$osname" in
 linux\)

+ # If there is a pre-existing $libperl from a previous + # installation\, Linux needs to use LD_PRELOAD to + # override the LD_LIBRARY_PATH setting. See the + # INSTALL file\, under "Building a shared perl library". + # If there is no pre-existing $libperl\, we don't need + # to do anything further. + if test -f $archlib/CORE/$libperl; then rm -f preload cat \<\<'EOT' > preload #! /bin/sh @​@​ -114\,7 +121\,8 @​@​ EOT chmod 755 preload ldlibpth="$ldlibpth `pwd`/preload `pwd`/$libperl" - ;; + fi + ;; os390) test -f /bin/env && ldlibpth="/bin/env $ldlibpth" ;; esac

p5pRT commented 21 years ago

From @doughera88

On Tue\, 15 Jul 2003\, Enache Adrian wrote​:

On Tue\, Jul 15\, 2003 at 10​:52​:58AM -0400\, Andy Dougherty wrote​:

Another thing that may help is to "smarten" Makefile.SH so that it only builds the preload script if it is necessary to do so. Or\, more simply\, perhaps we should make the script actually set LD_PRELOAD only if $archlib/CORE/$libperl already exists.

And then (when $archlib/CORE/$libperl really exists) would this work ;-) ?

No\, it wouldn't. However\, as is stated in INSTALL\, it's generally a bad idea to ever have $archlib/CORE/$libperl already existing. This preload trick should be used only if the user has ignored the warning from INSTALL. As it is currently\, however\, the preload trick incorrectly interferes even if you did follow the advice in INSTALL. In the case of /usr/bin/gcc being a perl script\, this incorrect preloading caused a failure.

--   Andy Dougherty doughera@​lafayette.edu

p5pRT commented 21 years ago

From enache@rdslink.ro

On Tue\, Jul 15\, 2003 at 12​:26​:02PM -0400\, Andy Dougherty wrote​:

On Tue\, 15 Jul 2003\, Enache Adrian wrote​:

On Tue\, Jul 15\, 2003 at 10​:52​:58AM -0400\, Andy Dougherty wrote​:

Another thing that may help is to "smarten" Makefile.SH so that it only builds the preload script if it is necessary to do so. Or\, more simply\, perhaps we should make the script actually set LD_PRELOAD only if $archlib/CORE/$libperl already exists.

And then (when $archlib/CORE/$libperl really exists) would this work ;-) ?

No\, it wouldn't. However\, as is stated in INSTALL\, it's generally a bad idea to ever have $archlib/CORE/$libperl already existing. This preload

Does it mean I have to wipe out my old perl before building a new one ? I won't do that before build and make test succeeded.

(sorry if I misunderstood\, but I wasn't been able to locate the place in INSTALL where is recommended not to have $archlib/CORE/$libperl already existing).

Regards\, Adi

p5pRT commented 21 years ago

From @doughera88

On Wed\, 16 Jul 2003\, Enache Adrian wrote​:

On Tue\, Jul 15\, 2003 at 12​:26​:02PM -0400\, Andy Dougherty wrote​:

On Tue\, 15 Jul 2003\, Enache Adrian wrote​:

On Tue\, Jul 15\, 2003 at 10​:52​:58AM -0400\, Andy Dougherty wrote​:

Another thing that may help is to "smarten" Makefile.SH so that it only builds the preload script if it is necessary to do so. Or\, more simply\, perhaps we should make the script actually set LD_PRELOAD only if $archlib/CORE/$libperl already exists.

And then (when $archlib/CORE/$libperl really exists) would this work ;-) ?

No\, it wouldn't. However\, as is stated in INSTALL\, it's generally a bad idea to ever have $archlib/CORE/$libperl already existing. This preload

Does it mean I have to wipe out my old perl before building a new one ?

Yes\, but only if all the following conditions are true​:

  1. Your old perl had a shared libperl.   2. The new perl your are building also has a shared libperl   with the same name (e.g. libperl.so.8)\, that differs in some   way from the old one. (For example\, it might include   -DDEBUGGING.)   3. Your new perl uses the same name for the   architecture-dependent library as the existing one does.   4. Your system does not have a method of overriding the built-in   LD_RUN_PATH (or equivalient) setting of the perl binary.

Condition 3 is usually the key one. That's the one discussed in the INSTALL file in the two paragraphs starting with

  There is also an potential problem with the shared perl library if ...

It's easy to avoid -- just install into a different $archlib. For most users not on p5p\, this isn't a problem\, since $archlib automatically includes the version number and several of the key configuration options (threads\, 64 bits). For users installing frequent snapshots (all of which contain the same version number) it can be a problem. Such users can always use a different $archlib (or even a different $prefix) if they wish.

--   Andy Dougherty doughera@​lafayette.edu

p5pRT commented 21 years ago

From @doughera88

On Wed\, 16 Jul 2003\, Enache Adrian wrote​:

(sorry if I misunderstood\, but I wasn't been able to locate the place in INSTALL where is recommended not to have $archlib/CORE/$libperl already existing).

It's not explicitly stated in precisely those terms. Here's a patch that might make it more explicit​:

Inline Patch ```diff --- perl-5.8.x/INSTALL Thu Jul 10 21:42:38 2003 +++ perl-5.8.x-andy/INSTALL Wed Jul 16 11:00:25 2003 @@ -972,10 +972,14 @@ Digital Unix, you can override LD_LIBRARY_PATH by setting the _RLD_ROOT environment variable to point to the perl build directory. -The only reliable answer is that you should specify a different -directory for the architecture-dependent library for your -DDEBUGGING -version of perl. You can do this by changing all the *archlib* -variables in config.sh to point to your new architecture-dependent library. +In other words, it is generally not a good idea to try to build a perl +with a shared library if $archlib/CORE/$libperl already exists from a +previous build. + +A good workaround is to specify a different directory for the +architecture-dependent library for your -DDEBUGGING version of perl. +You can do this by changing all the *archlib* variables in config.sh to +point to your new architecture-dependent library. =head2 Malloc Issues -- ```

  Andy Dougherty doughera@​lafayette.edu

p5pRT commented 21 years ago

From @rgs

Andy Dougherty wrote​:

Another thing that may help is to "smarten" Makefile.SH so that it only builds the preload script if it is necessary to do so. Or\, more simply\, perhaps we should make the script actually set LD_PRELOAD only if $archlib/CORE/$libperl already exists.

Try this (untested!)

Thanks\, applied to blead as #20172 (as well as your INSTALL nit).

p5pRT commented 17 years ago

@doughera88 - Status changed from 'open' to 'resolved'