tech-pkg archive

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

Re: pre-C++11 compilers



On 07/01/17 09:27, coypu%sdf.org@localhost wrote:
My understanding is the following:

libstdc++ is mostly backwards compatible, but nowhere near forward
compatible. If we ever use more than one libstdc++, we want to use the
newest for all dependencies.

If it's a leaf C++ package, it's easy - just use the newer GCC to build
it too, and by using g++ it will pull in the newer libstdc++ always.
Most packages that needed it were probably like this. Also, leaf
packages being broken is easy to miss.

If it's a C package, it becomes problematic. using a newer GCC isn't
sufficient to guarantee that a newer libstdc++ will be picked, and it
depends on the link order.

Now we have packages like icu and MesaLib requiring it, which have very
many dependencies, so the chance of encountering the broken scenario is
likely.

NetBSD specifically has an extra complication because it major bumped
libstdc++ in base but pkgsrc GCC still creates the old soname.
I think libstdc++.so.7 and libstdc++.so.6 appear as different libraries?
That should probably be fixed.

I should restore the change to make MesaLib not use the dri option for
older compilers, but luckily it is also controllable by options.

FreeBSD ports allows mixing compilers, so we might learn something from the history there. Constructs like

USES=compiler:c++11-lang

USES=compiler:c++11-lib

do guarantee that a c++11 capable compiler will be used, although this is no longer very important since FreeBSD 9 is beyond EOL. That was the last release using GCC 4.2 as a base compiler.

On FreeBSD 10+, the base clang supports c++11, so the mixing that has to be supported going forward is mostly clang 3.x with GCC 4.x. Very few ports still require GCC, so it's mainly used within ports to provide Fortran.

Most of the problems I've seen with this are indeed caused by libstdc++ compatibility.

One of the workarounds I've used a couple of times is this hack:

CXXFLAGS+= -D_GLIBCXX_USE_C99 -D_GLIBCXX_USE_C99_MATH -D_GLIBCXX_USE_C99_MATH_TR1

Cheers,

    JB

--
Earth is a beta site.



Home | Main Index | Thread Index | Old Index