Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Jun 2013 00:27:53 +0200
From:      Dimitry Andric <dim@FreeBSD.org>
To:        Matthias Andree <mandree@FreeBSD.org>
Cc:        "freebsd-ports@freebsd.org Ports" <freebsd-ports@freebsd.org>, Michael Gmelin <freebsd@grem.de>
Subject:   Re: Are ports supposed to build and run on 10-CURRENT?
Message-ID:  <C1CC40FC-4489-4164-96B7-5E1A25DCB37F@FreeBSD.org>
In-Reply-To: <EF830CD7-00F1-4628-8515-76133BBE85E7@FreeBSD.org>
References:  <20130613031535.4087d7f9@bsd64.grem.de> <EF830CD7-00F1-4628-8515-76133BBE85E7@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--Apple-Mail=_6A5E6358-A006-4687-9ADF-B5CF571E4F89
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset=us-ascii

On Jun 21, 2013, at 22:07, Dimitry Andric <dim@freebsd.org> wrote:
> On Jun 13, 2013, at 03:15, Michael Gmelin <freebsd@grem.de> wrote:
...
>> - system clang + std=3Dc++11 + system libc++: Build fails, due to=20
>> a dependency (databases/db5) not building with those flags. It looks
>> like a problem in libc++ to me, but I didn't have much time to
>> investigate. It might be one of those things that might just go away
>> after a while.
>=20
> No, db5 does not build because it is redefining a C++11 standard =
library
> identifier, atomic_init().  It should probably prefix all its internal
> defines with 'db_', to avoid collisions.  The
> db-5.3.21/src/dbinc/atomic.h file is already patched by our port to
> avoid one such collision, but it is probably necessary to do this =
again
> for any other identifiers that are used either by C++, or are compiler
> builtins.

Attached is a diff to fix the db5 port, so it correctly builds with
CXXFLAGS?=3D-std=3Dc++11 -stdlib=3Dlibc++.  Matthias, could you please =
have a
look at it?

After db5 (compiled with libc++) was installed, I retried devel/ice
again, but the Slice/keyword test failed in exactly the same way.  If
you comment out the "delete factoryTable" line in
cpp/src/Ice/FactoryTableInit.cpp, the Slice/keyword test does succeed.

Many other tests after that also go well, and the next failure I get
was:

  *** running tests 39/83 in =
/usr/work/usr/ports/devel/ice/work/Ice-3.5.0/cpp/test/Ice/udp
  *** configuration: Default
  *** test started: 06/22/13 00:20:11
  starting server #1... ok
  starting server #2... Traceback (most recent call last):
    File =
"/usr/work/usr/ports/devel/ice/work/Ice-3.5.0/cpp/test/Ice/udp/run.py", =
line 41, in <module>
      serverProc.append(TestUtil.startServer(server, "%d" % i , =
adapter=3D"McastTestAdapter"))
    File =
"/usr/work/usr/ports/devel/ice/work/Ice-3.5.0/scripts/TestUtil.py", line =
1396, in startServer
      return spawnServer(cmd, env =3D env, adapter =3D adapter, count =3D =
count, echo =3D echo,lang=3Dconfig.lang,mx=3Dconfig.mx)
    File =
"/usr/work/usr/ports/devel/ice/work/Ice-3.5.0/scripts/TestUtil.py", line =
1131, in spawnServer
      server.expect("%s ready\n" % adapter)
    File =
"/usr/work/usr/ports/devel/ice/work/Ice-3.5.0/scripts/Expect.py", line =
394, in expect
      raise e
  Expect.TIMEOUT: timeout exceeded in match
  pattern: "McastTestAdapter ready\n"
  buffer: "ControlAdapter ready
  Network.cpp:1701: Ice::SocketException:
  socket exception: Address already in use
  "

  ('test in =
/usr/work/usr/ports/devel/ice/work/Ice-3.5.0/cpp/test/Ice/udp failed =
with exit status', 256)

Whatever the source of this problem is, it is not very likely that is
caused by a compiler or C++ library issue, but more likely some
unexpected API change in sockets.

-Dimitry

--Apple-Mail=_6A5E6358-A006-4687-9ADF-B5CF571E4F89
Content-Disposition: attachment;
	filename=databases__db5-rename-atomics-1.diff
Content-Type: application/octet-stream;
	name="databases__db5-rename-atomics-1.diff"
Content-Transfer-Encoding: 7bit

Index: databases/db5/files/patch-src_dbinc_atomic.h
===================================================================
--- databases/db5/files/patch-src_dbinc_atomic.h	(revision 321497)
+++ databases/db5/files/patch-src_dbinc_atomic.h	(working copy)
@@ -1,5 +1,14 @@
 --- ../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
+@@ -70,7 +70,7 @@ typedef struct {
+  * These have no memory barriers; the caller must include them when necessary.
+  */
+ #define	atomic_read(p)		((p)->value)
+-#define	atomic_init(p, val)	((p)->value = (val))
++#define	db_atomic_init(p, val)	((p)->value = (val))
+ 
+ #ifdef HAVE_ATOMIC_SUPPORT
+ 
 @@ -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)
@@ -18,3 +27,12 @@
  	db_atomic_t *p, atomic_value_t oldval, atomic_value_t newval)
  {
  	atomic_value_t was;
+@@ -206,7 +206,7 @@ static inline int __atomic_compare_excha
+ #define	atomic_dec(env, p)	(--(p)->value)
+ #define	atomic_compare_exchange(env, p, oldval, newval)		\
+ 	(DB_ASSERT(env, atomic_read(p) == (oldval)),		\
+-	atomic_init(p, (newval)), 1)
++	db_atomic_init(p, (newval)), 1)
+ #else
+ #define atomic_inc(env, p)	__atomic_inc(env, p)
+ #define atomic_dec(env, p)	__atomic_dec(env, p)
Index: databases/db5/files/patch-src_mp_mp_fget.c
===================================================================
--- databases/db5/files/patch-src_mp_mp_fget.c	(revision 0)
+++ databases/db5/files/patch-src_mp_mp_fget.c	(working copy)
@@ -0,0 +1,20 @@
+--- ../src/mp/mp_fget.c.orig	2012-05-11 19:57:53.000000000 +0200
++++ ../src/mp/mp_fget.c	2013-06-21 22:15:57.000000000 +0200
+@@ -649,7 +649,7 @@ alloc:		/* Allocate a new buffer header 
+ 
+ 		/* Initialize enough so we can call __memp_bhfree. */
+ 		alloc_bhp->flags = 0;
+-		atomic_init(&alloc_bhp->ref, 1);
++		db_atomic_init(&alloc_bhp->ref, 1);
+ #ifdef DIAGNOSTIC
+ 		if ((uintptr_t)alloc_bhp->buf & (sizeof(size_t) - 1)) {
+ 			__db_errx(env, DB_STR("3025",
+@@ -955,7 +955,7 @@ alloc:		/* Allocate a new buffer header 
+ 			MVCC_MPROTECT(bhp->buf, mfp->pagesize,
+ 			    PROT_READ);
+ 
+-		atomic_init(&alloc_bhp->ref, 1);
++		db_atomic_init(&alloc_bhp->ref, 1);
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+ 		alloc_bhp->priority = bhp->priority;
+ 		alloc_bhp->pgno = bhp->pgno;
Index: databases/db5/files/patch-src_mp_mp_mvcc.c
===================================================================
--- databases/db5/files/patch-src_mp_mp_mvcc.c	(revision 0)
+++ databases/db5/files/patch-src_mp_mp_mvcc.c	(working copy)
@@ -0,0 +1,20 @@
+--- ../src/mp/mp_mvcc.c.orig	2012-05-11 19:57:53.000000000 +0200
++++ ../src/mp/mp_mvcc.c	2013-06-21 22:15:57.000000000 +0200
+@@ -276,7 +276,7 @@ __memp_bh_freeze(dbmp, infop, hp, bhp, n
+ #else
+ 	memcpy(frozen_bhp, bhp, SSZA(BH, buf));
+ #endif
+-	atomic_init(&frozen_bhp->ref, 0);
++	db_atomic_init(&frozen_bhp->ref, 0);
+ 	if (mutex != MUTEX_INVALID)
+ 		frozen_bhp->mtx_buf = mutex;
+ 	else if ((ret = __mutex_alloc(env, MTX_MPOOL_BH,
+@@ -428,7 +428,7 @@ __memp_bh_thaw(dbmp, infop, hp, frozen_b
+ #endif
+ 		alloc_bhp->mtx_buf = mutex;
+ 		MUTEX_LOCK(env, alloc_bhp->mtx_buf);
+-		atomic_init(&alloc_bhp->ref, 1);
++		db_atomic_init(&alloc_bhp->ref, 1);
+ 		F_CLR(alloc_bhp, BH_FROZEN);
+ 	}
+ 
Index: databases/db5/files/patch-src_mp_mp_region.c
===================================================================
--- databases/db5/files/patch-src_mp_mp_region.c	(revision 0)
+++ databases/db5/files/patch-src_mp_mp_region.c	(working copy)
@@ -0,0 +1,20 @@
+--- ../src/mp/mp_region.c.orig	2012-05-11 19:57:53.000000000 +0200
++++ ../src/mp/mp_region.c	2013-06-21 22:15:57.000000000 +0200
+@@ -245,7 +245,7 @@ __memp_init(env, dbmp, reginfo_off, htab
+ 			     MTX_MPOOL_FILE_BUCKET, 0, &htab[i].mtx_hash)) != 0)
+ 				return (ret);
+ 			SH_TAILQ_INIT(&htab[i].hash_bucket);
+-			atomic_init(&htab[i].hash_page_dirty, 0);
++			db_atomic_init(&htab[i].hash_page_dirty, 0);
+ 		}
+ 
+ 		/*
+@@ -302,7 +302,7 @@ no_prealloc:
+ 		} else
+ 			hp->mtx_hash = mtx_base + (i % dbenv->mp_mtxcount);
+ 		SH_TAILQ_INIT(&hp->hash_bucket);
+-		atomic_init(&hp->hash_page_dirty, 0);
++		db_atomic_init(&hp->hash_page_dirty, 0);
+ #ifdef HAVE_STATISTICS
+ 		hp->hash_io_wait = 0;
+ 		hp->hash_frozen = hp->hash_thawed = hp->hash_frozen_freed = 0;
Index: databases/db5/files/patch-src_mutex_mut_method.c
===================================================================
--- databases/db5/files/patch-src_mutex_mut_method.c	(revision 0)
+++ databases/db5/files/patch-src_mutex_mut_method.c	(working copy)
@@ -0,0 +1,11 @@
+--- ../src/mutex/mut_method.c.orig	2012-05-11 19:57:53.000000000 +0200
++++ ../src/mutex/mut_method.c	2013-06-21 22:15:57.000000000 +0200
+@@ -474,7 +474,7 @@ atomic_compare_exchange(env, v, oldval, 
+ 	MUTEX_LOCK(env, mtx);
+ 	ret = atomic_read(v) == oldval;
+ 	if (ret)
+-		atomic_init(v, newval);
++		db_atomic_init(v, newval);
+ 	MUTEX_UNLOCK(env, mtx);
+ 
+ 	return (ret);
Index: databases/db5/files/patch-src_mutex_mut_tas.c
===================================================================
--- databases/db5/files/patch-src_mutex_mut_tas.c	(revision 0)
+++ databases/db5/files/patch-src_mutex_mut_tas.c	(working copy)
@@ -0,0 +1,20 @@
+--- ../src/mutex/mut_tas.c.orig	2012-05-11 19:57:54.000000000 +0200
++++ ../src/mutex/mut_tas.c	2013-06-21 22:15:57.000000000 +0200
+@@ -47,7 +47,7 @@ __db_tas_mutex_init(env, mutex, flags)
+ 
+ #ifdef HAVE_SHARED_LATCHES
+ 	if (F_ISSET(mutexp, DB_MUTEX_SHARED))
+-		atomic_init(&mutexp->sharecount, 0);
++		db_atomic_init(&mutexp->sharecount, 0);
+ 	else
+ #endif
+ 	if (MUTEX_INIT(&mutexp->tas)) {
+@@ -536,7 +536,7 @@ __db_tas_mutex_unlock(env, mutex)
+ 			F_CLR(mutexp, DB_MUTEX_LOCKED);
+ 			/* Flush flag update before zeroing count */
+ 			MEMBAR_EXIT();
+-			atomic_init(&mutexp->sharecount, 0);
++			db_atomic_init(&mutexp->sharecount, 0);
+ 		} else {
+ 			DB_ASSERT(env, sharecount > 0);
+ 			MEMBAR_EXIT();

--Apple-Mail=_6A5E6358-A006-4687-9ADF-B5CF571E4F89--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?C1CC40FC-4489-4164-96B7-5E1A25DCB37F>