Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 400839 - dev-lang/perl-5.12.3-r1 fails to bootstrap with undefined references to libm on Ubuntu
Summary: dev-lang/perl-5.12.3-r1 fails to bootstrap with undefined references to libm ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: Prefix Support (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Prefix
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-25 22:12 UTC by Nicolas Pinto
Modified: 2012-07-08 16:13 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nicolas Pinto 2012-01-25 22:12:55 UTC
On Ubuntu 11.04 and 11.10 64 bit:

dev-lang/perl-5.12.3-r1 fails to bootstrap with the following errors:

gcc -L/root/gentoo/usr/lib -Wl,-rpath=/root/gentoo/usr/lib -L/root/gentoo/lib -Wl,-rpath=/root/gentoo/lib -o miniperl \
              gv.o toke.o perly.o pad.o regcomp.o dump.o util.o mg.o reentr.o mro.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o globals.o perlio.o perlapi.o numeric.o mathoms.o locale.o pp_pack.o pp_sort.o   \
            miniperlmain.o opmini.o perlmini.o
pp.o: In function `Perl_pp_pow':
pp.c:(.text+0x30a9): undefined reference to `pow'
pp.o: In function `Perl_pp_modulo':
pp.c:(.text+0x3e03): undefined reference to `floor'
pp.c:(.text+0x3e37): undefined reference to `floor'
pp.c:(.text+0x41c0): undefined reference to `fmod'
pp.o: In function `Perl_pp_atan2':
pp.c:(.text+0x8ebf): undefined reference to `atan2'
pp.o: In function `Perl_pp_sin':
pp.c:(.text+0x9062): undefined reference to `sin'
pp.o: In function `Perl_pp_int':
pp.c:(.text+0x9501): undefined reference to `floor'
pp.c:(.text+0x9521): undefined reference to `ceil'
pp.o:(.rodata+0x280): undefined reference to `cos'
pp.o:(.rodata+0x288): undefined reference to `sin'
pp.o:(.rodata+0x290): undefined reference to `sin'
pp.o:(.rodata+0x298): undefined reference to `exp'
pp.o:(.rodata+0x2a0): undefined reference to `log'
pp.o:(.rodata+0x2a8): undefined reference to `sqrt'
pp_sys.o: In function `S_gmtime64_r.isra.3':
pp_sys.c:(.text+0x1c5): undefined reference to `ceil'
pp_sys.c:(.text+0x21e): undefined reference to `ceil'
pp_sys.c:(.text+0x279): undefined reference to `ceil'
pp_sys.c:(.text+0x32e): undefined reference to `floor'
pp_sys.c:(.text+0x4bf): undefined reference to `ceil'
pp_sys.c:(.text+0x5f1): undefined reference to `floor'
pp_sys.c:(.text+0x639): undefined reference to `floor'
pp_sys.c:(.text+0x651): undefined reference to `floor'
pp_sys.c:(.text+0x6b4): undefined reference to `fmod'
pp_sys.c:(.text+0x6e0): undefined reference to `fmod'
pp_sys.c:(.text+0x704): undefined reference to `fmod'
pp_sys.c:(.text+0x72e): undefined reference to `fmod'
pp_sys.o: In function `Perl_pp_gmtime':
pp_sys.c:(.text+0xcc48): undefined reference to `floor'
pp_pack.o: In function `S_pack_rec':   
pp_pack.c:(.text+0x34a7): undefined reference to `floor'
pp_pack.c:(.text+0x34c9): undefined reference to `floor'
pp_pack.c:(.text+0x34f2): undefined reference to `floor'
collect2: ld returned 1 exit status
make[1]: *** [miniperl] Error 1

There seems to be a bad interaction with the new gcc in Ubuntu/Debian

gcc --version
gcc (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

LDFLAGS="-lm" can help solve part of the issue but there must be a better way.

Other report from another user:
https://gist.github.com/1379063

Any pointer on how to approach this type of issue? I have not been able to bootstrap *any* prefix on recent Ubuntu distros (>11.04).
Comment 1 Nicolas Pinto 2012-01-25 22:16:54 UTC
Related bug report on the mailing list:
http://archives.gentoo.org/gentoo-alt/msg_afacb2f828280fede41f798418f7bc30.xml
Comment 2 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2012-01-27 18:52:25 UTC
(In reply to comment #1)
> Related bug report on the mailing list:
> http://archives.gentoo.org/gentoo-alt/msg_afacb2f828280fede41f798418f7bc30.xml

asm/errno.h is now /usr/include/i386-linux-gnu/asm/errno.h

I'm guessing the rest of your issues is due to the multiarch garbage that ubuntu does now
Comment 3 Nicolas Pinto 2012-01-27 18:56:09 UTC
Thanks for the feedback.

So how do I get around this ubuntu multiarch garbage ? Were you able to get it to work on >11.04 ?
Comment 4 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2012-01-27 19:24:49 UTC
standby
Comment 5 Nicolas Pinto 2012-01-28 00:48:06 UTC
Of course. Let me know how can I help.
Comment 6 Fabian Groffen gentoo-dev 2012-02-09 17:54:09 UTC
hmmm, I wonder if we shouldn't get our gcc to "understand" this multiarch include crap :/
Comment 7 Nicolas Pinto 2012-03-19 12:08:07 UTC
I'll be happy to help here. Please let me know how ;-)
Comment 8 Nicolas Pinto 2012-04-04 21:44:07 UTC
Fabian, do you have any update on this?
Comment 9 Fabian Groffen gentoo-dev 2012-04-05 06:59:55 UTC
this still doesn't work?!?
Comment 10 Nicolas Pinto 2012-04-05 15:02:26 UTC
Unfortunately not. Have you been able to bootstrap on Ubuntu 11.* ?
Comment 11 Benda Xu gentoo-dev 2012-04-06 04:01:30 UTC
I have got a testing VPS from darkside to test bootstraping on Ubuntu. But did not carried out yet. I'll schedule a time to do it in the weekend.
Comment 12 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2012-04-06 12:30:24 UTC
(In reply to comment #11)
> I have got a testing VPS from darkside to test bootstraping on Ubuntu. But
> did not carried out yet. I'll schedule a time to do it in the weekend.

No, I killed that because no one logged in for weeks and it just cost me money.
Comment 13 Michael Haubenwallner (RETIRED) gentoo-dev 2012-04-11 08:33:10 UTC
(In reply to comment #6)
> hmmm, I wonder if we shouldn't get our gcc to "understand" this multiarch
> include crap :/

This definitively would be necessary to support the Ubuntu multiarch-crap.

However, I'd really wonder if this multiarch thing will ever make it to other distros at all (for Gentoo maybe via multilib-portage).
Comment 14 Fabian Groffen gentoo-dev 2012-04-11 12:52:50 UTC
Ahhh, so this patch should do, shouldn't it?

Index: perl-5.12.4-r2.ebuild
===================================================================
RCS file: /var/cvsroot/gentoo-x86/dev-lang/perl/perl-5.12.4-r2.ebuild,v
retrieving revision 1.1
diff -u -r1.1 perl-5.12.4-r2.ebuild
--- perl-5.12.4-r2.ebuild       3 Mar 2012 12:29:38 -0000       1.1
+++ perl-5.12.4-r2.ebuild       11 Apr 2012 12:51:36 -0000
@@ -251,7 +251,7 @@
                local paths=""
                echo "int main() {}" > "${T}"/t.c
                # need to ensure dirs contain compatible libs, bug #358875
-               for ldir in /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib ; do
+               for ldir in /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib/*-linux-gnu /usr/lib/*-linux/gnu /lib /usr/lib ; do
                        [[ -d ${ldir} ]] || continue
                        # look for libc, which should be somewhere
                        llib=${ldir}/libc$(get_libname)
cvs diff: Diffing files
Comment 15 Nicolas Pinto 2012-04-11 18:27:32 UTC
I still get the same issue:

% grep "for ldir" ~/gentoo/usr/portage/dev-lang/perl/perl-5.12.4-r2.ebuild
                for ldir in /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib/*-linux-gnu /usr/lib/*-linux/gnu /lib /usr/lib ; do

% ebuild ~/gentoo/usr/portage/dev-lang/perl/perl-5.12.4-r2.ebuild digest clean merge

...
gcc -L/home/pinto/gentoo/usr/lib -Wl,-rpath=/home/pinto/gentoo/usr/lib -L/home/pinto/gentoo/lib -Wl,-rpath=/home/pinto/gentoo/lib -o miniperl \
      gv.o toke.o perly.o pad.o regcomp.o dump.o util.o mg.o reentr.o mro.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o globals.o perlio.o perlapi.o numeric.o mathoms.o locale.o pp_pack.o pp_sort.o   \
    miniperlmain.o opmini.o perlmini.o
pp.o: In function `Perl_pp_pow':
pp.c:(.text+0x3330): undefined reference to `pow'
...
Comment 16 Fabian Groffen gentoo-dev 2012-04-11 18:36:46 UTC
can you please post the output of 

ls {,/usr}/lib/*-linux-gnu/libc.*
Comment 17 Nicolas Pinto 2012-04-11 18:42:31 UTC
% ls {,/usr}/lib/*-linux-gnu/libc.*
/lib/x86_64-linux-gnu/libc.so.6  /usr/lib/x86_64-linux-gnu/libc.a  /usr/lib/x86_64-linux-gnu/libc.so


% ls {,/usr}/lib/*-linux-gnu/libm.*
/lib/x86_64-linux-gnu/libm.so.6  /usr/lib/x86_64-linux-gnu/libm.a  /usr/lib/x86_64-linux-gnu/libm.so
Comment 18 Nicolas Pinto 2012-04-11 18:56:44 UTC
Note that the following hack work around the "undefined reference to `pow' " issue:

LDFLAGS=-lm ebuild ~/gentoo/usr/portage/dev-lang/perl/perl-5.12.4-r2.ebuild digest clean merge

but then the following error occurs:

...

make[1]: Leaving directory `/mnt/md1/home/pinto/gentoo/var/tmp/portage/dev-lang/perl-5.12.4-r2/work/perl-5.12.4'
!!! dolib: /mnt/md1/home/pinto/gentoo/var/tmp/portage/dev-lang/perl-5.12.4-r2/image/home/pinto/gentoo///usr/lib/perl5/5.12.4/x86_64-linux/CORE/libperl.so.5.12.4 does not exist
 * ERROR: dev-lang/perl-5.12.4-r2 failed (install phase):
 *   dolib failed
 * 
 * If you need support, post the output of 'emerge --info =dev-lang/perl-5.12.4-r2',
 * the complete build log and the output of 'emerge -pqv =dev-lang/perl-5.12.4-r2'.
 * The complete build log is located at '/mnt/md1/home/pinto/gentoo/var/tmp/portage/dev-lang/perl-5.12.4-r2/temp/build.log'.
 * The ebuild environment file is located at '/mnt/md1/home/pinto/gentoo/var/tmp/portage/dev-lang/perl-5.12.4-r2/temp/environment'.
 * S: '/mnt/md1/home/pinto/gentoo/var/tmp/portage/dev-lang/perl-5.12.4-r2/work/perl-5.12.4'
 * QA Notice: file does not exist:
 * 
 *      dolib: /mnt/md1/home/pinto/gentoo/var/tmp/portage/dev-lang/perl-5.12.4-r2/image/home/pinto/gentoo///usr/lib/perl5/5.12.4/x86_64-linux/CORE/libperl.so.5.12.4 does not exist

 * Messages for package dev-lang/perl-5.12.4-r2:

 * ERROR: dev-lang/perl-5.12.4-r2 failed (install phase):
 *   dolib failed
 * 
 * If you need support, post the output of 'emerge --info =dev-lang/perl-5.12.4-r2',
 * the complete build log and the output of 'emerge -pqv =dev-lang/perl-5.12.4-r2'.
 * The complete build log is located at '/mnt/md1/home/pinto/gentoo/var/tmp/portage/dev-lang/perl-5.12.4-r2/temp/build.log'.
 * The ebuild environment file is located at '/mnt/md1/home/pinto/gentoo/var/tmp/portage/dev-lang/perl-5.12.4-r2/temp/environment'.
 * S: '/mnt/md1/home/pinto/gentoo/var/tmp/portage/dev-lang/perl-5.12.4-r2/work/perl-5.12.4'
[1]    6703 exit 1     LDFLAGS=-lm ebuild ~/gentoo/usr/portage/dev-lang/perl/perl-5.12.4-r2.ebuild
Comment 19 Nicolas Pinto 2012-04-24 21:53:33 UTC
Hey Fabian,

Is there anything else you think I should try to help fix this bug?

Thanks again.

N
Comment 20 Fabian Groffen gentoo-dev 2012-04-25 06:37:58 UTC
I'm out of ideas.  Probably have to get myself a Ubuntu virtual machine to play with sometime.
Comment 21 Nicolas Pinto 2012-07-08 05:57:50 UTC
The following patch, derived from yours, worked!

diff --git a/files/usr/local/portage/dev-lang/perl/perl-5.12.4-r2.ebuild b/files/usr/local/portage/dev-lang/perl/perl-5.12.4-r2.ebuild
index 2b97965..4301020 100644
--- a/files/usr/local/portage/dev-lang/perl/perl-5.12.4-r2.ebuild
+++ b/files/usr/local/portage/dev-lang/perl/perl-5.12.4-r2.ebuild
@@ -251,7 +251,7 @@ src_configure() {
                local paths=""
                echo "int main() {}" > "${T}"/t.c
                # need to ensure dirs contain compatible libs, bug #358875
-               for ldir in /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib ; do
+               for ldir in /lib/*-linux-gnu /usr/lib/*-linux-gnu /lib64 /lib/64 /usr/lib64 /usr/lib/64 /lib32 /usr/lib32 /lib /usr/lib ; do
                        [[ -d ${ldir} ]] || continue
                        # look for libc, which should be somewhere
                        llib=${ldir}/libc$(get_libname)

Note the order of the path, and the "gnu" typo fix.

Any chance to get it into the tree?

Thanks for your help!
Comment 22 Fabian Groffen gentoo-dev 2012-07-08 09:36:34 UTC
yup, committed now, thanks!
Comment 23 Nicolas Pinto 2012-07-08 16:13:34 UTC
Awesome!

I also have a (hacky?) patch for binutils that helps with multiarch distros (e.g. Ubuntu 11.04+)

--- ld/genscripts.sh.orig       2012-07-08 12:13:31.405770577 -0400
+++ ld/genscripts.sh    2012-07-07 19:57:39.285777628 -0400
@@ -241,7 +241,8 @@
   fi
 fi
 
-LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");SEARCH_DIR(\\"\1\\/'${TOOL_LIB}'");/g'`
+SYSTEM_SEARCH_DIRS=`/usr/bin/ld -verbose | grep SEARCH_DIR`
+LIB_SEARCH_DIRS=`echo ${LIB_PATH} | sed -e 's/:/ /g' -e 's/\([^ ][^ ]*\)/SEARCH_DIR(\\"\1\\");SEARCH_DIR(\\"\1\\/'${TOOL_LIB}'");/g'`${SYSTEM_SEARCH_DIRS}
 
 # We need it for testsuite.
 set $EMULATION_LIBPATH

So now Prefix works seamlessly there too!