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

Hi all, At the outset I thank you for everybody's help and support. I am back again with some cpan module questions. I installed some cpan modules locally on a sun sparc4 machine without super user previlages. I fllowed technical documentation on that. Everything went great. But when I tried to use them I am getting an error ld.so.1: perl: fatal: relocation error: I installed the first module(prerequisite for the second module) locally in my home directory. To install the second module I need to tell perl where I have the first one installed. So I executed the following command  setenv PERL5LIB /home/xf023126/lib/perl5:/home/xf023126/lib/perl5/site_perl:/apps/perl/5.8.0/lib After executing this command I could succesfully install the second module. Now when I try  perl -V I get the following
Characteristics of this binary (from libperl): Built under solaris Compiled at Dec 22 1999 00:00:57 %ENV: PERL5LIB="/home/xf023126/lib/perl5:/home/xf023126/lib/perl5/site_p +erl:/apps/perl/5.8.0/lib" @INC: /home/xf023126/lib/perl5 /home/xf023126/lib/perl5/site_perl /apps/perl/5.8.0/lib /usr/perl5/5.00503/sun4-solaris /usr/perl5/5.00503 /usr/perl5/site_perl/5.005/sun4-solaris /usr/perl5/site_perl/5.005
My perl code starts like this.
#! /apps/perl/5.8.0/bin/perl -w use strict; use lib qw(/home/xf023126/lib/perl5 /home/xf023126/lib/perl5/site_perl +); use HTML::TokeParser::Simple;
When I triy to run it I get the following error.
ld.so.1: perl: fatal: relocation error: file /home/xf023126/lib/perl5/ +site_perl/auto/HTML/Parser/Parser.so: symbol Perl_Tstack_sp_ptr: refe +renced symbol not found Killed
I checked the folder /home/xf023126/lib/perl5/site_perl/auto/HTML/Parser for the Parser.so, and I found it there. I can't figure out why I have a problem? Can anyone suggest how I can fix this? Thanks in advance, Augustine

Replies are listed 'Best First'.
Re: ld.so.1: perl: fatal: relocation error
by PodMaster (Abbot) on Nov 16, 2004 at 04:17 UTC
    /apps/perl/5.8.0/lib
    ...
    /usr/perl5/5.00503
    That is a red flag (when perl -V:multiarch returns undef). Perl 5.5.x is not compatible with 5.8.x, so any .so files compiled with one perl aren't compatible with the other.
    I checked the folder /home/xf023126/lib/perl5/site_perl/auto/HTML/Parser for the Parser.so, and I found it there. I can't figure out why I have a problem?
    The error message says it all Parser.so: symbol Perl_Tstack_sp_ptr: referenced symbol not found. It means that Parser.so is linked with a perl (that is linked with a libperl.so ) that defined the Perl_Tstack_sp_ptr symbol, but the perl that is trying to load Parser.so has no such symbol. If you check your libperl.so.5.5 for Perl_Tstack_sp_ptr you won't find it, but you will in libperl.so.5.8. You can't mix your perls like that. You need to make sure the perl you're running your script with is the same perl you compiled your modules with.

    PS - ld.so is the dynamic linker/loader.

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      Thank you very much PodMaster. I compiled the module with new version of perl and it works fine now. Augustine
Re: ld.so.1: perl: fatal: relocation error
by tachyon (Chancellor) on Nov 16, 2004 at 02:40 UTC

    To install HTML parser locally (non super user) I would do:

    cd ~ mkdir perl_lib cd HTML-Parser-XXXX perl Makefile.PL PREFIX=~/perl_lib LIB=~/perl_lib make && make test && make install cd ~ setenv PERL5LIB ~/perl_lib cd HTML-TokeParser-Simple-XXXX perl Makefile.PL PREFIX=~/perl_lib LIB=~/perl_lib make && make test && make install

    The key part is setting the LIB as the binaries go there. Now in your script you just:

    #!/usr/bin/perl use lib '/home/your_username/perl_lib'; use HTML::TokeParser::Simple;

    cheers

    tachyon