Boost logo

Boost Users :

From: pbristow_at_[hidden]
Date: 2020-07-09 15:44:58


> -----Original Message-----
> From: Boost-users <boost-users-bounces_at_[hidden]> On Behalf Of DV Henkel-Wallace via Boost-
> users
> Sent: 9 July 2020 15:41
> To: Mathias Gaunard <mathias.gaunard_at_[hidden]>
> Cc: DV Henkel-Wallace <gumby_at_[hidden]>; boost-users_at_[hidden]
> Subject: Re: [Boost-users] Boost ABI/Linkage of clang vs g++
>
>
> > On Jul 9, 2020, at 04:25, Mathias Gaunard <mathias.gaunard_at_[hidden]> wrote:
> >
> > On Thu, 9 Jul 2020 at 08:07, DV Henkel-Wallace via Boost-users
> > <boost-users_at_[hidden]> wrote:
> >
> >> We build with clang++-10 w/libc++.a and g++-10 w/libstdc++.a, so
> >> build a copy of boost in each configuration as well. This works
> >> great on the Mac development machines but the clang case doesn't
> >> generate the correct linkage on the Linux deployment machines. The
> >> correct clang linkage is std::__1::basic_string... but boost builds
> >> with std::__cxx11::basic_string
> >
> > libc++ is not binary compatible with libstdc++.
> > You need to use either libstdc++ or libc++ with both compilers if you
> > want binary compatibility.
> >
> > This doesn't have anything to do with Boost.
>
> Thanks Mathias. I did not express my problem clearly. This is a b2 issue; I doubt any _library source
> code_ has any direct interaction with this and I'm sorry if I accidentally gave that impression. Is there a
> way to get b2 to disgorge the environment and tool invocation of each step (basically what is passed to
> system() or exec())?
>
> The background, perhaps clarified:
>
> We have our own code, some third party code (like Boost) and of course different runtime platforms
> (Mac, iOS, Linux...). Since different platforms use different compilers/runtimes as their "native" stack,
> our development system builds everything end-to-end with both gcc and clang to catch problems as
> early as possible. All compilation is with c++14 or later, post the C++11 ABI break, hence the naming
> issues. This process isolates us from any system libraries that don't have C linkage.
>
> Therefore g++ is used to compile libstdc++, boost, other third party code, and our code. Symbols are
> generated that use __c++11:: in their name.
> And clang++ is used to compile libc++, boost, other third party code, and our code. Symbols are
> generated that use use __1:: in their name.
>
> But boost itself is compiled via b2 and what is passed to the compiler (and which compiler b2 chooses) is
> quite opaque. Despite my attempts to force the use of clang it appears that b2 is either calling g++ or
> otherwise asking clang to use g++-style symbol linkage on Linux. On the Mac the same invocation
> behaves as expected.
>
> I'm compiling boost this way:
>
> export CC=clang CXX="clang++ -stdlib=libc++" CXXSTD=c++20 ; ./b2 stdlib=libc++ toolset=clang
> boost.locale.icu=off boost.locale.std=off --with-atomic --with-chrono --with-date_time --with-headers --
> with-locale --with-log --with-program_options --with-random --with-regex --with-system --with-thread
> threading=multi -sNO_COMPRESSION=1 link=static install
>
> Any thoughts on how to debug this?

Does b2 -debug-configuration help?

https://boostorg.github.io/build/manual/master/index.html section 3.3 configuration

☀
        You can use the --debug-configuration option to find which configuration files are actually loaded.

Paul


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