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

Specifically zeroing in on Sleepycat libdb-3.1. I am so close I can smell it but need your help.

I build perl thusly:
 sh Configure -de -Dldflags='-L/opt/lib' -Dlibpth='/opt/lib /lib /usr/lib' -Dprefix=/opt -Duselargefiles='undef'
 make depend
 make
 make test
 make install
When I check dynamic linking I see -
 ldd /opt/bin/perl
   libnsl.so.1 => /lib/libnsl.so.1 (0x4001a000)
   libdb.so.3 => /lib/libdb.so.3 (0x40030000)
   libgdbm.so.2 => /usr/lib/libgdbm.so.2 (0x4006a000)
   libdb-3.1.so => /opt/lib/libdb-3.1.so (0x40070000)
   libdl.so.2 => /lib/libdl.so.2 (0x400d6000)
   libm.so.6 => /lib/libm.so.6 (0x400da000)
   libc.so.6 => /lib/libc.so.6 (0x400f7000)
   libcrypt.so.1 => /lib/libcrypt.so.1 (0x401ec000)
   /lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x40000000)
What I wanna see is:
   libdb.so.3 => /opt/lib/libdb.so.3
How do I make this so?

Thanks in advance

  • Comment on Where's the library? Building Perl with alternate libdb probs!

Replies are listed 'Best First'.
Re: Where's the library? Building Perl with alternate libdb probs!
by merlyn (Sage) on Sep 14, 2000 at 21:55 UTC
    Well, there's been a recent thread on P5P about how -ldb needs to be removed from one of Perl's build Configure scripts so that it can be dynloaded rather than statically loaded. I don't understand the entire problem, but perhaps you could go back through the perl5-porters archive, or look into Configure to wherever -ldb appears and see if it's in the wrong place. {grin}

    -- Randal L. Schwartz, Perl hacker

Answer to RE: Where's the library? Building Perl with alternate libdb probs!
by jlawrenc (Scribe) on Sep 16, 2000 at 20:11 UTC
    1 - Thanks to Randal for pointing me to Perl Porters Mailing List - this is the source for all of your Perl building answers.

    2 - The problem is that they have added a whole pack of "libswanted" to Configure in Perl 5.6. This means that when Configure runs it is going to scan through the lib path and link perl against any of those libs that are found. I anticipate this will change again for 5.7 as the amount of linking libs to the main perl binary is excessive for most platforms.

    So what? You ask. Well if you have different instances of a library you might not get the instance you want. In my case I am building on a RedHat 6.2 box. Why RedHat felt it a smart idea to symlink libdb-3.0 to libdb-2.0 and then link programs against libdb-3 when they really wanted libdb-2 is beyond me.

    788401 Feb 29 2000 /lib/libdb-2.1.3.so 15 Aug 1 16:28 /lib/libdb.so.2 -> libdb1-2.1.3.so 14 Aug 1 16:28 /lib/libdb.so.3 -> libdb-2.1.3.so 221411 Feb 29 2000 /lib/libdb1-2.1.3.so 15 Aug 1 16:28 /lib/libdb1.so.2 -> libdb1-2.1.3.so
    I want all of the glamour that BerkeleyDB 3 has to offer. Transactions, locking, yadda, yadda. So trying to one-up RedHat I download db-3.1.17 and, successfully, make it. All of my attempts to make Perl 5.6 NOT link against RedHat's funky /lib/libdb-3 and against my wonderful /opt/lib/libdb-3 fail fail fail. Why???? This worked with Perl 5.005*! Leave that damn lib alone.

    Alas, finally getting my answer, I remove "db" from a libswanted assignment in Configure and rebuild my perl (*again*) this time holding my breath the entire time. (If I was building on a 386 I might not be alive to write this ... thank god for faster processors).

    ldd happily reports that the main perl binary is NOT linking against any libdb. (YES!) So I run off and build the BerkeleyDB module and make test works!!!! Yaaaah.

    Now, how did I do all of this?????

    My build for BerkeleyDB 3.1.17 shared lib:

    cd ../db/dist; make distclean >/dev/null; ./configure --enable-shared \ --prefix=/opt >/opt/src/config/logs/db-config; make >/opt/src/config/logs/db.shared; make test >/opt/src/config/logs/db.shared-test; make install >/opt/src/config/logs/db.shared-install
    My build for perl on Linux:
    make distclean >/dev/null sh Configure -de -Dprefix=/opt -Duselargefiles='undef' \ >/opt/src/config/logs/perl-config make depend >/dev/null make >/opt/src/config/logs/perl-build make test >/opt/src/config/logs/perl-test make install >/opt/src/config/logs/perl-install
    My build for BerkeleyDB module:
    BERKELEYDB_INCLUDE=/opt/include; export BERKELEYDB_INCLUDE BERKELEYDB_LIB=/opt/include; export BERKELEYDB_LIB /opt/bin/perl -MCPAN -e 'install BerkeleyDB'
    Why I am taking so much time and detail to explain this? Well I have burned HOURS of my time trying to get this software combo to work and build properly. I hope I can save someone else that time in the future. That someone I save will burn HOURS on another problem but will remember this and do the same thing when they finally solve that other issue.

    Jay