llvm37 build failure, libatomic?

Gary Aitken freebsd at dreamchaser.org
Fri Apr 8 15:14:09 UTC 2016

Hello Aleksander and Peter,

Thanks for your replies.

>>> Updated ports (it's been quite a while) and attempting to rebuild x11
>>> fails for llvm37 claiming the compiler needs libatomic and it's not
>>> there. What's the deal with libatomic?
> You will need to install lang/clang-devel to successfully update llvm37.

When I try to install clang-devel I get the same error:

-- Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Failed
-- Looking for __atomic_fetch_add_4 in atomic
-- Looking for __atomic_fetch_add_4 in atomic - not found
CMake Error at cmake/modules/CheckAtomic.cmake:36 (message):
  Host compiler appears to require libatomic, but cannot find it.
Call Stack (most recent call first):
  cmake/config-ix.cmake:296 (include)
  CMakeLists.txt:412 (include)

> If you still have a problem with libatomic could you please provide
> more information - OS version, make.conf, port flags, more logs, etc?

The CMakeError.log file indicates a number of errors:

Run Build Command:"/usr/local/bin/ninja" "cmTC_32962"
[1/2] Building C object CMakeFiles/cmTC_32962.dir/CheckIncludeFile.c.o
FAILED: /usr/local/bin/gcc48 -O2 -pipe -isystem /usr/local/include -fstack-protector -Wl,-rpath=/usr/local/lib/gcc48 -fno-strict-
aliasing -o CMakeFiles/cmTC_32962.dir/CheckIncludeFile.c.o -c CheckIncludeFile.c
In file included from CheckIncludeFile.c:1:0:
/usr/include/malloc.h:3:2: error: #error "<malloc.h> has been replaced by <stdlib.h>"
#error "<malloc.h> has been replaced by <stdlib.h>"
ninja: build stopped: subcommand failed.

and others, ending with:

/usr/local/bin/ld: cannot find -lcxxrt
collect2: error: ld returned 1 exit status

I'm guessing this is a configuration error on my system, probably related
to 10.x changes; I'm running 9.2-RELEASE-p12

/etc/make.conf contains:

When I first saw the error I installed devel/libatomic_ops, but that creates
/usr/local/lib/libatomic_ops.a and libatomic_ops_gpl.a.  Not libatomic.*  
There is also a libboost_atomic.* set from about 6 months ago.

However, given the other errors above from ninja I'm guessing this is more
than just a libatomic problem.

Thanks for any additional clues,


More information about the freebsd-questions mailing list