in reply to Re: Can't Install/Use GDBM_File.pm
in thread Can't Install/Use GDBM_File.pm

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

Replies are listed 'Best First'.
Re^3: Can't Install/Use GDBM_File.pm
by perrin (Chancellor) on Sep 13, 2006 at 21:31 UTC
    You can probably just run the Makefile.PL for GDBM_File, rather than rebuild perl.

      Yup, if you're in a bind you can go into the ext/GDBM directory in the source tree and run Makefile.PL after the fact. It will get installed under site_perl rather than with the rest of the core modules, but it will work. (And in fact I did just this recently when it was discovered missing; fortunately had the original build directory lying around and it took a couple of minutes and an up2date --install gdbm-devel)

        I've overcome the problem -- solved would be too strong a word -- but it was quite a hack getting there. Disregarding the blind alleys and dead ends, this is what I did on two different systems (system details below):

        Went to a GNU mirror and downloaded a tarball of the latest version of gdbm.

        Unpacked that tarball, changed into the gdbm-1.8.3 directory, called ./configure and then make.

        Unfortunately, the Makefile so created is defective. On both systems on which I tried this, the Makefile contained this code:

        # File ownership and group BINOWN = bin BINGRP = bin

        This created problems when I later called make install. The install failed at these lines in the Makefile:

        ... which, when the variables were interpolated, came out as:

        /usr/bin/install -c -m 644 -o bin -g bin gdbm.h \ /usr/local/include/gdbm.h install: bin: Invalid argument make: *** [install] Error 67

        Since bin was nonexistent as either an owner or group-member, the install failed. I hacked around this by manually editing the Makefile to assign myself to the two variables:

        make install then succeeded.

        But there's more!

        As I reported yesterday, GDBM_File.pm was neither built nor tested when I installed Perl -- even though a test file for this module exists in the perl 5.8.8 distribution! Instead, once Perl was installed, I took up Fletch's suggestion, changed to the ext/GDBM_File directory under .cpan/build/perl-5.8.8, and tried to build GDBM_File from the Makefile.PLfound therein.

        perl Makefile.PL make

        So far, so good!

        [GDBM_File] 554 $ make test PERL_DL_NONLAZY=1 ../../perl "-MExtUtils::Command::MM" "-e" "test_harn +ess(0, 'blib/lib', 'blib/arch')" t/*.t t/gdbm....Can't locate Config.pm in @INC (@INC contains: ../lib) at t/ +gdbm.t line 8. BEGIN failed--compilation aborted at t/gdbm.t line 13. t/gdbm....dubious + Test returned status 2 (wstat 512, 0x200) FAILED--1 test script could be run, alas--no output ever seen make: *** [test_dynamic] Error 2

        Oops! To cut to the quick, t/gdbm.t has a hard-coded assignment to @INC:

        BEGIN { chdir 't' if -d 't'; @INC = '../lib'; require Config; import Config; if ($Config{'extensions'} !~ /\bGDBM_File\b/) { print "1..0 # Skip: GDBM_File was not built\n"; exit 0;

        But when I worked around this by providing a successful value for @INC, I got this:

        [GDBM_File] 574 $ prove -v t/gdbm.t t/gdbm....1..0 # Skip: GDBM_File was not built skipped all skipped: GDBM_File was not built All tests successful, 1 test skipped. Files=1, Tests=0, 0 wallclock secs ( 0.01 cusr + 0.02 csys = 0.03 C +PU)

        I was ready to throw in the towel, but I figured, "What the hell!", and called:

        [GDBM_File] 575 $ sudo make install Installing /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/auto/GDB +M_File/GDBM_File.bs Installing /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/auto/GDB +M_File/GDBM_File.bundle Files found in blib/arch: installing files in blib/lib into architectu +re dependent library tree Installing /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/GDBM_Fil +e.pm Writing /usr/local/lib/perl5/site_perl/5.8.8/darwin-2level/auto/GDBM_F +ile/.packlist Appending installation info to /usr/local/lib/perl5/5.8.8/darwin-2leve +l/perllocal.pod

        ... leading at long last to:

        [gdbm-1.8.3] 504 $ perl -MGDBM_File -e 'print "Hello world\n";' Hello world

        Now, is there anyone who can tell me why this process should have been so difficult? Setting aside the problem with GNU gdbm -- for which the Perl community is not responsible -- why is GDBM_File (and its C components) included in the Perl source distribution if it's not going to be installed in a typical installation?

        And this is not a problem with the OSes! Last night, in order to get a headstart on solving this problem at work today, I spent two hours trying to get GDBM_File installed on my Mac OS X 10.4 system at home. I decided to take the opportunity to upgrade from 5.8.7 to 5.8.8 and installed, in the default configuration, from source, as I have done several times previously. I again noted that, during make test, t/gdbm.t was passed over.

        And, once again, when Perl was done installing, GDBM_File was not working. Eventually I stumbled on the hack described above. Then I came to work this morning, booted my Ubuntu Linux box, and solved the problem on that box in exactly the same way as on my Mac!

        Why? Why? Why?

        Jim Keenan