rajivgup has asked for the wisdom of the Perl Monks concerning the following question:

My existing project is using IO module, project works fine on RedHat 8(2.4.28). Where same project on my Ubuntu (linux 2.6.28) gives me error undefined symbol: PL_curpad.

0090617 165428 [00_ntest_sharedconsole] <<rajivg-vsim1#console|Can't load '/usr/local/lib/perl5/5.8.9/i686-linux/auto/IO/IO.so' for module IO: /usr/local/lib/perl5/5.8.9/i686-linux/auto/IO/IO.so: undefined symbol: PL_curpad at /usr/local/lib/perl5/5.8.9/i686-linux/XSLoader.pm line 70.\r\n 20090617 165428 [00_ntest_sharedconsole] <<rajivg-vsim1#console| at /usr/local/lib/perl5/5.8.9/i686-linux/IO.pm line 11\r\n 20090617 165428 [00_ntest_sharedconsole] <<rajivg-vsim1#console|Compilation failed in require at /usr/local/lib/perl5/5.8.9/i686-linux/IO/Handle.pm line 266.\r\n 20090617 165428 [00_ntest_sharedconsole] <<rajivg-vsim1#console|BEGIN failed--compilation aborted at /usr/local/lib/perl5/5.8.9/i686-linux/IO/Handle.pm line 266.\r\n 20090617 165428 [00_ntest_sharedconsole] <<rajivg-vsim1#console|Compilation failed in require at /usr/software/lib/perl5/site_perl/5.8.8/i686-linux-thread-multi/IO/Tty +.pm line 6.\r\n 20090617 165428 [00_ntest_sharedconsole] <<rajivg-vsim1#console|BEGIN failed--compilation aborted at /usr/software/lib/perl5/site_perl/5.8.8/i686-linux-thread-multi/IO/Tty +.pm line 6.\r\n 20090617 165428 [00_ntest_sharedconsole] <<rajivg-vsim1#console|Compilation failed in require at /usr/software/lib/perl5/site_perl/5.8.8/i686-linux-thread-multi/IO/Pty +.pm line 7.\r\n 20090617 165428 [00_ntest_sharedconsole] <<rajivg-vsim1#console|BEGIN failed--compilation aborted at /usr/software/lib/perl5/site_perl/5.8.8/i686-linux-thread-multi/IO/Pty +.pm line 7.\r\n 20090617 165428 [00_ntest_sharedconsole] <<rajivg-vsim1#console|Compilation failed in require at /usr/local/lib/perl5/site_perl/5.8.9/Expect.pm line 22.\r\n 20090617 165428 [00_ntest_sharedconsole] <<rajivg-vsim1#console|BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5.8.9/Expect.pm line 22.

Originally project was running fine on RHEL5 U8 Linux kernal 2.4.20.

The main difference I see here is GNU C library version. The current version of libc is 2.9.

rajivg@rajivg-lux:/u/rajivg/nate_logs/latest$ /lib/libc.so.6 GNU C Library stable release version 2.9, by Roland McGrath et al. Copyright (C) 2008 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. Compiled by GNU CC version 4.3.3. Compiled on a Linux >>2.6.24-23-server<< system on 2009-04-09. Available extensions: crypt add-on version 2.1 by Michael Glad and others GNU Libidn by Simon Josefsson Native POSIX Threads Library by Ulrich Drepper et al BIND-8.2.3-T5B For bug reporting instructions, please see: <http://www.gnu.org/software/libc/bugs.html>.

It is working fine on release 2.2

NU C Library development release version 2.2.93, by Roland McGrath et al. Copyright (C) 1992-2001, 2002 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. Compiled by GNU CC version 3.2 20020903 (Red Hat Linux 8.0 3.2-7). Compiled on a Linux 2.4.9-9 system on 2002-09-05. Available extensions: GNU libio by Per Bothner crypt add-on version 2.1 by Michael Glad and others The C stubs add-on version 2.1.2. linuxthreads-0.10 by Xavier Leroy BIND-8.2.3-T5B NIS(YP)/NIS+ NSS modules 0.19 by Thorsten Kukuk Glibc-2.0 compatibility add-on by Cristian Gafton libthread_db work sponsored by Alpha Processor Inc Report bugs using the `glibcbug' script to <bugs@gnu.org>.

The PL_curpad is undefined symbol in case of UBUNTU whereas it is not defined in RHEL.

rajivg@rajivg-lux:/u/rajivg/nate_logs/latest$ nm /usr/local/lib/perl5/5.8.9/i686-linux/auto/IO/IO.so | grep PL_curpad

U PL_curpad

I have compiled IO on my ubuntu without any problem, I have tried both standard and manual installation.

The perl version/distribution I'm using is 5.8.9 (ubuntu) and 5.8.8 (onRedHat). I cannot install 5.10 as my whole project is supporting only 5.8.8.

rajivg@rajivg-lux:/u/rajivg/nate_logs/latest$ perl -v
This is perl, v5.8.9 built for i686-linux

Copyright 1987-2008, Larry Wall

Perl may be copied only under the terms of either the

Artistic License or the GNU General Public License, which may be found in the Perl 5 source kit.

Output of uname -a:

Linux rajivg-lux 2.6.28-11-generic #42-Ubuntu SMP Fri Apr 17 01:57:59 UTC 2009 i686 GNU/Linux

Please let me know if any solution/workaround for this problem.

Thanks, Rajiv Gupta

Replies are listed 'Best First'.
Re: IO Module failed to load with error undefined symbol: PL_curpad
by ikegami (Patriarch) on Jun 22, 2009 at 14:15 UTC
    Did you build the module with 5.8.9 and tried to use it with 5.8.8? When creating a package, you need to build with an equal or earlier version. For example, a module built with 5.8.0 will work with all 5.8 releases, but a module built with 5.8.9 is only guaranteed to be loadable by 5.8.9 (and later if there's ever another 5.8 release).
      Thanks to everyone who replied. I found the problem and solution, my libperl.a was messed up. It was showing multiple instances of PL_curpad definition. Don't know the reason how it happened. So finally I have to re-build my Perl, I tried to just build and replace my existing libperl.a but did not work :(. I have to fully replace my installation. Now I have to reinstall many modules which required for my project :(

      Thanks, Rajiv Gupta

Re: IO Module failed to load with error undefined symbol: PL_curpad
by rovf (Priest) on Jun 22, 2009 at 13:35 UTC

    Though I can't tell you a workaround, I suspect that the Perl installation on your Ubuntu system is broken. I googled for PL_curpad, and found that it is supposed to be defined within Perl (see for example http://cpansearch.perl.org/src/NWCLARK/perl-5.8.9/pad.c or http://linux.about.com/library/cmd/blcmdl1_perlintern.htm. Did you compile Perl there by yourself? Also, it might be worth doing a recursive grep on the source files of Perl 5.8.8 to see where PL_curpad is supposed to be defined, and compare this file to the 5.8.9 version.

    -- 
    Ronald Fischer <ynnor@mm.st>

        Hmmm.... the grep on 5.8.9 shows that PL_curpad is #defineed. If you get the error "symbol missing" for this name, this means that one of the generated files does not see the header file where this symbol is defined. Further, it means that a K&R (i.e. non-ANSI) C compiler has been used, otherwise this would have failed already when making Perl.

        Just a wild guess: Since the differences between 5.8.8 and 5.8.9 are huge WRT PL_curpad, could it be that Perl on your Ubuntu machine somehow (maybe via PERL5LIB) finds a version of that module which had been compiled for a different platform? Did you try to recreate Perl from scratch, from the sources?

        -- 
        Ronald Fischer <ynnor@mm.st>