Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 352230 - x11-libs/cairo-1.10.2-r1 - lto1: internal compiler error: bytecode stream: trying to read 0 bytes after the end of the input buffer
Summary: x11-libs/cairo-1.10.2-r1 - lto1: internal compiler error: bytecode stream: tr...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: x86 Linux
: High normal
Assignee: Gentoo Cluster Team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2011-01-20 12:44 UTC by Andrew Savchenko
Modified: 2015-02-21 21:57 UTC (History)
8 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log (build.log,244.78 KB, text/plain)
2011-01-20 12:46 UTC, Andrew Savchenko
Details
environment (environment,122.80 KB, text/plain)
2011-01-20 12:46 UTC, Andrew Savchenko
Details
emerge --info (emerge-info,7.74 KB, text/plain)
2011-01-20 12:46 UTC, Andrew Savchenko
Details
cairo-1.10.2-lto.patch (cairo-1.10.2-lto.patch,437 bytes, patch)
2013-01-29 15:37 UTC, Jeroen Roovers (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Savchenko gentoo-dev 2011-01-20 12:44:36 UTC
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.
Comment 1 Andrew Savchenko gentoo-dev 2011-01-20 12:46:04 UTC
Created attachment 260355 [details]
build.log
Comment 2 Andrew Savchenko gentoo-dev 2011-01-20 12:46:19 UTC
Created attachment 260356 [details]
environment
Comment 3 Andrew Savchenko gentoo-dev 2011-01-20 12:46:44 UTC
Created attachment 260358 [details]
emerge --info
Comment 4 Rafał Mużyło 2011-01-20 13:08:21 UTC
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.
Comment 5 Andrew Savchenko gentoo-dev 2011-01-20 15:10:51 UTC
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.
Comment 6 Alexander 2011-07-01 14:59:26 UTC
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.
Comment 7 David J Cozatt 2011-07-29 02:25:45 UTC
there is a patch atached to this bug that may be helpful here
https://bugs.freedesktop.org/show_bug.cgi?id=39114
Comment 8 Andrew Savchenko gentoo-dev 2011-08-02 10:05:29 UTC
(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.
Comment 9 Doug Goldstein (RETIRED) gentoo-dev 2012-07-14 19:21:57 UTC
spatz maintains this now.
Comment 10 Ben de Groot (RETIRED) gentoo-dev 2012-07-24 14:21:02 UTC
Looks like this is a distcc bug, not a cairo issue. Re-assigning.
Comment 11 Andrew Savchenko gentoo-dev 2012-07-24 19:21:47 UTC
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.
Comment 12 Jeroen Roovers (RETIRED) gentoo-dev 2013-01-29 14:55:11 UTC
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.
Comment 13 Jeroen Roovers (RETIRED) gentoo-dev 2013-01-29 15:37:55 UTC
Created attachment 337238 [details, diff]
cairo-1.10.2-lto.patch
Comment 14 Chí-Thanh Christopher Nguyễn gentoo-dev 2013-01-29 15:40:54 UTC
If you want this included, please send the patch to upstream's development mailing list.
Comment 15 Changyuan Yu 2013-02-24 11:17:38 UTC
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.
Comment 16 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-04-20 18:54:31 UTC
This should be fixed in >=cairo-1.12.2 (it adds a better configure check for -flto). Please check.
Comment 17 Matt Turner gentoo-dev 2015-02-21 21:57:01 UTC
Should be fixed for a while now.