Was the clang <> GCC 5 ABI incompatibility overcome at some point?

Kenneth F. Cunningham ken.cunningham.webuse at gmail.com
Tue May 19 15:08:12 UTC 2020

> Hi!
> I remember a few years ago when a change in GCC 5 caused ABI
> incompatibility with clang. I'm searching for updates on this, and it seems
> like clang applied the same change eventually, but can they considered
> binary compatible at this moment? Is it now safe to link object code coming
> from GCC and from clang?
> Thanks!
> C├ęsar

The issue is not so much with the compiler as with the c++ standard library.

Any compiler can use any c++ standard library.

But *by default* (1) clang will use libc++ and gcc will use libstdc++, and these are not compatible with each other.

So if you are going to mix objects (and libraries) coming out of clang and gcc, you have to be sure that they all use the same c++ standard library. 

With c++ code, that is quite tricky to do properly.

If you use gcc just to build "c" code, or fortran code, there is no problem mixing those libraries or objects with clang c++ code.


1. By default, on current MacOS and on all MacOS on MacPorts. Further needless and sometimes confusing detail omitted for clarity of focus, ask if truly curious. -K

More information about the macports-users mailing list