Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi,

this fixed the problem described in the attached mail.

Gökçen, Robert, could you please test it and sign it out for
libreoffice-3-3 branch?

It works here and it should be more safe than the current solution.


Analyze:
--------

"db_create" function is defined by macro in some db version. I did a lot
of googling and have not found any ultimate solution.

Some people try to check all "db_create" variants, e.g. db_create_4002, 
db_create_4001, see
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/mail-filter/maildrop/files/maildrop-2.5.1-db.patch?view=diff&r1=text&tr1=1.1&r2=text&tr2=1.1&diff_format=s

The problem is that there exists too many variants. Gökçen would need
db_create_4008, ...

I have found only one other variant for "dbopen" that is __db185_open.
This symbol has been introduced in db-3.x and seems to be provided by
any newer version for compatibility reasons. See also
http://lists.debian.org/debian-devel/2001/04/msg01770.html


Solution:
---------

LibO requires db >= 4.4. All these version should provide the symbol
"__db185_open" for compatibility reasons. Of course, it is better to
check for the original symbol "dbopen", so I used "__db185_open" just as
fallback.

I am not 100% sure that it would work on all archaic systems but it
should be better than the current state.


Best Regards,
Petr
--- Begin Message ---
Çarşamba 01 Aralık 2010 günü (saat 20:35:22) Petr Mladek şunları yazmıştı:
Hi Robert,

Robert Nagy píše v St 01. 12. 2010 v 11:27 +0100:
Hi,

So this is a modified versio nof patches/dev300/system-db-check.diff
to find the proper berkeley db headers and libs.
I really would like to get this into bootstrap so please test and
comment.

It looks reasonable and works here. Feel free to commit it.


With this patch (in RC2) I can no longer pass configure:

checking which db to use... external
checking for db-5.1/db.h... no
checking for db5.1/db.h... no
checking for db-5.0/db.h... no
checking for db5.0/db.h... no
checking for db-5/db.h... no
checking for db5/db.h... no
checking for db-4.8/db.h... no
checking for db4.8/db.h... no
checking for db-4.7/db.h... no
checking for db4.7/db.h... no
checking for db-4/db.h... no
checking for db4/db.h... no
checking for db/db.h... no
checking db.h usability... yes
checking db.h presence... yes
checking for db.h... yes
checking whether db is at least 4.1... yes
checking for db_create in -ldb... no
checking for db_create in -ldb-5.1... no
checking for db_create in -ldb5.1... no
checking for db_create in -ldb-5.0... no
checking for db_create in -ldb5.0... no
checking for db_create in -ldb-5... no
checking for db_create in -ldb5... no
checking for db_create in -ldb-4.8... no
checking for db_create in -ldb4.8... no
checking for db_create in -ldb-4.7... no
checking for db_create in -ldb4.7... no
checking for db_create in -ldb-4... no
checking for db_create in -ldb4... no
checking for db_create... no
configure: error: db not installed or functional

I'm using db4 version 4.8.30, and db4-devel package is installed. I can 
compile RC1 without any errors. 

When I try to compile this test file that configure generates:

/* confdefs.h */                                                                                    
                                                                                                    
                                    
#define PACKAGE_NAME ""                                                                             
                                                                                                    
                                    
#define PACKAGE_TARNAME ""                                                                          
                                                                                                    
                                    
#define PACKAGE_VERSION ""                                                                          
                                                                                                    
                                    
#define PACKAGE_STRING ""                                                                           
                                                                                                    
                                    
#define PACKAGE_BUGREPORT ""                                                                        
                                                                                                    
                                    
#define PACKAGE_URL ""                                                                              
                                                                                                    
                                    
#define STDC_HEADERS 1                                                                              
                                                                                                    
                                    
#define HAVE_SYS_TYPES_H 1                                                                          
                                                                                                    
                                    
#define HAVE_SYS_STAT_H 1                                                                           
                                                                                                    
                                    
#define HAVE_STDLIB_H 1                                                                             
                                                                                                    
                                    
#define HAVE_STRING_H 1                                                                             
                                                                                                    
                                    
#define HAVE_MEMORY_H 1                                                                             
                                                                                                    
                                    
#define HAVE_STRINGS_H 1                                                                            
                                                                                                    
                                    
#define HAVE_INTTYPES_H 1                                                                           
                                                                                                    
                                    
#define HAVE_STDINT_H 1                                                                             
                                                                                                    
                                    
#define HAVE_UNISTD_H 1                                                                             
                                                                                                    
                                    
#define SIZEOF_LONG 8                                                                               
                                                                                                    
                                    
#define HAVE_LIBCRYPT 1                                                                             
                                                                                                    
                                    
#define HAVE_MALLOC 1                                                                               
                                                                                                    
                                    
#define HAVE_REALLOC 1                                                                              
                                                                                                    
                                    
#define HAVE_CALLOC 1                                                                               
                                                                                                    
                                    
#define HAVE_FREE 1                                                                                 
                                                                                                    
                                    
#define HAVE_LIBEXPAT 1                                                                             
                                                                                                    
                                    
/* end confdefs.h.  */                                                                              
                                                                                                    
                                    
                                                                                                    
                                                                                                    
                                    
/* Override any GCC internal prototype to avoid an error.                                           
                                                                                                    
                                    
   Use char because int might match the return type of a GCC                                        
                                                                                                    
                                    
   builtin and then its argument prototype would still apply.  */                                   
                                                                                                    
                                    
#ifdef __cplusplus                                                                                  
                                                                                                    
                                    
extern "C"                                                                                          
                                                                                                    
                                    
#endif                                                                                              
                                                                                                    
                                    
char db_create();                                                                                   
                                                                                                    
                                   
int                                                                                                 
                                                                                                    
                                    
main ()                                                                                             
                                                                                                    
                                    
{                                                                                                   
                                                                                                    
                                    
return db_create();                                                                                 
                                                                                                    
                                   
  ;                                                                                                 
                                                                                                    
                                    
  return 0;                                                                                         
                                                                                                    
                                    
}                                                                                                   
                                                                                                    
                                    

I got this linking error:

$ x86_64-pc-linux-gnu-gcc -o conftest -mtune=generic -march=x86-64 -ldb  -
lexpat -lcrypt db.c

/tmp/cc6Q7xex.o: In function `main':
db.c:(.text+0xa): undefined reference to `db_create'
collect2: ld returned 1 exit status

In libdb.so, there is no such symbol like db_create, but db_create_4008 exists 
and in db.h header file db_create is defined as a macro:

#define db_create db_create_4008

So, checking db_create function with AC_CHECK_FUNC is wrong for DB 4.8. I 
think db.h must be included to use db_create method but the file generated by 
autoconf just tries to use db_create function which is not available if db.h 
is not included.

When I apply the workaround attached I can pass configure now, but I know this 
is not the right solution. I think this patch must be reverted until it is 
tested with all db versions.

Best Regards,
Petr


-- 
Gökçen Eraslan
--- configure.in.orig   2010-12-27 15:04:05.274000696 +0000
+++ configure.in        2010-12-27 14:59:41.427000696 +0000
@@ -4418,9 +4418,9 @@
     ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no. you need at least db 4.1])])
     save_LIBS="$LIBS"
     for dbver in '' -5.1 5.1 -5.0 5.0 -5 5 -4.8 4.8 -4.7 4.7 -4 4; do
-        AC_CHECK_LIB(db$dbver, db_create, [ DB_LIB="db$dbver"; DB_CPPLIB="db_cxx$dbver"; 
LIBS="-ldb$dbver $LIBS"; break ])
+        AC_CHECK_LIB(db$dbver, db_create_4008, [ DB_LIB="db$dbver"; DB_CPPLIB="db_cxx$dbver"; 
LIBS="-ldb$dbver $LIBS"; break ])
     done
-    AC_CHECK_FUNC(db_create, [], [ AC_MSG_ERROR([db not installed or functional]) ])
+    AC_CHECK_FUNC(db_create_4008, [], [ AC_MSG_ERROR([db not installed or functional]) ])
     LIBS="$save_LIBS"
     SCPDEFS="$SCPDEFS -DSYSTEM_DB"
 else

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
LibreOffice mailing list
LibreOffice@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice

--- End Message ---
From 7a5b94f877de62eb9cd46954ba3a67e465625003 Mon Sep 17 00:00:00 2001
From: Petr Mladek <pmladek@suse.cz>
Date: Thu, 6 Jan 2011 20:47:15 +0100
Subject: [PATCH] Fix check for BerkleyDB when db_create is macro

It seems more safe to check for dbopen; it has just one
other variant in db-3, see
http://lists.debian.org/debian-devel/2001/04/msg01770.html
---
 configure.in |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/configure.in b/configure.in
index 266f7e3..409c756 100644
--- a/configure.in
+++ b/configure.in
@@ -4312,12 +4312,16 @@ int main(int argc, char **argv) {
        else return 1;
 }
     ], [AC_MSG_RESULT([yes])], [AC_MSG_ERROR([no. you need at least db 4.1])])
-    save_LIBS="$LIBS"
+    DB_LIB=
     for dbver in '' -5.1 5.1 -5.0 5.0 -5 5 -4.8 4.8 -4.7 4.7 -4 4; do
-        AC_CHECK_LIB(db$dbver, db_create, [ DB_LIB="db$dbver"; DB_CPPLIB="db_cxx$dbver"; 
LIBS="-ldb$dbver $LIBS"; break ])
+        AC_CHECK_LIB(db$dbver, dbopen, [ DB_LIB="db$dbver"; DB_CPPLIB="db_cxx$dbver"; break; ] ,
+            AC_CHECK_LIB(db$dbver, __db185_open, [ DB_LIB="db$dbver"; DB_CPPLIB="db_cxx$dbver"; 
break; ]
+            )
+        )
     done
-    AC_CHECK_FUNC(db_create, [], [ AC_MSG_ERROR([db not installed or functional]) ])
-    LIBS="$save_LIBS"
+    if test -z "$DB_LIB" ; then 
+        AC_MSG_ERROR([db not installed or functional])
+    fi
     SCPDEFS="$SCPDEFS -DSYSTEM_DB"
 else
     AC_MSG_RESULT([internal])
-- 
1.7.3.4


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.