Am 09.07.20 um 16:40 schrieb DV Henkel-Wallace via Boost-users:

On Jul 9, 2020, at 04:25, Mathias Gaunard <mathias.gaun...@ens-lyon.org> wrote:

On Thu, 9 Jul 2020 at 08:07, DV Henkel-Wallace via Boost-users
<boost-users@lists.boost.org> 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?

Just a wild guess, but could it be that your combined value for environment variable CXX is not used verbatim by b2?

You should probably try to set CXX only to the compiler-executable and put the `-stdlib=libc++` option into CXXFLAGS environment variable.

If b2 has an option `stdlib=libc++` I am also not sure.

For me it always succeeds by building Boost with Clang and libc++ like this:

```
./b2 toolset=clang cxxflags="-std=c++20 -stdlib=libc++" linkflags="-stdlib=libc++" cxxstd=20 install ...
```

Probably I could omit the `cxxflags` option but I have not tried it lately.

Hope that helps,
Deniz


--
BENOCS GmbH
Dipl.-Inform. Deniz Bahadir
Reuchlinstr. 10 D
10553 Berlin
Germany
Phone: +49 - 30 / 577 0004-22
Email: deniz.baha...@benocs.com
www.benocs.com

Board of Management: Stephan Schröder, Dr.-Ing. Ingmar Poese
Commercial Register: Amtsgericht Bonn HRB 19378
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
https://lists.boost.org/mailman/listinfo.cgi/boost-users

Reply via email to