pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Installing clang alongside GCC on NetBSD 9





On 21/03/2020 15:35, Rhialto wrote:
On Sun 08 Mar 2020 at 11:45:24 -0500, Jason Bacon wrote:
With C++, it's complicated and I don't claim to understand all the issues in
detail. C++ is still evolving rapidly and different major versions of GCC
do not guarantee ABI compatibility or even API compatibility in all cases.

Interestingly, I recently read some proposal to clean up part of the C++
standard library, which (according to the author) had not been done so
far because ABI compatibility was to be preserved. This puzzled me,
since it directly contradicts what you say above (and which I had read
many times before).

https://cor3ntin.github.io/posts/abi/

Actually breakage in gcc isn't a given. On linux at least you can fairly safely take a binary built on an older g++ and expect it to run with a newer c++ library. Don't know how that reflects in NetBSD but I will say that I've never had a problem with any of the binaries built by pkgsrc that have been built mostly with the system c/c++ compiler with the binaries that have been built with something else.

clang has its owns (slightly different) C++ standard library so mixing clang compiled C++ and gcc compiled c++ might get a bit odd. Even then from experience on linux you don't tend to notice unless you attempt to debug clang code with gdb. The gdb python wrappers that present c++ objects sensibly can't unpick the clang STL. LLDB does work in that case though.

Installing clang along side the system gcc works just fine I've run with this on both 8.x and 9.0 without issue.

Things were radically different in the earlier days of C++. The library interface was not so stable and library breakage was a lot more common. The core language of C++ has been mostly stable since 2003. Since then the language syntax has changed to make it syntactically easier for C++ users to do things that the standard library does (which were possibly but very ugly to express). I do wonder if some of the ABI paranoia is left over from those days (when it really was risky to run a C++ binary against anything other than the library it was built against).

Mike


Home | Main Index | Thread Index | Old Index