Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 467278 - x11-libs/cairo-1.12.14 fails to build on PPC: lto1 out of memory
Summary: x11-libs/cairo-1.12.14 fails to build on PPC: lto1 out of memory
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: PPC Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-25 21:17 UTC by Alex
Modified: 2014-05-21 11:40 UTC (History)
4 users (show)

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


Attachments
build.log (build.log,341.95 KB, text/plain)
2013-04-25 21:20 UTC, Alex
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex 2013-04-25 21:17:24 UTC
cairo builds fine but fails when linking:
lto1: out of memory allocating 2751725580 bytes after a total of 540672 bytes

that seems to be a LOT of memory to allocate.

this happens in a gentoo chroot over debian sid install (3.2.0-4-powerpc kernel). I didn't built own kernel yet, but I doubt that it causes this bug.

system is iBook G3 (1st gen), 300MHz CPU, 320M RAM.

Reproducible: Always

Steps to Reproduce:
1. emerge -1 \=x11-libs/cairo-1.12.14

Actual Results:  
that error

Expected Results:  
emerged cairo

emerge --info output:

Portage 2.1.11.62 (default/linux/powerpc/ppc32/13.0, gcc-4.7.2, glibc-2.17, 3.2.0-4-powerpc ppc)
=================================================================
System uname: Linux-3.2.0-4-powerpc-ppc-740-750-with-gentoo-2.2
KiB Mem:      317672 total,     22260 free
KiB Swap:    5242868 total,   5220480 free
Timestamp of tree: Sun, 21 Apr 2013 18:45:01 +0000
ld GNU ld (GNU Binutils) 2.23.1
distcc 3.1 powerpc-unknown-linux-gnu [enabled]
app-shells/bash:          4.2_p45
dev-lang/python:          2.7.3-r3, 3.2.3-r2
dev-util/pkgconfig:       0.28
sys-apps/baselayout:      2.2
sys-apps/openrc:          0.11.8
sys-apps/sandbox:         2.6-r1
sys-devel/autoconf:       2.13, 2.69
sys-devel/automake:       1.11.6, 1.12.6, 1.13.1
sys-devel/binutils:       2.23.1
sys-devel/gcc:            4.5.4, 4.7.2-r1
sys-devel/gcc-config:     1.8
sys-devel/libtool:        2.4.2
sys-devel/make:           3.82-r4
sys-kernel/linux-headers: 3.8 (virtual/os-headers)
sys-libs/glibc:           2.17
Repositories: gentoo
ACCEPT_KEYWORDS="ppc ~ppc"
ACCEPT_LICENSE="*"
CBUILD="powerpc-unknown-linux-gnu"
CFLAGS="-O2 -mcpu=powerpc -mtune=powerpc -fno-strict-aliasing -pipe"
CHOST="powerpc-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-O2 -mcpu=powerpc -mtune=powerpc -fno-strict-aliasing -pipe"
DISTDIR="/usr/portage/distfiles"
FCFLAGS="-O2 -pipe"
FEATURES="assume-digests binpkg-logs config-protect-if-modified distcc distlocks ebuild-locks fixlafiles merge-sync news parallel-fetch protect-owned sandbox sfperms splitdebug strict unknown-features-warn unmerge-logs unmerge-orphans userfetch xattr"
FFLAGS="-O2 -pipe"
GENTOO_MIRRORS="http://portage.org.ua/ http://distfiles.gentoo.org/"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://portage.org.ua/gentoo-portage"
USE="X acl bash-completion berkdb bindist bzip2 caps cli consolekit cracklib crypt cxx dbus dri fortran gdbm gif gpm iconv ipv6 jpeg modules mudflap ncurses nls nptl opengl openmp pam pcre png policykit ppc readline session sqlite ssl svg tcpd threads unicode xattr xcb zlib zsh-completion" ALSA_CARDS="aoa aoa-fabric-layout aoa-onyx aoa-soundbus aoa-soundbus-i2s aoa-tas aoa-toonie powermac usb-audio via82xx" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="kexi words flow plan sheets stage tables krita karbon braindump" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LIBREOFFICE_EXTENSIONS="presenter-console presenter-minimizer" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php5-3" PYTHON_SINGLE_TARGET="python2_7" PYTHON_TARGETS="python2_7 python3_2" RUBY_TARGETS="ruby18 ruby19" USERLAND="GNU" VIDEO_CARDS="fbdev glint mach64 mga nv r128 radeon savage tdfx trident dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, USE_PYTHON

gcc -v output:
Using built-in specs.
COLLECT_GCC=/usr/powerpc-unknown-linux-gnu/gcc-bin/4.7.2/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/powerpc-unknown-linux-gnu/4.7.2/lto-wrapper
Target: powerpc-unknown-linux-gnu
Configured with: /var/tmp/portage/sys-devel/gcc-4.7.2-r1/work/gcc-4.7.2/configure --prefix=/usr --bindir=/usr/powerpc-unknown-linux-gnu/gcc-bin/4.7.2 --includedir=/usr/lib/gcc/powerpc-unknown-linux-gnu/4.7.2/include --datadir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/4.7.2 --mandir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/4.7.2/man --infodir=/usr/share/gcc-data/powerpc-unknown-linux-gnu/4.7.2/info --with-gxx-include-dir=/usr/lib/gcc/powerpc-unknown-linux-gnu/4.7.2/include/g++-v4 --host=powerpc-unknown-linux-gnu --build=powerpc-unknown-linux-gnu --disable-altivec --disable-fixed-point --without-ppl --without-cloog --enable-lto --enable-nls --without-included-gettext --with-system-zlib --enable-obsolete --disable-werror --enable-secureplt --disable-multilib --enable-libmudflap --disable-libssp --enable-libgomp --with-python-dir=/share/gcc-data/powerpc-unknown-linux-gnu/4.7.2/python --enable-checking=release --disable-libgcj --enable-libstdcxx-time --enable-languages=c,c++,fortran --enable-shared --enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu --enable-targets=all --with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.7.2-r1 p1.6, pie-0.5.5'
Thread model: posix
gcc version 4.7.2 (Gentoo 4.7.2-r1 p1.6, pie-0.5.5)
Comment 1 Alex 2013-04-25 21:20:24 UTC
Created attachment 346604 [details]
build.log
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2013-04-26 16:03:27 UTC
I am sure this is entirely unrelated to the other bugs complaining about the unwanted LTO injection.
Comment 3 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-04-20 18:58:26 UTC
Irrespective of whether injecting the flag is a good idea or not, lto should not be taking 2.6 G memory for a tiny library like cairo. This looks like a gcc bug.
Comment 4 Ryan Hill (RETIRED) gentoo-dev 2014-04-21 01:19:27 UTC
As long as you're building with LTO then you get to fix the bugs.  This is just one of the many reasons your package shouldn't use it.
Comment 5 Ryan Hill (RETIRED) gentoo-dev 2014-04-21 01:22:12 UTC
I should say though, that 2.6G of memory for cairo is pretty reasonable.
Comment 6 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-04-21 02:01:10 UTC
(In reply to Ryan Hill from comment #5)
> I should say though, that 2.6G of memory for cairo is pretty reasonable.

In that case, I suppose disabling lto really is the best solution :/
Comment 7 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-05-02 19:36:10 UTC
In my experiments (using gcc-4.7.3-r1 and 4.8.2 on amd64), it looks like a cairo build with lto at peak will take 500-700 MB memory. In light of http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48978 the 2.76 GB allocation that you saw appears to have been a bug in early 4.7.x releases, and hopefully was fixed in 4.7.3.

However, in any case, on a 320MB iBook G3, lto will need to be disabled.
Comment 8 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-05-02 21:51:48 UTC
+*cairo-1.12.16-r3 (02 May 2014)
+
+  02 May 2014; Alexandre Rostovtsev <tetromino@gentoo.org>
+  +cairo-1.12.16-r3.ebuild, cairo-9999.ebuild,
+  +files/cairo-1.12.16-all-clipped-1.patch,
+  +files/cairo-1.12.16-all-clipped-2.patch,
+  +files/cairo-1.12.16-all-clipped-3.patch,
+  +files/cairo-1.12.16-lto-optional.patch, metadata.xml:
+  Fix firefox crash (bug #507478, thanks to Jaak Ristioja and Patrice
+  Levesque). Make lto optional (but enabled by default because cairo is a
+  performance-critical library) and check for enough memory for it (bug
+  #467278, thanks to Alex). Fix build with USE="opengl -X" (bug #483574, thanks
+  to Sergey Popov).
Comment 9 Michael Wilcox 2014-05-05 20:16:29 UTC
FYI. cairo-1.12.16-r3 compiled with lto in this environment:

$ emerge --info
Portage 2.2.10 (default/linux/powerpc/ppc32/13.0/desktop, gcc-4.8.1, glibc-2.19, 3.14.1-gentoo ppc)
=================================================================
System uname: Linux-3.14.1-gentoo-ppc-740-750-with-gentoo-2.2
KiB Mem:      438472 total,    135796 free
KiB Swap:    2097148 total,   2077588 free
Comment 10 Alexandre Rostovtsev (RETIRED) gentoo-dev 2014-05-05 20:24:55 UTC
(In reply to Michael Wilcox from comment #9)
> FYI. cairo-1.12.16-r3 compiled with lto in this environment:
> 
> $ emerge --info
> Portage 2.2.10 (default/linux/powerpc/ppc32/13.0/desktop, gcc-4.8.1,
> glibc-2.19, 3.14.1-gentoo ppc)
> =================================================================
> System uname: Linux-3.14.1-gentoo-ppc-740-750-with-gentoo-2.2
> KiB Mem:      438472 total,    135796 free
> KiB Swap:    2097148 total,   2077588 free

Interesting, maybe lto takes less memory on ppc because it's 32-bit.

Could you measure the max memory usage? For example, run

# USE=lto I_KNOW_WHAT_I_AM_DOING=yes busybox time -v emerge -1 cairo

and look at the "Maximum resident set size" line in the final output.
Comment 11 Gabriel Marcano 2014-05-21 11:40:14 UTC
Hardware is a bit different than a PPC (ARMv6zk 32-bit Raspberry Pi), but since I ran into the problem of not having enough RAM as required by the current ebuild for all architectures, I'm posting my results here. The only thing that's different is that I'm using distcc to speed up compilation (I'm unsure if this has any impact with lto).

According to "time" this was my memory usage during compilation:
Maximum resident set size (kbytes): 187808

Here is my system information:
emerge --info
Portage 2.2.10 (default/linux/arm/13.0/armv6j/desktop, gcc-4.8.2, glibc-2.17, 3.14.2+ armv6l)
=================================================================
System uname: Linux-3.14.2+-armv6l-with-gentoo-2.2
KiB Mem:      475680 total,    310616 free
KiB Swap:     999996 total,    995180 free