Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 04 May 2012 23:10:28 +0200
From:      Dimitry Andric <dimitry@andric.com>
To:        "Hartmann, O." <ohartman@zedat.fu-berlin.de>
Cc:        freebsd-current@freebsd.org
Subject:   Re: OpenLDAP: core dump with latest CLANG buildworld.
Message-ID:  <4FA445C4.7060709@andric.com>
In-Reply-To: <4FA395E8.9050606@zedat.fu-berlin.de>
References:  <4FA395E8.9050606@zedat.fu-berlin.de>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------070304090707020206030608
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

On 2012-05-04 10:40, Hartmann, O. wrote:> On all FreeBSD 10-CURRENt boxes, built with CLANG, there is no OpenLDAP
> anymore since yesterday's buildworld!
> OpenLDAP (slapd), the most recent build from the ports (recompiled
> everything in hope to fix the problem) coredumps immediately after it
> tries to start. Examination of the cause with slapd -d256 doesn't work.

Which version of openldap did you use?  I built openldap24-server with
its default settings, and it starts up just fine.


...
> Recompiling everything prerequisit for OpenLDAP/SASL revealed that even
> now databases/db5 isn't compiling with CLANG anymore (which has before
> the last LLVM update).
> 
> What happened? Why is CLANG (3.1?) now so picky about some __atomic_...
> statements?

This is because bdb5 tries to redefine gcc's builtin atomic functions,
which are also supported by clang (this is a feature :).  It is rather
dumb to use names starting with underscores for this, since they are
reserved.

The same problem occurs if you compile with gcc 4.7 or higher, albeit
gcc apparently doesn't think this is serious enough to bail out:

  ./libtool --mode=compile /usr/local/bin/gcc47 -c -I. -I./../src  -D_THREAD_SAFE -O2 -pipe -fno-strict-aliasing  ../src/mutex/mut_tas.c
  libtool: compile:  /usr/local/bin/gcc47 -c -I. -I./../src -D_THREAD_SAFE -O2 -pipe -fno-strict-aliasing ../src/mutex/mut_tas.c  -fPIC -DPIC -o .libs/mut_tas.o
  In file included from ./../src/dbinc/mutex_int.h:12:0,
		   from ./../src/dbinc/mutex.h:15,
		   from ./db_int.h:1089,
		   from ../src/mutex/mut_tas.c:11:
  ./../src/dbinc/atomic.h:179:19: warning: conflicting types for built-in function '__atomic_compare_exchange' [enabled by default]

In any case, attached is a simple patch to fix the db5 port.

--------------070304090707020206030608
Content-Type: text/x-diff;
 name="clangports-databases-db5-1.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="clangports-databases-db5-1.diff"

Index: databases/db5/files/patch-src_dbinc_atomic.h
===================================================================
RCS file: databases/db5/files/patch-src_dbinc_atomic.h
diff -N databases/db5/files/patch-src_dbinc_atomic.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ databases/db5/files/patch-src_dbinc_atomic.h	4 May 2012 21:07:42 -0000
@@ -0,0 +1,20 @@
+--- ../src/dbinc/atomic.h.orig	2012-02-29 19:48:38.000000000 +0100
++++ ../src/dbinc/atomic.h	2012-05-04 22:39:32.000000000 +0200
+@@ -144,7 +144,7 @@ typedef LONG volatile *interlocked_val;
+ #define	atomic_inc(env, p)	__atomic_inc(p)
+ #define	atomic_dec(env, p)	__atomic_dec(p)
+ #define	atomic_compare_exchange(env, p, o, n)	\
+-	__atomic_compare_exchange((p), (o), (n))
++	__atomic_compare_exchange_db((p), (o), (n))
+ static inline int __atomic_inc(db_atomic_t *p)
+ {
+ 	int	temp;
+@@ -176,7 +176,7 @@ static inline int __atomic_dec(db_atomic
+  * http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Atomic-Builtins.html
+  * which configure could be changed to use.
+  */
+-static inline int __atomic_compare_exchange(
++static inline int __atomic_compare_exchange_db(
+ 	db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
+ {
+ 	atomic_value_t was;

--------------070304090707020206030608--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4FA445C4.7060709>