gugod / App-perlbrew

Manage perl installations in your $HOME
https://perlbrew.pl
Other
720 stars 216 forks source link

Ubuntu 11.04 and perlbrew installation problems #64

Closed srekoc closed 13 years ago

srekoc commented 13 years ago

Hi,

I am unable to fix it from past 3 days and I desperately need someone to help me on this. I installed perlbrew like a charm on Ubuntu 10.10 and it worked great. But now I upgraded to 11.04 and am finding issues. I know that the issue is with GCC linker options -lm (linking math.h) and -lrt (time.h). Here are the errors. Can some one tell me how I can fix this problem ?

pp_sys.c:(.text+0x796): undefined reference to fmod' pp_sys.c:(.text+0x7bf): undefined reference tofmod' pp_sys.o: In function Perl_pp_gmtime': pp_sys.c:(.text+0xc602): undefined reference tofloor' pp_pack.o: In function S_pack_rec': pp_pack.c:(.text+0x61fa): undefined reference tofloor' pp_pack.c:(.text+0x621b): undefined reference to floor' pp_pack.c:(.text+0x623a): undefined reference tofloor' collect2: ld returned 1 exit status make: *\ [miniperl] Error 1

Thanks!

gugod commented 13 years ago

On 2011/5/5, at 下午1:57, sreekanth-kocharlakota wrote:

Hi,

I am unable to fix it from past 3 days and I desperately need someone to help me on this. I installed perlbrew like a charm on Ubuntu 10.10 and it worked great. But now I upgraded to 11.04 and am finding issues. I know that the issue is with GCC linker options -lm (linking math.h) and -lrt (time.h). Here are the errors. Can some one tell me how I can fix this problem ?

pp_sys.c:(.text+0x796): undefined reference to fmod' pp_sys.c:(.text+0x7bf): undefined reference tofmod' pp_sys.o: In function Perl_pp_gmtime': pp_sys.c:(.text+0xc602): undefined reference tofloor' pp_pack.o: In function S_pack_rec': pp_pack.c:(.text+0x61fa): undefined reference tofloor' pp_pack.c:(.text+0x621b): undefined reference to floor' pp_pack.c:(.text+0x623a): undefined reference tofloor' collect2: ld returned 1 exit status make: *\ [miniperl] Error 1

Yes this is an known issue in perl5-porters. Ubuntu 11.04 put libm.so in a much different location under /lib/, which is not in the default search path when building those older-then-11.04 perls.

I highly suggest to solve this building issue in Devel::PatchPerl since perlbrew now relies on it to fix the building process.

srekoc commented 13 years ago

Hi Gugod.

Can you please elaborate on this ? Can you please tell me what I need to do in the PatchPerl ? Appreciate your help!

"I highly suggest to solve this building issue in Devel::PatchPerl since perlbrew now relies on it to fix the building process"

gugod commented 13 years ago

I don't really know exactly what to do on this particular issue. :)

I just know that Devel::PatchPerl is the place that we should be to deal with building process (but not add features).

To be fore specific, a few days ago I was investigating on this and discovered in hints/linux.sh in the blead, there is a paragraph describing this issue. I tried to copy the blead hints/linux.sh to a perl-5.12.3, but it did not just work. libm was found, but there were some other build errors.

That is really all I can tell you :)

srekoc commented 13 years ago

Wow! I brewed my coffee (perl environment) really well on 10.10. My bad to upgrade to 11.04. Kindly keep me posted if you find a fix for this. Thanks gugod!

punytan commented 13 years ago

@gugod

To solve this problem, we have to pass -Dperllibs and -Dplibpth with space-contained strings like below. perlbrew install perl-5.12.3 -Dperllibs='-lm -lc'

Then I encountered weird perlbrew's behavior. perlbrew only uses first "word" to build. Result: (cd /home/puny/perl5/perlbrew/build; tar xzf /home/puny/perl5/perlbrew/dists/perl-5.12.3.tar.gz;cd /home/puny/perl5/perlbrew/build/perl-5.12.3;rm -f config.sh Policy.sh;patchperl;sh Configure -de '-Dprefix=/home/puny/perl5/perlbrew/perls/perl-5.12.3' '-Dperllibs=-lm';make ;make test_harness && make install) >> '/home/puny/perl5/perlbrew/build.log' 2>&1

The option '-Dperllibs=-lm' must be like '-Dperllibs="-lm -lc"'.

I think this option parsing problem may be a bug of perlbrew. If this is a wrong guess, excuse me :)

gugod commented 13 years ago

Thanks for spotting that @punytan!

It does feel like a perlbrew bug to me, should spend some time solving it soon.

gugod commented 13 years ago

It appears that Devel::PatchPerl 0.32 just fixed the building process on Ubuntu 11.04.

I have write a blog describing this update at http://gugod.org/2011/05/perlbrew-020-release.html

If anyone can confirm the building to be successful, we can then close this issue :)

punytan commented 13 years ago

@gugod Unfortunately, make fails on perlbrew 0.20.

It seems we have to specify perllibs and plibpth explicitly.

puny@puny-VGN-TZ73B:~/perl5/perlbrew/build/perl-5.12.3$ grep perllibs config.sh 
perllibs=' '
puny@puny-VGN-TZ73B:~/perl5/perlbrew/build/perl-5.12.3$ grep plibpth config.sh 
plibpth=''
puny@puny-VGN-TZ73B:~/perl5/perlbrew$ perlbrew version
/home/puny/perl5/perlbrew/bin/perlbrew  - App::perlbrew/0.20

puny@puny-VGN-TZ73B:~/perl5/perlbrew$ perlbrew install perl-5.12.3
Use the previously fetched perl-5.12.3.tar.gz
Installing /home/puny/perl5/perlbrew/build/perl-5.12.3 into ~/perl5/perlbrew/perls/perl-5.12.3
This could take a while. You can run the following command on another shell to track the status:

  tail -f ~/perl5/perlbrew/build.log

(cd /home/puny/perl5/perlbrew/build/perl-5.12.3;rm -f config.sh Policy.sh;patchperl;sh Configure -de '-Dprefix=/home/puny/perl5/perlbrew/perls/perl-5.12.3';make ;make test_harness && make install) >> '/home/puny/perl5/perlbrew/build.log' 2>&1 
Installing /home/puny/perl5/perlbrew/build/perl-5.12.3 failed. See /home/puny/perl5/perlbrew/build.log to see why.
If you want to force install the distribution, try:

  perlbrew --force install perl-5.12.3

build.log

pp_sys.c:(.text+0x1c6): undefined reference to `ceil'
pp_sys.c:(.text+0x219): undefined reference to `ceil'
pp_sys.c:(.text+0x2db): undefined reference to `floor'
pp_sys.c:(.text+0x4aa): undefined reference to `ceil'
pp_sys.c:(.text+0x5a2): undefined reference to `floor'
pp_sys.c:(.text+0x5fa): undefined reference to `floor'
pp_sys.c:(.text+0x612): undefined reference to `floor'
pp_sys.c:(.text+0x73b): undefined reference to `fmod'
pp_sys.c:(.text+0x76d): undefined reference to `fmod'
pp_sys.c:(.text+0x796): undefined reference to `fmod'
pp_sys.c:(.text+0x7bf): undefined reference to `fmod'
pp_sys.o: In function `Perl_pp_gmtime':
pp_sys.c:(.text+0xc602): undefined reference to `floor'
pp_pack.o: In function `S_pack_rec':
pp_pack.c:(.text+0x61fa): undefined reference to `floor'
pp_pack.c:(.text+0x621b): undefined reference to `floor'
pp_pack.c:(.text+0x623a): undefined reference to `floor'
collect2: ld returned 1 exit status
make: *** [miniperl] Error 1

``

puny@puny-VGN-TZ73B:~/perl5/perlbrew/build/perl-5.12.3$ uname -a Linux puny-VGN-TZ73B 2.6.38-8-generic #42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 2011 i686 i686 i386 GNU/Linux

gugod commented 13 years ago

@punytan,

Thanks to @magnificent-tears who pointed out two obvious mistakes I made in the installer. They are fixed and I just confirmed that it worked for me (on a EC2 Ubuntu 11.04 instance)

If you install perlbrew by running this:

curl -L http://xrl.us/perlbrewinstall | bash

It should be working now.

It installs a standalone 'patchperl' program with the latest Devel::PatchPerl, which incorporate patches for building on Ubuntu 11.04. The perlbrew executable now depends on patchperl to fix any building process.

Please give it a try sometime, thank you.

srekoc commented 13 years ago

Hello Gugod,

You are the Saviour. New patch works great and I am right now brewing my perl on the Ubuntu 11.04. Appreciate all your help on this.

Thanks and Regards Sreekanth Kocharlakota 224.433.3277

On Mon, May 9, 2011 at 5:04 PM, gugod < reply@reply.github.com>wrote:

@punytan,

Thanks to @magnificent-tears who pointed out two obvious mistake I made in the installer. They are fixed and I just confirmed that it worked for me (on a EC2 Ubuntu 11.04 instance)

If you install perlbrew by running this:

curl -L http://xrl.us/perlbrewinstall | bash

It should be working now.

It installs a standalone 'patchperl' program with the latest Devel::PatchPerl, which incorporate patches for building on Ubuntu 11.04. The perlbrew executable now depends on patchperl to fix any building process.

Please give it a try sometime, thank you.

Reply to this email directly or view it on GitHub: https://github.com/gugod/App-perlbrew/issues/64#comment_1127160

Thanks and Regards, Sreekanth Kocharlakota M: 224.433.3277

punytan commented 13 years ago

@gugod, Thanks!

It works fine without one problem that ext/ODBM_File/hints/linux.pl checks hard-coded libgdbm path. (This problem should be fixed in patchperl or upstream, but I think here is more suitable for this discussion and useful for others.)

The path written in ext/ODBM_File/hints/linux.pl is:

if (-e '/usr/lib/libgdbm_compat.so' or -e '/usr/lib64/libgdbm_compat.so') {

but on my environment, libgdbm is located at /usr/lib/i386-linux-gnu/.

$ locate libgdbm | grep o$
/usr/lib/i386-linux-gnu/libgdbm.so
/usr/lib/i386-linux-gnu/libgdbm_compat.so

So the result of make test is:

../lib/User/pwent.t ............................................... ok
../lib/feature/unicode_strings.t .................................. ok
x2p/s2p.t ......................................................... ok

Test Summary Report
-------------------
op/stash.t                                                      (Wstat: 0 Tests: 31 Failed: 0)
  TODO passed:   26
../cpan/Memoize/t/errors.t                                      (Wstat: 11 Tests: 6 Failed: 0)
  Non-zero wait status: 11
  Parse errors: Bad plan.  You planned 11 tests but ran 6.
../ext/ODBM_File/t/odbm.t                                       (Wstat: 32512 Tests: 0 Failed: 0)
  Non-zero exit status: 127
  Parse errors: No plan found in TAP output
../lib/DBM_Filter/t/01error.t                                   (Wstat: 32512 Tests: 3 Failed: 0)
  Non-zero exit status: 127
  Parse errors: Bad plan.  You planned 21 tests but ran 3.
Files=1808, Tests=349977, 930 wallclock secs (73.67 usr 14.43 sys + 511.11 cusr 72.13 csys = 671.34 CPU)
Result: FAIL
make: *** [test_harness] Error 3

To pass tests, I rewrite ext/ODBM_File/hints/linux.pl like below,

if (-e '/usr/lib/libgdbm_compat.so' or -e '/usr/lib64/libgdbm_compat.so'
    or -e '/usr/lib/i386-linux-gnu/libgdbm.so' or -e '/usr/lib/i386-linux-gnu/libgdbm_compat.so'
) {

then run

 $ make clean && make && make test
 $ make install

works fine.

This problem is the same cause of Ubuntu 11.04's. And the path to the library vary in architecture. See also https://github.com/mirrors/perl/blob/blead/hints/linux.sh#L154

gnustavo commented 12 years ago

I'm facing what seems to be the same issue using Ubuntu 11.10, perlbrew 0.41 and trying to install perl-5.14.2. The error in build.log starts like this:

<...>
cc -fstack-protector -L/usr/local/lib -o miniperl \
          gv.o toke.o perly.o pad.o regcomp.o dump.o util.o mg.o reentr.o mro.o keywords.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+0x364e): undefined reference to `pow'
pp.o: In function `Perl_pp_modulo':
pp.c:(.text+0x4415): undefined reference to `floor'
pp.c:(.text+0x45af): undefined reference to `floor'
pp.c:(.text+0x4710): undefined reference to `fmod'
<...>

I tried to use with that option but the result was the same:

perlbrew install perl-5.14.2 -Dperllibs='-lm -lc'

This didn't work too:

perlbrew install perl-5.14.2 -Dperllibs='"-lm -lc"'
gugod commented 12 years ago

@gnustavo This should be solved already because perlbrew automatically calls "patchperl" now. Is it possible that's missing ? Do a which patchperl to locate it. If so, you should run cpanm Devel::PatchPerl to install it if your perlbrew is also installed from CPAN.

gnustavo commented 12 years ago

@gugod I have patchperl installed. See:

perl@gnu:~$ which patchperl
/opt/perl/perl5/perlbrew/bin/patchperl

I installed perlbrew with curl -kL http://install.perlbrew.pl | bash, not via CPAN.

gnustavo commented 12 years ago

@gugod You can download the complete build.log. I hope it can help you spot the problem. Thanks.

punytan commented 12 years ago

@gnustavo

This problem is already solved. You should install or make test perl manually (without perlbrew) to confirm the issue is caused by perlbrew or not.

gnustavo commented 12 years ago

@punytan You're right. I've tried to install perl-5.14.2 manually and it failed with the same message.

Thank you!

gnustavo commented 12 years ago

This is Perl's bug #100374. Just to let you know.

lucas1 commented 12 years ago

I'm having the same problem

build.log: http://pastebin.com/KETR1UEp

lucas1 commented 12 years ago

Solution http://bitsnoarame.blogspot.com.br/2012/03/perlbrew-em-ubuntu-1110.html

:)