develooper Front page | perl.perl5.porters | Postings from September 2000

[Patch 5.7.0] Removing -ldb from the core build

From:
Paul Marquess
Date:
September 2, 2000 15:55
Subject:
[Patch 5.7.0] Removing -ldb from the core build
Message ID:
000401c01530$b2e5ec00$1314140a@bfs.phone.com
The Problem
-----------

 * Linux ships with libdb, i.e Berkeley DB

 * The perl binary *always* links libdb if it can find it.

On newer versions of Linux (RedHat 6, SuSe 6 etc) this makes it is very
difficult to subsequently build either DB_File or BerkeleyDB (the Perl
module) using a version of libdb that is different from the one that ships
with the Linux distribution.

Previously I had thought that the problem was down to libc including a link
to libdb, but Frank Ridderbusch (frank.ridderbusch@fujitsu-siemens.com) was
able to accomplish it by removing all references to -ldb (and its close dbm
cousins) from config.sh. Perl then gets built without a reference to libdb
and any subsequent build of DB_File/BerkeleyDB with a newer/older version of
Berkeley DB works fine.

As an aside, I know I tried this approach myself a few months ago, but it
didn't work for me then. I think I forgot to remove ndbm from the equation.

The Solution?
-------------

I've included a tentative patch for 5.7.0 that removes -ldb & -lndbm from
the libs in Configure once it has finished using them. I've made the code
only do this when the osname is linux.

I'm fairly happy that this approach is ok for recent versions of linux (I
have RedHat 5 & 6), but I would appreciate some feedback from folk with
other versions of Linux, especially older versions.

cheers
Paul

*** Configure.keep	Sat Sep  2 00:51:01 2000
--- Configure	Sat Sep  2 01:51:35 2000
***************
*** 12488,12493 ****
--- 12488,12514 ----
  	;;
  esac

+ : remove -ldb & -lndbm from libs if this is Linux
+ case "$osname" in
+     linux)
+ 	case " $libs " in
+ 	    *"-ldb "*)
+ 		echo "Removing -ldb from library list" >&4
+ 		set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
+ 		shift
+ 		libs="$*"
+ 		echo "libs = $libs" >&4
+ 	esac
+ 	case " $libs " in
+ 	    *"-lndbm "*)
+ 		echo "Removing -lndbm from library list" >&4
+ 		set `echo X $libs | $sed -e 's/-lndbm / /' -e 's/-lndbm$//'`
+ 		shift
+ 		libs="$*"
+ 		echo "libs = $libs" >&4
+ 	esac
+ esac
+
  : check for void type
  echo " "
  echo "Checking to see how well your C compiler groks the void type..." >&4



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About