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:

install: libgdbm.la gdbm.h gdbm.info $(srcdir)/mkinstalldirs $(INSTALL_ROOT)$(libdir) \ $(INSTALL_ROOT)$(includedir) $(INSTALL_ROOT)$(man3dir) \ $(INSTALL_ROOT)$(infodir) $(LIBTOOL) $(INSTALL) -c libgdbm.la $(INSTALL_ROOT)$(libdir)/libgd +bm.la $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) gdbm.h \ $(INSTALL_ROOT)$(includedir)/gdbm.h $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.3 \ $(INSTALL_ROOT)$(man3dir)/gdbm.3 $(INSTALL_DATA) -o $(BINOWN) -g $(BINGRP) $(srcdir)/gdbm.info \ $(INSTALL_ROOT)$(infodir)/gdbm.info

... 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:

BINOWN = jimk BINGRP = jimk

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.

ext/File/Glob/t/basic.....................ok ext/File/Glob/t/case......................ok ext/File/Glob/t/global....................ok ext/File/Glob/t/taint.....................ok ext/Filter/t/call.........................ok ext/I18N/Langinfo/t/Langinfo..............ok ext/IO/t/io_const.........................ok

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

In reply to Re^5: Can't Install/Use GDBM_File.pm by jkeenan1
in thread Can't Install/Use GDBM_File.pm by jkeenan1

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.