|
Boost Users : |
Subject: Re: [Boost-users] How to build Boost with Clang/libc++ and NOT link against libstdc++?
From: Jürgen Hunold (jhunold_at_[hidden])
Date: 2017-01-20 06:40:48
Hi Deniz,
Am Freitag, 20. Januar 2017, 10:13:56 CET schrieb Deniz Bahadir:
> Hi guys,
> I am able to build the Boost libraries using Clang and flags "-std=c++14
> -stdlib=libc++", however, I noticed that several libraries are still
> linked against GCC's standard-library "libstdc++".
This works for me for quite a while. Please make sure you rebuild all
libraries. Hint: b2 does not cache compiler flags. Add "-a" to your command
line to force a full rebuild.
> Does anyone know how and why this link-dependency gets added and how to
> get rid of them? Does it come in through some other link-dependencies?
> At least none of them seem to link to "libstdc++"?
Most probably a not clean rebuild.
> dll-path==/opt/BENOCS/clang38/lib/x86_64-linux-gnu \
> toolset=clang-3.8 \
The toolset "clang-3.8" is configured where and how?
> cflags="$CFLAGS" CXXFLAGS="$CXXFLAGS" \
cxxflags="$CXXFLAGS"
> linkflags="-Wl,--as-needed $LINK_LIBCXXABI"
I'd put the extra flags into user-/project-/site-config.jam.
> For the environment-variable LINK_LIBCXXABI I tried "-lc++abi" as well
> and also tried providing it only in the cxxflags or the linkflags or
> both (as above).
linkflags should contain "-stdlib=libc++", too
> I would be happy, if anyone could explain that behavior or could even
> provide a workaround/fix for me, so that "libstdc++" is no longer linked.
from my user-config.jam:
# Clang trunk
using clang : # version
: # compiler
$(HOME)/local/bin/clang++
: # options
<cxxflags>-stdlib=libc++
<cxxflags>-I$(HOME)/local/include/c++/v1
<linkflags>-stdlib=libc++
<linkflags>-L$(HOME)/local/lib
;
with custom clang trunk installed to $(HOME)/local
> PS: BTW, does anyone know if it is correct, that shared libraries (in
> general) that are linked against "libc++abi" do always also link to
> "libgcc_s"? (What is it for?)
The basic compiler runtime AFAIK. Might be replaced by clang's compiler-rt, I
guess. But that is off-topic
Yours,
Jürgen
-- * Dipl.-Math. Jürgen Hunold ! * voice: ++49 4257 300 ! Fährstraße 1 * fax : ++49 4257 300 ! 31609 Balge/Sebbenhausen * jhunold_at_gmx.eu ! Germany
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net