Building db5 with clang 3.3
Michael Gmelin
freebsd at grem.de
Tue Jul 23 21:39:17 UTC 2013
On Tue, 23 Jul 2013 21:48:14 +0200
Matthias Andree <mandree at 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
More information about the freebsd-ports
mailing list