myWallJSON
myWallJSON

Reputation: 9522

boost 1.53 with clang compilation error on Mac OS X

I want to build boost with clang, I installed latest xcode and command line tools. Compiled b2 Now I try:

-mac:boost_1_53_0 tim$ ./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++" --prefix="./install-dir" debug release install

and get next as output:

Performing configuration checks

    - 32-bit                   : no
    - 64-bit                   : yes
    - x86                      : yes
    - has_icu builds           : no
warning: Graph library does not contain MPI-based parallel components.
note: to enable them, add "using mpi ;" to your user-config.jam
    - iconv (libc)             : no
    - iconv (separate)         : yes
    - icu                      : no
    - icu (lib64)              : no
    - gcc visibility           : yes
    - long double support      : yes
warning: skipping optional Message Passing Interface (MPI) library.
note: to enable MPI support, add "using mpi ;" to user-config.jam.
note: to suppress this message, pass "--without-mpi" to bjam.
note: otherwise, you can safely ignore this message.
/Users/tim/Desktop/Work/boost_1_53_0/tools/build/v2/build/virtual-target.jam:1079: in virtual-target.register-actual-name from module virtual-target
error: Duplicate name of actual target: <pinstall-dir/lib>libboost_atomic.dylib
error: previous virtual target { clang-darwin%clang-darwin.link.dll-libboost_atomic.dylib.SHARED_LIB { clang-darwin%clang-darwin.compile.c++-lockpool.o.OBJ { lockpool.cpp.CPP } } }
error: created from libs/atomic/build/boost_atomic
error: another virtual target { clang-darwin%clang-darwin.link.dll-libboost_atomic.dylib.SHARED_LIB { clang-darwin%clang-darwin.compile.c++-lockpool.o.OBJ { lockpool.cpp.CPP } } }
error: created from libs/atomic/build/boost_atomic
error: added properties: <debug-symbols>off <define>NDEBUG <inlining>full <optimization>speed <runtime-debugging>off <variant>release
error: removed properties: <debug-symbols>on <inlining>off <optimization>off <runtime-debugging>on <variant>debug
/Users/tim/Desktop/Work/boost_1_53_0/tools/build/v2/build/virtual-target.jam:490: in actualize-no-scanner from module object(file-target)@67176
/Users/tim/Desktop/Work/boost_1_53_0/tools/build/v2/build/virtual-target.jam:135: in object(file-target)@67176.actualize from module object(file-target)@67176
/Users/tim/Desktop/Work/boost_1_53_0/tools/build/v2/build-system.jam:749: in load from module build-system
/Users/tim/Desktop/Work/boost_1_53_0/tools/build/v2/kernel/modules.jam:283: in import from module modules
/Users/tim/Desktop/Work/boost_1_53_0/tools/build/v2/kernel/bootstrap.jam:142: in boost-build from module
/Users/tim/Desktop/Work/boost_1_53_0/boost-build.jam:17: in module scope from module

So I have a basic question: How to fix such error?

Upvotes: 1

Views: 1824

Answers (1)

jcm
jcm

Reputation: 977

If you don't build the debug version, the error disappears. It looks like you can't install debug and release libraries in the same directory.

This command works

./b2 toolset=clang cxxflags="-std=c++11 -stdlib=libc++" linkflags="-stdlib=libc++" --prefix="./install-dir" release install

Btw, it's ok to link the release boost libraries in a debug build of your application on a mac (and on linux). You don't need the debug build, unless you want to debug boost.

This is different to VisualStudio on Windows where you need the debug build of boost to link to the debug build of your application.

Upvotes: 3

Related Questions