Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jul 2013 23:39:08 +0200
From:      Michael Gmelin <freebsd@grem.de>
To:        Matthias Andree <mandree@FreeBSD.org>
Cc:        Dimitry Andric <dim@FreeBSD.org>, "freebsd-ports@freebsd.org Ports" <freebsd-ports@freebsd.org>
Subject:   Re: Building db5 with clang 3.3
Message-ID:  <20130723233908.31c405c8@bsd64.grem.de>
In-Reply-To: <51EEDDFE.5070009@FreeBSD.org>
References:  <20130613031535.4087d7f9@bsd64.grem.de> <EF830CD7-00F1-4628-8515-76133BBE85E7@FreeBSD.org> <C1CC40FC-4489-4164-96B7-5E1A25DCB37F@FreeBSD.org> <20130722003246.5a05635d@bsd64.grem.de> <51EEDDFE.5070009@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, 23 Jul 2013 21:48:14 +0200
Matthias Andree <mandree@FreeBSD.org> wrote:

> Am 22.07.2013 00:32, schrieb Michael Gmelin:
> 
> > I just tested building databases/db5 on 9.2-BETA1 (which ships with
> > clang 3.3) using c++11 and libc++ and ran into the same problem.
> > Dimitry's patch applied cleanly and resolved the issue. Do you think
> > you could commit his patch to db5?
> 
> Generally speaking yes,
> but what do I need to do to reproduce the problem on
> 9.1-RELEASE-mumble?
> 

That's a good question. Since the problem is caused by db5's
redefinition of atomic_init, which is used in current versions of
libc++ you'll need clang++ 3.3 and a matching libc++
(/usr/ports/devel/libc++ uses SVN Rev 185324 right now).

Unfortunately libc++ won't build on 9.1-RELEASE by default, since it
requires at least OS version 901502 (which means 9.1-STABLE as of Nov
28 2012 or later) due to the lack of aligned_alloc in earlier versions
of the OS. Fortunately a patch for the sake of demonstrating the
problem is not too hard.

So what you can do to reproduce this is the following (just tested
this on a 9.1-RELEASE machine):

1. Install clang33
cd /usr/ports/lang/clang33
make install

2. Extract, modify and install libc++
cd /usr/ports/devel/libc++

make -DNO_IGNORE extract

Modify work/libc++-185324/include/cstdlib and add the following snipped
at line 87 (right after #include <stdlib.h>):

--- snippet begin ---
#include <errno.h>

inline void *
aligned_alloc(size_t alignment, size_t size)
{
        void *memptr;
        int ret;

        ret = posix_memalign(&memptr, alignment, size);
        if (ret != 0) {
                errno = ret;
                return (NULL);
        }
        return (memptr);
}
--- snippet end ---

make install

3. Add the following lines to /etc/make.conf

CC=clang33
CXX=clang++33 -std=c++11 -stdlib=libc++ -I/usr/local/include/c++/v1 -L/usr/local/lib

4. Build databases/db5 and see it fail

cd /usr/ports/databases/db5
make

....
/usr/local/include/c++/v1/atomic:1447:28: error: unknown type name 'atomic_flag'
atomic_flag_clear_explicit(atomic_flag* __o, memory_order __m) _NOEXCEPT
...

Cheers,
Michael

-- 
Michael Gmelin



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