Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

"Can't locate loadable object" - but it's there

1,352 views
Skip to first unread message

Ernest Mueller

unread,
Jan 8, 2003, 6:06:09 PM1/8/03
to
I'm having a strange problem with a Perl 5.005_03 CGI script (Apache
1.3.26 + mod_ssl on Solaris 8). It's generating the error message:

Can't locate loadable object for module XML::Parser::Expat in @INC
(@INC contains: /opt/webfiles/cgi-bin
/usr/local/lib/perl5/5.6.1/sun4-solaris
/usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl .) at
/usr/local/lib/perl5/site_perl/XML/Parser.pm line 15
Compilation failed in require at
/usr/local/lib/perl5/site_perl/XML/Parser.pm line 15.

However, in /usr/local/lib/perl5/site_perl/XML/Parser is a perfectly
good Expat.pm. Permissions on it and directories above it look fine.

What's really weird is that this is one of two machines running in a
load balancing configuration - and the other one works running the
same CGI. They appear to have the same code, Perl (checked with -V),
libraries, OS, Apache, file permissions, etc. on them - but this box
is giving a spurious "can't locate" error while the other isn't.

It isn't even the CGI code itself but XML::Parser that is requiring
Expat, so the CGI is finding
/usr/local/lib/perl5/site_perl/XML/Parser.pm just fine. But then it
can't, in turn, load Expat.pm.

Any ideas what could be causing this?

Thanks,
Ernest Mueller

Benjamin Goldberg

unread,
Jan 8, 2003, 7:00:45 PM1/8/03
to
Ernest Mueller wrote:
>
> I'm having a strange problem with a Perl 5.005_03 CGI script (Apache
> 1.3.26 + mod_ssl on Solaris 8). It's generating the error message:
>
> Can't locate loadable object for module XML::Parser::Expat in @INC
[snip]

> However, in /usr/local/lib/perl5/site_perl/XML/Parser is a perfectly
> good Expat.pm. Permissions on it and directories above it look fine.

The "loadable object" it is looking for is not Expat.pm -- that is
merely a perl module file.

"Loadable objects" are the same as "shared objects", ".so" files.
They're also known as "Dynamically Linked Libraries", ".dll" files.

The error message is indicating that it cannot find either an Expat.so
or an Expat.dll anywhere in @INC.

This would be caused if you did not actually *install* Expat, but
instead merely copied the Expat.pm file into place, without realizing
that this was only half of what's needed.

--
$..='(?:(?{local$^C=$^C|'.(1<<$_).'})|)'for+a..4;
$..='(?{print+substr"\n !,$^C,1 if $^C<26})(?!)';
$.=~s'!'haktrsreltanPJ,r coeueh"';BEGIN{${"\cH"}
|=(1<<21)}""=~$.;qw(Just another Perl hacker,\n);

Ernest Mueller

unread,
Jan 9, 2003, 5:17:33 PM1/9/03
to
Benjamin Goldberg wrote:
> Ernest Mueller wrote:
> >
> > I'm having a strange problem with a Perl 5.005_03 CGI script (Apache
> > 1.3.26 + mod_ssl on Solaris 8). It's generating the error message:
> >
> > Can't locate loadable object for module XML::Parser::Expat in @INC
> >
> > However, in /usr/local/lib/perl5/site_perl/XML/Parser is a perfectly
> > good Expat.pm. Permissions on it and directories above it look fine.
>
> The "loadable object" it is looking for is not Expat.pm -- that is
> merely a perl module file.
>
> The error message is indicating that it cannot find either an Expat.so
> or an Expat.dll anywhere in @INC.

Good call. I found Expat.so (and an Expat.bs) down in
/usr/local/lib/perl5/site_perl/sun4-solaris/auto/XML/Parser/Expat/Expat.so.
This isn't explicitly in my @INC:

@INC:
/usr/local/lib/perl5/5.6.1/sun4-solaris
/usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl/5.6.0/sun4-solaris
/usr/local/lib/perl5/site_perl/5.6.0
/usr/local/lib/perl5/site_perl

But according to the "lib" perldoc page it should also be looking for
$dir/$archname/auto for each of these directories - which would
therefore find this file for me.

It's in the same place on the working box... And permissions all look
good.

Any other ideas?

Thanks,
Ernest

Ernest Mueller

unread,
Jan 10, 2003, 10:57:59 AM1/10/03
to
To sum up:

I'm having a problem with a Perl script on Solaris 8. It was generating the
error message:

Can't locate loadable object for module XML::Parser::Expat in @INC

Benjamin Goldberg wisely pointed out that it wasn't looking for Expat.pm,
which was in the @INC path, but Expat.so, as "loadable module" is Perl-speak
for shared library. My shared library is in
/usr/local/lib/perl5/site_perl/sun4-solaris/auto/XML/Parser/Expat/Expat.so.
This isn't explicitly in my @INC, but /usr/local/lib/perl5/site_perl is.

According to the "lib" perldoc page perl should also be looking for
$dir/$archname/auto for each of the directories in @INC - which would
therefore find this file for me. It's not. I added
/usr/local/lib/perl5/site_perl/sun4-solaris explicitly to my @INC path, and
now perl sees the .so. I have confirmed with perl -V that $arch is
sun4-solaris on my box. So, that's one thing not working that should.

Now I have another problem. perl sees the shared library, but can't load
it, giving the error:

Can't load
'/usr/local/lib/perl5/site_perl/sun4-solaris/auto/XML/Parser/Expat/Expat.so'
for module XML::Parser::Expat: ld.so.1: /usr/local/bin/perl: fatal:
relocation error: file
/usr/local/lib/perl5/site_perl/sun4-solaris/auto/XML/Parser/Expat/Expat.so:
symbol Perl_stack_sp: referenced symbol not found at
/usr/local/lib/perl5/5.6.1/sun4-solaris/DynaLoader.pm line 206.

Here's my perl -V, if it helps:

bash-2.03$ /usr/local/bin/perl -V
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
Platform:
osname=solaris, osvers=2.8, archname=sun4-solaris
uname='sunos devnull 5.8 generic_108528-06 sun4u sparc sunw,ultra-4 '
config_args=''
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='gcc', ccflags
='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFS
ET_BITS=64',
optimize='-O2',
cppflags='-fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.95.2 19991024 (release)',
gccosandvers='solaris2.8'
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='gcc', ldflags =' -L/usr/local/lib '
libpth=/usr/local/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc
perllibs=-lsocket -lnsl -ldl -lm -lc
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'


Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under solaris
Compiled at Jul 10 2001 14:47:52


@INC:
/usr/local/lib/perl5/5.6.1/sun4-solaris
/usr/local/lib/perl5/5.6.1
/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl/5.6.0/sun4-solaris
/usr/local/lib/perl5/site_perl/5.6.0
/usr/local/lib/perl5/site_perl

.

Any ideas?

Thanks,
Ernest Mueller


Benjamin Goldberg

unread,
Jan 10, 2003, 10:50:56 PM1/10/03
to
Ernest Mueller wrote:
[snip]

> Now I have another problem. perl sees the shared library, but can't
> load it, giving the error:
>
> Can't load
> '/usr/local/lib/perl5/site_perl/sun4-solaris/auto/
> XML/Parser/Expat/Expat.so'
> for module XML::Parser::Expat: ld.so.1: /usr/local/bin/perl: fatal:
> relocation error: file
> /usr/local/lib/perl5/site_perl/sun4-solaris/auto/
> XML/Parser/Expat/Expat.so:
> symbol Perl_stack_sp: referenced symbol not found at
> /usr/local/lib/perl5/5.6.1/sun4-solaris/DynaLoader.pm line 206.
[snip]
> Any ideas?

This indicates that the Expat.so which you are using was not compiled
with the version of perl you have on your machine.

The proper fix is to reinstall the XML-Parser-2.31.tar.gz distribution.

You should probably do this with:
perl -MCPAN -e "install('XML-Parser')"

0 new messages