mixing clang C++ and GNU C++ ?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

mixing clang C++ and GNU C++ ?

j-62
Hi all,

I'm trying some boost library examples, on amd64, using -current.  When
building with clang it works ok, but using eg++ results in load-time
failure:


snaptest66$ timlibs="-I/usr/local/include -L/usr/local/lib
-lboost_timer"

snaptest66$ ec++ -o tcs.fastgx $timlibs  -Ofast timed_chaotic_system.cpp
snaptest66$ ./tcs.fastgx
tcs.fastgx:/usr/local/lib/libestdc++.so.19.0: /usr/lib/libc++abi.so.1.0
: WARNING: symbol(_ZTVN10__cxxabiv129__pointer_to_member_type_infoE)
size mismatch, relink your program
tcs.fastgx:/usr/local/lib/libestdc++.so.19.0: /usr/lib/libc++abi.so.1.0
: WARNING: symbol(_ZTVN10__cxxabiv117__pbase_type_infoE) size mismatch,
relink your program
...etc....about a dozen similar symbols....
Segmentation fault (core dumped)
snaptest66$ ldd tcs.fastgx
tcs.fastgx:
         Start            End              Type  Open Ref GrpRef Name
         00000e2785f57000 00000e2785f6a000 exe   2    0   0      
tcs.fastgx
         00000e29b65b0000 00000e29b65ba000 rlib  0    1   0      
/usr/local/lib/libboost_timer.so.9.0
         00000e2a2178f000 00000e2a21958000 rlib  0    1   0      
/usr/local/lib/libestdc++.so.19.0
         00000e2987145000 00000e2987174000 rlib  0    5   0      
/usr/lib/libm.so.10.1
         00000e2a29dd0000 00000e2a29ec4000 rlib  0    1   0      
/usr/lib/libc.so.95.1
         00000e2a5c1eb000 00000e2a5c1f5000 rlib  0    1   0      
/usr/local/lib/libboost_chrono.so.9.0
         00000e29a762d000 00000e29a7634000 rlib  0    2   0      
/usr/local/lib/libboost_system.so.9.0
         00000e29b5bc8000 00000e29b5ca4000 rlib  0    3   0      
/usr/lib/libc++.so.3.0
         00000e29be4d8000 00000e29be51a000 rlib  0    4   0      
/usr/lib/libc++abi.so.1.0
         00000e2a5884c000 00000e2a58859000 rlib  0    3   0      
/usr/lib/libpthread.so.26.1
         00000e2a2c0f3000 00000e2a2c0f3000 ld.so 0    1   0      
/usr/libexec/ld.so


which is to say both clang libc++ and libc++abi and gcc libestdc++ are
linked.

Using purely clang c++ works ok:

snaptest66$ c++ -o tcs.fastx $timlibs  -Ofast timed_chaotic_system.cpp
snaptest66$ ./tcs.fastx
100000  0.905083        1.28992e-05     -14.5717
...etc...known good output...


Is this even possible (should I stop now) or is it something I am
doing incorrectly?

thanks

John



snaptest66$ sysctl kern.version
kern.version=OpenBSD 6.6-beta (GENERIC.MP) #242: Fri Aug 23 09:06:40 MDT
2019
     [hidden email]:/usr/src/sys/arch/amd64/compile/GENERIC.MP



snaptest66$ pkg_info
boost-1.66.0p6      free peer-reviewed portable C++ source libraries
bzip2-1.0.8         block-sorting file compressor, unencumbered
flang-8.0.0.20190801 LLVM Fortran compiler passes and runtime library
flang-driver-8.0.0.20190621p0 LLVM Fortran compiler driver
g++-8.3.0p3         GNU compiler collection: C++ compiler
g95-8.3.0p3         GNU compiler collection: f95 compiler
gcc-8.3.0p3         GNU compiler collection: core C compiler
gcc-libs-8.3.0p3    GNU compiler collection: support libs
gettext-runtime-0.20.1p0 GNU gettext runtime libraries and programs
gmp-6.1.2p3         library for arbitrary precision arithmetic
icu4c-64.2p0        International Components for Unicode
intel-firmware-20190618p0v0 microcode update binaries for Intel CPUs
libaio_compat-5.2.2 port of POSIX asynchronous I/O routines from
DragonFly BSD
libexecinfo-0.3p2v0 clone of backtrace facility found in the GNU libc
libffi-3.2.1p5      Foreign Function Interface
libiconv-1.16p0     character set conversion library
libmpc-0.9p2        complex numbers math library
libomp-8.0.0p1      LLVM OpenMP runtime
libpgmath-8.0.0.20190801 LLVM Fortran math library
mpfr-3.1.5.2p1      library for multiple-precision floating-point
computations
python-2.7.16p1     interpreted object-oriented programming language
python-3.7.4        interpreted object-oriented programming language
quirks-3.173        exceptions to pkg_add rules
sqlite3-3.29.0      embedded SQL implementation
xz-5.2.4            LZMA compression and decompression tools

Reply | Threaded
Open this post in threaded view
|

Re: mixing clang C++ and GNU C++ ?

Stuart Henderson
On 2019-08-23, [hidden email] <[hidden email]> wrote:

> I'm trying some boost library examples, on amd64, using -current.  When
> building with clang it works ok, but using eg++ results in load-time
> failure:
>
>
> snaptest66$ timlibs="-I/usr/local/include -L/usr/local/lib
> -lboost_timer"
>
> snaptest66$ ec++ -o tcs.fastgx $timlibs  -Ofast timed_chaotic_system.cpp
> snaptest66$ ./tcs.fastgx
> tcs.fastgx:/usr/local/lib/libestdc++.so.19.0: /usr/lib/libc++abi.so.1.0
>: WARNING: symbol(_ZTVN10__cxxabiv129__pointer_to_member_type_infoE)
> size mismatch, relink your program
> tcs.fastgx:/usr/local/lib/libestdc++.so.19.0: /usr/lib/libc++abi.so.1.0
>: WARNING: symbol(_ZTVN10__cxxabiv117__pbase_type_infoE) size mismatch,
> relink your program
> ...etc....about a dozen similar symbols....
> Segmentation fault (core dumped)

Things will go badly (many conflicting symbols) if you pull in both
libc++ and libestdc++ to the same address space. You will need to
rebuild boost (and any other C++ libraries involved) with gcc if
you want to do this.