[redland-dev] Using Perl Bindings on Shared Host
Dave Beckett
dave.beckett at bristol.ac.uk
Fri Aug 19 23:29:56 BST 2005
On Fri, 19 Aug 2005, Chris Murphy wrote:
> Hello,
> I've written a simple perl script using the librdf bindings, and it works
> fine (and as expected) from the shell. My problem is that I am attempting to
> use it as a CGI, on a shared webhost. That host did not have redland
> installed, so I compiled it from source, along with the bindings. The
> problem is that initially the script refuses to run at all, citing that it
> can't find RDF/Redland.pm as expected. I solved this problem by adding some
> -I /home/myStuff/... parameters to the shebang line.
>
> The problem that eventually stops me dead in my tracks is that DynaLoader
> doesn't seem able to find librdf.so.0 when it goes to load the CORE modules
> (specifically on line 7 of CORE.pm). I've tried putting the path in a -I
> parameter, I've tried setting LD_LIBRARY_PATH in the environment, I've tried
> playing with @dl_library_path for DynaLoader, though I'm sure I wasn't doing
> that correctly. I'm not 100% sure that I've successfully set LD_LIBRARY_PATH
> for the cgi, but I've tried several times, including a few ways inside of
> the perl script itself (before use 'RDF::Redland'). Does anybody know the
> 'right' approach to solving this?
What you probably need is a BEGIN block - which runs before 'use' happens,
as it's part of the perl compile/interpret stage.
Something like (untested, copying from somewhere else):
BEGIN {
$ENV{'LD_LIBRARY_PATH'}='/path/to/lib';
unshift(@INC, "/path/to/prefix/lib/perl5/site_perl/5.8.4/i386-linux");
unshift(@INC, "/path/to/prefix/lib/perl5/site_perl/5.8.4");
}
use RDF::Redland;
...
you can probably tweak the oaths
> Again, the script works fine from the command prompt by setting
> LD_LIBRARY_PATH, but I can't make it work as a CGI. I'm new to Perl (but it
> seems to be the only possible language given my hosting situation) but
> relatively experienced otherwise. Thoughts?
>
> - chrismurf
>
> ================================
> Can't load '/home/[edit]/perl/5.6.1/auto/RDF/Redland/CORE.so' for module
> RDF::Redland::CORE: librdf.so.0: cannot open shared object file: No such
> file or directory at /usr/lib/perl/5.6.1/DynaLoader.pm line 202.
> at /home/[edit]/perl/5.6.1/RDF/Redland/CORE.pm line 7
> Compilation failed in require at /home/[edit]/lib/perl/5.6.1/RDF/Redland.pm
> line 39.
Dave
More information about the redland-dev
mailing list