tech-pkg archive

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

Re: First go at adding GCC_VERSIONS_ACCEPTED support



On 12 October 2015 at 11:16, atomicules <base%atomicules.co.uk@localhost> wrote:

On 10-Oct-2015 22:50:12, David Sainty wrote:

just want to mention that this style of solution is probably wrong for C++.  The problem with C++ is that, depending on package build ordering, packages may end up linking with multiple stdc++ libraries (and including different c++ includes) from different compilers.

The current GCC_REQD behaviour avoids this problem (at a hefty cost). 

Interesting, because my test case for trying out changes is Taskwarrior which is C++. Although I don't think that last patch was "correct" I don't understand the problem with C++. Perhaps Taskwarrior isn't complicated enough for me to come across these issues? I thought by letting GCC_REQD do it's thing and only afterwards overriding it I'd be ok?

Yes, the scenario I'm thinking of is probably more complicated than any one package could exercise.

Here's what I have in mind:

Say P3a, P3b and L3 are all C++ packages that require GCC 3.0, P4 requires GCC 4.0 and P5 requires GCC 5.0.  We'll assume this is on a system with native GCC 1.0 :)

P3a and P3b are leaf packages that buildlink with L3.

If you happen to install in the order P4, P3a, P5, P3b, you will end up with L3 using GCC 4.0's stdc++ and includes, but P3b will link against GCC 5.0's stdc++ and includes.

But here's an interesting read:

That tells us that actually there are some ABI guarantees that could be rather helpful.  For example, there hasn't been a major bump of libstdc++ since GCC 3.4.0.

I've definitely seen API related breakage, and that page does say "The reverse (backwards compatibility) is not true. It is not possible to take program binaries linked with the latest version of a library binary in a release series (with additional symbols added), substitute in the initial release of the library binary, and remain link compatible.".

So I think it's risky to build with a GCC < the GCC that any of your buildlinked libraries used, but perhaps (?) it's relatively safe to use GCC 5.1.0 to link against C++ libraries built with GCC 3.4.0 - at least until the next major bump.

However, even if that's true, making correct use of it might be difficult.  Though the task might be easier if we just assume that GCC will never major bump again :)



Home | Main Index | Thread Index | Old Index