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

I am having a helluva time trying to use GDBM_File.pm. I am using Ubuntu Linux. Perl 5.8.7 came with the system, and GDBM_File came with that:

[t] 512 $ find /usr/lib/perl/5.8.7 -name '*GDBM_File*' /usr/lib/perl/5.8.7/GDBM_File.pm /usr/lib/perl/5.8.7/auto/GDBM_File /usr/lib/perl/5.8.7/auto/GDBM_File/GDBM_File.so /usr/lib/perl/5.8.7/auto/GDBM_File/GDBM_File.bs

Almost as soon as I started working with this system, I upgraded to Perl 5.8.8, building from source. Today, for the first time, I needed to use GDBM_File.pm in a job. Whenever I try to use it, I get this failure message:

[t] 508 $ perl -MGDBM_File -e 'print "Hello world\n";' Can't locate GDBM_File.pm in @INC (@INC contains: /home/jimk/lib/perl +/usr/local/lib/perl5/5.8.8/i686-linux /usr/local/lib/perl5/5.8.8 /usr +/local/lib/perl5/site_perl/5.8.8/i686-linux /usr/local/lib/perl5/site +_perl/5.8.8 /usr/local/lib/perl5/site_perl .). BEGIN failed--compilation aborted.

When I include the vendor's Perl path, I get a different error message:

[t] 511 $ perl -I/usr/lib/perl/5.8.7 -MGDBM_File -e 'print "Hello worl +d\n";' Can't load '/usr/lib/perl/5.8.7/auto/GDBM_File/GDBM_File.so' for modul +e GDBM_File: /usr/lib/perl/5.8.7/auto/GDBM_File/GDBM_File.so: undefin +ed symbol: Perl_croak_nocontext at /usr/lib/perl/5.8.7/XSLoader.pm li +ne 68. at /usr/lib/perl/5.8.7/GDBM_File.pm line 83 Compilation failed in require. BEGIN failed--compilation aborted.

With the help of an experienced Perl hacker, I have rebuilt Perl 5.8.8 three times today -- to no avail. The GDBM_File-related files seem simply to get trashed:

[t] 514 $ find ~/.Trash/perl-5.8.8/ -name '*GDBM_File*' /home/jimk/.Trash/perl-5.8.8/ext/GDBM_File /home/jimk/.Trash/perl-5.8.8/ext/GDBM_File/GDBM_File.pm /home/jimk/.Trash/perl-5.8.8/ext/GDBM_File/GDBM_File.xs

Also, while watching the steps in the installation process scroll by, it seemed that when it was going through the ext/ directory, it was skipping from 'F' (as in File) to 'I' (as in IO) without touching on any files beginning with 'G'.

Does anyone know what's going wrong? TIA.

Jim Keenan

Replies are listed 'Best First'.
Re: Can't Install/Use GDBM_File.pm
by Fletch (Bishop) on Sep 13, 2006 at 20:55 UTC

    The GDBM_File module is part of the core distribution. If you have the GDBM libraries installed and where Perl's configure process can find them, it should be built when you build perl automagically.

    If it's not, you need to make sure that you have the headers and the gdbm libraries properly installed; for instance on RedHat-ish distributions you'll need to also install the gdbm-devel package as well as gdbm itself. I don't know for sure about Ubuntu but there may be something similar you need to install.

Re: Can't Install/Use GDBM_File.pm
by perrin (Chancellor) on Sep 13, 2006 at 20:56 UTC
    I'm guessing your system doesn't have gdbm, or doesn't have the header files required to build against it. On Red Hat, there is a gdbm package and a gdbm-devel one. Debian probably has something similar that you need to install before you can build GDBM_File.
      Fletch & Perrin:

      I (re-)installed the gdbm files from Ubuntu. I'll try to rebuild Perl tomorrow to see what happens. Thanks for looking into this.

      Jim Keenan
        You can probably just run the Makefile.PL for GDBM_File, rather than rebuild perl.
Re: Can't Install/Use GDBM_File.pm
by Khen1950fx (Canon) on Sep 13, 2006 at 22:00 UTC
    You probably have gdbm installed, but Perl can't find the libraries because they weren't linked right. I've had similar problems. What I would do is download and reinstall gdbm. After you finish make install, you have to run ldconfig. On my system I run /sbin/ldconfig /usr/local/lib. Most libraries go into /usr/local/lib, but check to see if the libraries were put somewhere else. Sometimes they'll be in /usr/lib, etc.