LibCxxOnOlderSystems - and more software that is pushing for gcc

Chris Jones jonesc at hep.phy.cam.ac.uk
Sun Sep 25 06:25:18 PDT 2016



On 25 Sep 2016, at 1:29 pm, Ken Cunningham <ken.cunningham.webuse at gmail.com> wrote:

>> 
>> The problem is not really about libc++; it's about mixing multiple C++
>> runtimes.
> 
> Indeed.
> 
> What is happening exactly on my MacPros running 10.11, I wonder? Software installed by macports on 10.11 is using clang++ (mostly) and g++ (sometimes). clang++ is linking against libc++, and g++ is presumably  linking against libstdc++ as that is what it does -- yet there appear to be no visible issues...and these libraries find each other. 

Thats just the point, there might not *appear* to be problems. You can actually have an application using libraries built with each runtime, seemingly run just fine, as long as the two runtimes do not attempt to exchange (incompatible) information. For instance, the std::string class has a different implementation between the two, and attempting to between the two will cause issues. In your cases you are probably being lucky and not tripping over the issue.

> 
> Why exactly is the situation different on a LibCxxOnOlderSystems installation?

Because you are mixing the two runtimes more often, and thus more likely to run into problems.

The bottom line is whilst you might be able to get away with it in a few corner cases, you cannot reliably mix the two runtimes, so it should nit be done.

Chris

> 
> 
>> As far as I know, you can use the C or Fortran
>> compilers as much as you'd like. Several ports do this for various
>> reasons. 
> 
> But not easily to link c++ code against libc++. I sent the link on how to do that previously, and may be forced to explore that. It just looks like a lot of messing with the compiler commands on every port using g++, which seems unpleasant -- unless I were to wrap g++ in a shell script that does it automatically, perhaps...
> <http://libcxx.llvm.org/docs/UsingLibcxx.html#using-libc-with-gcc>
> 
> 
>> These dependencies are coming from the +gfortran variants, which
>> instruct the builds to use the Fortran compiler from gcc6. This is fine
>> and expected.
> 
> but won't work on LibCxxOnOlderSystems, if it links the binaries against lilbstdc++
> 
>> What links against libstdc++, specifically?
> 
> gcc6 itself, at least. And by default at least, any c++ code gcc would compile 
> 
>> 
>> Jeremy unfortunately cannot do much of anything about GCC. I believe
>> Apple employees are not allowed to look at GPL3 code.
> 
> I wasn't thinking he'd need to read the gcc compiler code.
> 
>> I wouldn't be surprised if GCC used C++11 features. It doesn't really
>> matter because it is self-hosted.
> 
> It's an alternative way to get c++11 code compiled; I was just noticing that clang++/libc++ aren't the only option for c++11.
> 
> 
> It would appear there are a few choices.
> 
> 1. give up and accept it's an either / or situation
> 2. just let it go on, and see how it works with cross linking -- is this what 10.11 macports does?
> 3. figure out how to make this work: <http://libcxx.llvm.org/docs/UsingLibcxx.html#using-libc-with-gcc>, possibly by wrapping g++ in a shell script that does it for every use.
> 4. a parallel installation of macports with libstdc++ and gcc, to install gimp, octave, qemu, and whatever other similar gcc-requiring ports come along.
> 
> 
> 
> K
> _______________________________________________
> macports-users mailing list
> macports-users at lists.macosforge.org
> https://lists.macosforge.org/mailman/listinfo/macports-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-users/attachments/20160925/50cdd5d6/attachment.html>


More information about the macports-users mailing list