Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Configuring DynaLoader.pm

by dooberwah (Pilgrim)
on Jan 15, 2002 at 03:54 UTC ( [id://138766]=perlquestion: print w/replies, xml ) Need Help??

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

Greetings all

I think that I have to mention that this is my 42nd post. Let's all bow our heads and take a moment to remember Douglas Adams.

The problem:

I'm trying to learn how to interact with the MySQL database using perl. After following some of the tutorials in this very monastary I came up with this code:

#!/usr/bin/perl -w use strict; use DBI; my $dbh = DBI->connect('DBI:mysql:DB_NAME', 'USERNAME', 'PASSWORD') or die "Couldn't open database: $DBI::errstr; stopped"; my $sth = $dbh->prepare("SELECT date, time, title, text FROM thoughts +WHERE id = 3") or die "Couldn't prepare statment: $DBI::errstr; stopped"; $sth->execute() or die "Couldn't execute statement: $DBI::errstr; stop +ped"; while ( my ($date, $time, $title, $text) = $sth->fetchrow_array() ) { print STDOUT "date: $date time: $time\ntitle: $title\ntext:\n$text +"; } dbh->disconnect();

When I try to run this script I get these errors:

dooberwah@kyle:~$ perl perl/dbi.pl Can't load '/usr/local/lib/perl5/site_perl/5.6.1/i686-linux/auto/DBI/D +BI.so' for module DBI: libgcc_s.so.1: cannot open shared object file: + No such file or directory at /usr/local/lib/perl5/5.6.1/i686-linux/D +ynaLoader.pm line 206. at /usr/local/lib/perl5/site_perl/5.6.1/i686-linux/DBI.pm line 189 BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/5. +6.1/i686-linux/DBI.pm line 189. Compilation failed in require at perl/dbi.pl line 6. BEGIN failed--compilation aborted at perl/dbi.pl line 6. dooberwah@kyle:~$

As I looked at this for the first time I thought, "Hmmmm ... this DynaLoader thing is having some sort of problem. I better recompile it." After a quick search of CPAN I find that it comes bundled with Perl, and that I can't just re-download it from CPAN.

I'm not even sure about what to do in this situation. Just recompiling Perl seems like a cheap way to get around the problem, and I wouldn't ever find out what the real trouble was (if it actually did fix the problem worked). I was wondering if anybody knows how I can re-configure DynaLoader, and if that would actually help.

-Ben Jacobs (dooberwah)
http://dooberwah.perlmonk.org
"one thing i can tell you is you got to be free"

Replies are listed 'Best First'.
Re: Configuring DynaLoader.pm
by Masem (Monsignor) on Jan 15, 2002 at 04:26 UTC
    DynaLoader is just part of the error reporting mechanism. The problem appears to lie in the fact that the DBI shared library (DBI.so) seems to be missing, and thus, DBI cannot be loaded.

    You make want to check to see if you have this, as well as making sure that you have the right DBD driver for your database installed as well (in this case, DBD::Mysql). A quick visit to CPAN (use perl -MCPAN -e shell for a quicker trip) should get you up to speed.

    -----------------------------------------------------
    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
    "I can see my house from here!"
    It's not what you know, but knowing how to find it if you don't know that's important

Re: Configuring DynaLoader.pm
by Ineffectual (Scribe) on Jan 15, 2002 at 04:41 UTC
    To help decipher errors like this you can go to Dynaloader.pm in that path and go to line 206, which in my version (5.6.0 for solaris) has:
    croak("Can't load '$file' for module $module: ".dl_error()));
    I would say that you're missing DBI.so due to libgcc_s.so.1 which seems to be required for DBI.pm. So I'd say that DBI need to be reconfigured.

    'Fect
Re: Configuring DynaLoader.pm
by davis (Vicar) on Jan 15, 2002 at 17:03 UTC
    I believe I had a *slightly* similar problem while compiling DBI for HP-UX.
    IIRC, the solution's a little easier on Solaris, but I ended up statically linking DBI into the Perl executable, and linking libgcc into mysql - something that involved fiddling with the libtool script for mysql.
    Be warned: I'm not sure that this will solve your problem, so please consider it an option, rather than the only course of action
    Either way the MySQL Docs have some information that may be helpful
    Hope that helps
    davis

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://138766]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (7)
As of 2024-04-19 10:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found