Re: OpenBSD crashes - GWorkspace coredumps - mismatched C++ libraries

Riccardo Mottola <[email protected]> Wed, 21 Jul 2021 01:12:26 +0200
Newsgroups gmane.comp.lib.gnustep.devel
Message-ID <[email protected]>
Hi David,


David Chisnall wrote:
> Hi Riccardo,
>
> On 21/05/2021 15:14, Riccardo Mottola wrote:
>> So indeed, once running, there is a mix of:
>>
>>          0f88c000 2f96f000 rlib  0    1   0 
>> /usr/local/lib/libestdc++.so.19.0
>>
>> vs:
>>          08fb7000 28fbd000 rlib  0    2   0 /usr/lib/libc++.so.7.0
>>          0ca18000 2ca1c000 rlib  0    3   0 /usr/lib/libc++abi.so.5.0
>
> That is, indeed, the problem.  You can mix libc++ and libstdc++ 
> (though the types cannot cross a library boundary) but both libc++abi 
> and libsupc++ expose the same symbols and cannot be mixed.  By 
> default, libstdc++ statically links libsupc++.  On FreeBSD, we avoid 
> this by linking both libc++ and libstdc++ against the system-provided 
> libcxxrt.  It looks as if OpenBSD (at least with your egcc build) 
> doesn't do this.

where do you do this logic... is it insite a specific FreeBSD section of 
gnustep-make? I looked for it without finding it.

>
> We need to hook into the C++ runtime library to ensure that 
> Objective-C++ exceptions work.  You need to either:
>
>  - Compile and link the C++ library (PDFKit) against the system C++ 
> implementation (libc++ / libc++abi), or
>  - Compile and link the Objective-C runtime against the extra c++ 
> runtime (libestd++).  Note that libestdc++ is an unusual name and so 
> won't be found by default, you will need to pass this as an explicit 
> option in the libobjc2 build (ccmake will show you the name).

You speak about the Objective-C runtime, but I use the GCC provided one, 
so I don't have control on that.

I noticed that even base is linked about libc++
         0eca7000 2ed8a000 rlib  0    1   0 
/usr/local/lib/libestdc++.so.19.0
         006b8000 206be000 rlib  0    2   0 /usr/lib/libc++.so.7.0
         0e776000 2e77a000 rlib  0    3   0 /usr/lib/libc++abi.so.5.0

So it is already a strange "mix". I checked what I have with the "e" 
prefix in OpenBSD local:
/usr/local/lib/libestdc++.a /usr/local/lib/libesupc++.la
/usr/local/lib/libestdc++.la /usr/local/lib/libexslt.a
/usr/local/lib/libestdc++.so.19.0
/usr/local/lib/libesupc++.a

so the issue is libc++abi as far as you tell me. I'd like to link 
anything about the "new" runtime I have in local coming from gcc 8, 
named egcc (hence the e prefix) how should I do that? tricks in tools make?

I don't think it is easy to have PDFKit link against the system C++ 
libraries, since it compiles with CXX=eg++ and will favour its own library.

Thank you,

Riccardo