unable to compile llvm with gcc 4.7.4

Hi,

Encounter a compilation issue related to c++.

Software versions:
  - gcc 4.7.4
  - llvm git commit 98a1ca117e6743dd7f2d505443a96f591d083eab

Build log:

Scanning dependencies of target LLVMLTO
[ 53%] Building CXX object lib/LTO/CMakeFiles/LLVMLTO.dir/Caching.cpp.o
/tmp/pkgs/llvm/lib/LTO/Caching.cpp: In lambda function:
/tmp/pkgs/llvm/lib/LTO/Caching.cpp:74:7: error: looser throw specifier for 'virtual llvm::lto::localCache(std::string, llvm::lto::AddFileFn)::<lambda(unsigned int, llvm::StringRef)>::CacheStream::~CacheStream()'
In file included from /tmp/pkgs/llvm/include/llvm/LTO/Caching.h:18:0,
                 from /tmp/pkgs/llvm/lib/LTO/Caching.cpp:14:
/tmp/pkgs/llvm/include/llvm/LTO/LTO.h:271:11: error: overriding 'virtual llvm::lto::NativeObjectStream::~NativeObjectStream() noexcept (true)'
lib/LTO/CMakeFiles/LLVMLTO.dir/build.make:67: recipe for target 'lib/LTO/CMakeFiles/LLVMLTO.dir/Caching.cpp.o' failed
make[2]: *** [lib/LTO/CMakeFiles/LLVMLTO.dir/Caching.cpp.o] Error 1
CMakeFiles/Makefile2:2584: recipe for target 'lib/LTO/CMakeFiles/LLVMLTO.dir/all' failed
make[1]: *** [lib/LTO/CMakeFiles/LLVMLTO.dir/all] Error 2
Makefile:149: recipe for target 'all' failed
make: *** [all] Error 2

Is this the right mailing list to report compilation error? I tried to get a
bugzilla account, unsuccessfully.

+pcc who added the NativeObjectStream class

Looks like a known gcc bug, fixed in 4.8:https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53613

Not sure what we do in cases like this, if it is a gcc bug.

The compilation of many tools makes gcc 4.7.4 crash with an internal compilation
errors.

Is there a new official stand regarding gcc 4.7 and llvm?

Because docs/CodingStandards.rst and docs/GettingStarted.rst reference gcc 4.7
as a supported c++ compiler (with c++11-ish and c++98).

regards,

gcc 4.7 is considered supported, as pointed by the documentation.

If we don’t have bots that build with it though, it is hard to back this claim in practice though…

Yeah, we've been particularly bad in keeping track of old compilers.

There are still plenty of GCC 4.8 buildbots, but not 4.7, I think.

I doubt we have bots with clang 3.1 either... :confused:

cheers,
--renato

Then? How to proceed?

regards,

Submit a patch seems like the best way forward on the short term.

On the medium term, we should have a discussion in the community about adding bots for our minimum version.

>
> Then? How to proceed?

Submit a patch seems like the best way forward on the short term.

Ok, the authors of the targetted code need to proceed to a re-design of their
code regarding the use of c++ features.
The git log tells me:
- Peter Collingbourne <pcc@google.com>
- Teresa Johnson <tejohnson@google.com>

On the medium term, we should have a discussion in the community about adding
bots for our minimum version.

Those bots should have been the first to be set up. Hope you can fix this soon.

We had 4.7 bots for a long time, but migrations happen, and we
probably (separately) didn't expect to be the last 4.7 ones. This was
a coordination problem.

Now, there are talks to upgrade the GCC version from 4.7, but we can't
do 4.9 because many stable distributions still 4.8, but we can do 4.8,
which has enough buildbots (and will for the long term).

I'm not saying this is a "fix" for your problem, but your problem
would happen any time soon when we move the GCC version up anyway.

Can you upgrade to 4.8?

cheers,
--renato

Why is it more important to be backward compatible with ancient versions of GCC than relatively more recent versions of Visual Studio? We are removing support for VS2013 because of defects in that product, yet GCC v4.7.x is more ancient than VS2013, so why should the answer be any different?

Devil's Advocate,

  MartinO

To the best of my understanding - because we want to be able to bootstrap clang with the system compiler that ships with various linux and BSD distributions.
Windows has no equivalent concept.

(This is probably not a good enough reason to keep GCC 4.7 support, but it apparently is for GCC 4.8).

Michael

+1 for calling 4.8 the minimum version. It appears that the last time 4.7 (at least, the one in ubuntu, “gcc-4.7 (Ubuntu/Linaro 4.7.3-12ubuntu1) 4.7.3”) could actually compile clang was July 8th – about 3 months ago.

Besides this reported error, it also doesn’t like “<::”, which have been introduced in various places, it has some issue with the lambda in clang/lib/StaticAnalyzer/Checkers/MallocOverflowSecurityChecker.cpp (even after the commit which says it fixes it), and possibly more issues besides (I didn’t attempt to comprehensively catalog the errors).

4.8 is the oldest shipped version on many stable LTS Linux and BSD
releases. Simple as that. :slight_smile:

Upgrading to 4.9 or later will not be possible any time soon, due to
multiple bugs we're finding and fixing on newer versions of libstdc++,
glibc, binutils that is bundled with them.

So I am, and will be relying on 4.8 for the next year or so, and so
will many other people in the community (some more than a year).

cheers,
--renato

Also, as of January 1 2017 FreeBSD will have Clang 3.4.1 or newer as
the system compiler on all supported tier-1 architectures. I'm not
sure what other open source operating systems or distributions are
using Clang as their system compiler, but I suspect the same argument
for GCC 4.8 can be made for Clang 3.4 as a minimum.

For your information:

gcc 4.7.4 is the last C boostrapable c++98-ish compiler/runtime.

We are going towards a world where only a modern c++ compiler will be able to
compile a modern c++ compiler.

Once critical system components/applications are hard dependent on modern c++,
that will phase out C only compilers for any standard usage.

Coding a C only compiler alternative is a child play compared to coding a modern c++
compiler alternative (even a non-optimizing, naive one).

As a consequence, it will kill in the egg many temptations to write
alternative compilers for standard usage.

my 2c,

To elaborate on this: if you want to produce binaries compatible with
old Linux systems, it is pretty much necessary to build on such an old
Linux system, because otherwise you'll get bitten by glibc ABI issues
(not to mention libstdc++, but at least you can link libstdc++
statically).

Windows has no such problem: you can redistribute a recent MSVCRT DLL
on an old Windows system.

Regards

Antoine.

Then, on the medium term it would be to see if gcc 4.7.4 (the last C
bootstrap-able c++-ish compiler in one step) is phased out from llvm support in
favor of gcc 4.8.

But the short term solution would be to fix current llvm against gcc 4.7.4.

As I said earlier, with the options detailed earlier in this thread, the LTO
cache and some tools have some troubles with gcc 4.7.4.

regards,

> > To the best of my understanding - because we want to be able to
bootstrap
> > clang with the system compiler that ships with various linux and BSD
> > distributions.
> > Windows has no equivalent concept.
>
> To elaborate on this: if you want to produce binaries compatible with
> old Linux systems, it is pretty much necessary to build on such an old
> Linux system, because otherwise you'll get bitten by glibc ABI issues
> (not to mention libstdc++, but at least you can link libstdc++
> statically).

Then, on the medium term it would be to see if gcc 4.7.4 (the last C
bootstrap-able c++-ish compiler in one step) is phased out from llvm
support in
favor of gcc 4.8.

But the short term solution would be to fix current llvm against gcc 4.7.4.

As I said earlier, with the options detailed earlier in this thread, the
LTO
cache and some tools have some troubles with gcc 4.7.4.

I can send a patch to workaround the gcc 4.7.4 bug hitting the LTO compile.
But according to James in an earlier response, there are other places where
gcc 4.7 doesn't compile the current clang toolchain.

So I'd first like to understand whether we still want to keep gcc 4.7 as a
supported version, or move to 4.8 as was suggested. What is the process for
making that change? If we stick with 4.7 we should have a bot otherwise it
will likely stop working again pretty quickly.

Teresa

So I'd first like to understand whether we still want to keep gcc 4.7 as a
supported version, or move to 4.8 as was suggested. What is the process for
making that change?

Same as usual: propose on the list, and hope that no one has any blocking
issues. Going to 4.9 failed because many people had reservations, but IIRC,
none of those people had reservations against 4.8.

If we stick with 4.7 we should have a bot otherwise it will likely stop
working again pretty quickly.

Yes, same for Clang. I suggest we also move to Clang 3.4 as the minimum and
install a quick bot with that.

cheers,
--renato