|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23606 Unable to build --with-db4 (db4.1.25)
Submitted: 2003-05-13 08:34 UTC Modified: 2004-09-25 17:33 UTC
From: tommi dot komulainen at iki dot fi Assigned: helly (profile)
Status: Closed Package: Compile Failure
PHP Version: 4.3.9,5.0.2 OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: tommi dot komulainen at iki dot fi
New email:
PHP Version: OS:


 [2003-05-13 08:34 UTC] tommi dot komulainen at iki dot fi
The configure script is unable to find the db4 in the system, because it isn't
taking into account #defines such as the following in /usr/include/db.h:

#define db_create db_create_4001

The library does not contain unversioned symbols and therefore the configure
script needs to #include the db.h to be able to make proper checks for the
versioned symbols.

Replacing the AC_CHECK_LIB with somewhat similar AC_TRY_LINK should do the
trick.  See the following patch (I've only tried it with db4.1, I don't know if
the function signature is the same for older versions, but I'd think so.)

--- ext/dba/config.m4.orig	2003-04-14 00:05:41.000000000 +0300
+++ ext/dba/config.m4	2003-05-13 16:15:37.000000000 +0300
@@ -136,17 +136,19 @@
   for LIB in $2; do
     if test -f $THIS_PREFIX/lib/lib$LIB.a -o -f $THIS_PREFIX/lib/lib$LIB.$SHLIB_SUFFIX_NAME; then
-        AC_CHECK_LIB($LIB, $3, [
-          AC_EGREP_CPP(yes,[
+	AC_MSG_CHECKING(db_create in $LIB)
+        AC_TRY_LINK([
 #include "$THIS_INCLUDE"
-            yes
-          ],[
-            THIS_LIBS=$LIB
-            break
-          ])
-        ])
+	],[
+(void)db_create((DB**)0, (DB_ENV*)0, 0);
+	],[
+	  AC_MSG_RESULT(yes)
+	  break
+	],[
+	])


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-05-13 16:04 UTC]
First thanks for directing me to an error.

Second please keep my code inside it's there for a reason
and then make up a new patch. But i'm on it.
 [2003-05-14 01:28 UTC]
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at
In case this was a documentation problem, the fix will show up soon at

In case this was a website problem, the change will show
up on the site and on the mirror sites in short time.
Thank you for the report, and for helping us make PHP better.

 [2003-11-21 09:34 UTC] magnus at goransson dot org
If you are using PHP-4.3.4 with db-4.1.25 make sure that you have db-4.1.25 (Berkeley DB) compiled with "LIBSO_LIBS= -lpthread" in Makefile (db-4.1.25/build_unix/Makefile). Se more at in section 3.
 [2004-09-24 14:34 UTC] rurban at x-ray dot at
not fixed in CVS!
problem: incorrect order of c src and libs.
you must prepend LDFLAGS and LIBS, seperate LIBS from LDFLAGS.

$ gcc -o conftest -g -O2  -L/usr/lib -ldb-4.2  conftest.c -lresolv -lm
/tmp/ccozwee7.o(.text+0x29): In function `main':
/usr/src/apache-php/php-4.3.9/conftest.c:7: undefined reference to `_db_create'
collect2: ld returned 1 exit status

rurban@reini /usr/src/apache-php/php-4.3.9
$ gcc -o conftest -g -O2  conftest.c -L/usr/lib -ldb-4.2 -lresolv -lm

(the same goes for ext/ldap/config.m4)

$ diff -bu ext/dba/config.m4~ ext/dba/config.m4
--- ext/dba/config.m4~  2004-03-08 01:01:03.000000000 +0100
+++ ext/dba/config.m4   2004-09-24 13:27:27.121674400 +0100
@@ -11,8 +11,11 @@
-  $2
+  old_LIBS=$LIBS
+  LIBS="$2 LIBS"
+  $3
+  LIBS=$old_LIBS

@@ -134,7 +137,7 @@
   for LIB in $2; do
     if test -f $THIS_PREFIX/lib/lib$LIB.a -o -f $THIS_PREFIX/lib/lib$LIB.$SHLIB_SUFFIX_NAME; then
 #include "$THIS_INCLUDE"
 [2004-09-25 17:33 UTC]
Thanks for the patch, it's applied to 4.3.10-dev, 5.0.3-dev and HEAD
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Aug 05 02:01:23 2021 UTC