Hello, cairo-1.10.2-r1 fails to build with gcc-4.5.2 compiled with lto support. I do not use -flto in my *FLAGS, but built gcc with its support for some software testing. Cairo configure script finds out that -flto is supported, adds it to *FLAGS and fails to build due to lto gcc internal bug: checking whether i686-pc-linux-gnu-gcc supports -flto... yes [...] lto1: internal compiler error: bytecode stream: trying to read 0 bytes after the end of the input buffer Please submit a full bug report, with preprocessed source if appropriate. See <http://bugs.gentoo.org/> for instructions. lto-wrapper: /usr/i686-pc-linux-gnu/gcc-bin/4.5.2/i686-pc-linux-gnu-gcc returned 1 exit status collect2: lto-wrapper returned 1 exit status After I added -fno-lto to my CFLAGS/CXXFLAGS/LDFLAGS, cairo compiles without problem. I suggest either configure script patch in order to remove -flto, because it is not supported by Gentoo at this moment, or add -flto to compile flags.
Created attachment 260355 [details] build.log
Created attachment 260356 [details] environment
Created attachment 260358 [details] emerge --info
I'd say you did find a genuine compiler bug, but a different one than you think. One that Id call "'-flto' fails with excessive CFLAGS". If it weren't for your bug report, I wouldn't even notice, that I've built cairo with '-flto' on.
Huh, with MAKEOPTS="-j1" FEATURES="-ccache -distcc" it builds well. It looks like -flto is unhappy with ccache or distcc. Or, maybe, this bug is volatile and may or may not occur depending on some randomness of the internal gcc state.
A similar problem: lto1: internal compiler error: in lto_reissue_options, at lto-opts.c: 418 Compiler gcc-4.6.1_pre9999. Distcc and ccache enabled, MAKEOPTS = "-j9". As advised by Andrew Savchenko, add in make.conf "-fno-lto" and Cairo successfully compile.
there is a patch atached to this bug that may be helpful here https://bugs.freedesktop.org/show_bug.cgi?id=39114
(In reply to comment #7) > there is a patch atached to this bug that may be helpful here > https://bugs.freedesktop.org/show_bug.cgi?id=39114 This patch will only disable -flto if it fails. It doesn't fix the real problem: distcc mishandles -flto. Cairo is not the only package that fails, unbound is another good example.
spatz maintains this now.
Looks like this is a distcc bug, not a cairo issue. Re-assigning.
There are two bugs here: 1) Cairo forces -flto. CFLAGS should be respected. 2) distcc doesn't support LTO at all. I don't know why but this problem is very serious. Looks like a deep knowledge of LTO internals is required to fix distcc, if this fix is possible at all.
No, this even happens without distcc, and distcc should backtrack and try to compile locally in any case. If it does not, then that is a separate bug.
Created attachment 337238 [details, diff] cairo-1.10.2-lto.patch
If you want this included, please send the patch to upstream's development mailing list.
Build cairo-1.10.2-r3 using armv7a-hardfloat-linux-gnueabi-gcc-4.6.3 with distcc enabled, and failed as this bug reported. Disable distcc then build succeeded.
This should be fixed in >=cairo-1.12.2 (it adds a better configure check for -flto). Please check.
Should be fixed for a while now.