Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 623156 - sys-devel/gcc-5.4.0-r4 and sys-devel/gcc-6.4.0-r1 fail to build on arm machines with low levels of ram
Summary: sys-devel/gcc-5.4.0-r4 and sys-devel/gcc-6.4.0-r1 fail to build on arm machin...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: ARM Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://gcc.gnu.org/bugzilla/show_bug...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: gcc-6-stable
  Show dependency tree
 
Reported: 2017-06-30 12:08 UTC by tt_1
Modified: 2018-07-22 14:34 UTC (History)
3 users (show)

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


Attachments
dmesg output (dmesg.log,6.54 KB, text/plain)
2017-06-30 12:08 UTC, tt_1
Details
gcc-5.4.0-r3-out-of-memory.log.gz (gcc-5.4.0-r3-out-of-memory.log.gz,27.37 KB, application/gzip)
2017-06-30 12:09 UTC, tt_1
Details
output of emerge --info (emerge.info,4.41 KB, text/plain)
2017-06-30 12:10 UTC, tt_1
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tt_1 2017-06-30 12:08:37 UTC
Created attachment 478442 [details]
dmesg output

I ran into this quite some time ago and thought something was wrong with the flash card I am using to compile, or with the non-Gentoo host system of the chroot. 

Turns out all of this is sane, but genautomata uses high amounts of ram, so that I could not compile gcc-5.4.0-r3 even if I dropped MAKEOPTS to one job and got 900mb of 1gb of ram free before. 

I attached a log of dmesg to prove that it is genautomata which causes the out of memory failure.
Comment 1 tt_1 2017-06-30 12:09:57 UTC
Created attachment 478444 [details]
gcc-5.4.0-r3-out-of-memory.log.gz
Comment 2 tt_1 2017-06-30 12:10:22 UTC
Created attachment 478446 [details]
output of emerge --info
Comment 3 tt_1 2017-06-30 12:41:18 UTC
There is an upstream patch at https://gcc.gnu.org/viewcvs?rev=239772&root=gcc&view=rev

I'm testing it right now, and it seems as if the use of memory is reduced (upstream bug report claims to 316mb) and therefore the critical part of genautomata has compiled succesfully. I will report later on if and when the compile was finished.
Comment 4 tt_1 2017-07-01 08:43:22 UTC
Patch works! Please bump the patchsets of both gcc-5.4.0-r3 and gcc-6.3.0, and since this is a compile failure it would not need a revbump, would it?
Comment 5 Anthony Basile gentoo-dev 2017-07-03 02:31:19 UTC
I pushed pr https://github.com/gentoo/musl/pull/56
Comment 6 tt_1 2017-07-03 04:19:55 UTC
Anthony - thank you for fixing the fix into the musl overlay, it saves musl users from messing around with different slots, etc. pp. However, this issue is not related to the libc! It is a gcc bug, therefore it affects glibc systems too and is not solved by commiting the fix to the musl overlay. 

@toolchain - please add the fix to the patches tarball and fix #622036 too, at the moment the stable! toolchain is badly broken on arm systems.
Comment 7 tt_1 2017-09-03 10:38:02 UTC
Why is this ignored? It is super easy to fix for gcc-5 and gcc-6, simply add the linked patch to the tarball and we are good to go. It is a compile failure, so not even in the need of a revbump. You'd only have to bump the patchset and the Manifest.
Comment 8 Anthony Basile gentoo-dev 2017-09-04 11:51:03 UTC
(In reply to tt_1 from comment #7)
> Why is this ignored? It is super easy to fix for gcc-5 and gcc-6, simply add
> the linked patch to the tarball and we are good to go. It is a compile
> failure, so not even in the need of a revbump. You'd only have to bump the
> patchset and the Manifest.

Can't this wait until the next releases from upstream?
Comment 9 tt_1 2017-09-04 12:22:13 UTC
This is an upstream patch - without it gcc cannot be built on arm, not even with MAKEOPTS="-j1", shouldn't that be enough? I guess from gcc-7.1 or 7.2 on this got merged.
Comment 10 Anthony Basile gentoo-dev 2017-09-04 12:25:04 UTC
(In reply to tt_1 from comment #9)
> This is an upstream patch - without it gcc cannot be built on arm, not even
> with MAKEOPTS="-j1", shouldn't that be enough? I guess from gcc-7.1 or 7.2
> on this got merged.

it works on arm systems with sufficient memory, or if you add swap.  i'm just not sure how many such systems are affected which is why I hesitate doing all this work for a relatively small set of systems.

anyhow, why can't you add swap?
Comment 11 Benda Xu gentoo-dev 2017-09-04 13:34:03 UTC
(In reply to Anthony Basile from comment #10)
> (In reply to tt_1 from comment #9)
> > This is an upstream patch - without it gcc cannot be built on arm, not even
> > with MAKEOPTS="-j1", shouldn't that be enough? I guess from gcc-7.1 or 7.2
> > on this got merged.
> 
> it works on arm systems with sufficient memory, or if you add swap.  i'm
> just not sure how many such systems are affected which is why I hesitate
> doing all this work for a relatively small set of systems.
> 
> anyhow, why can't you add swap?

Just to comment that adding swap does not help.  I am not sure why, but it seems that only RAM can be consumed by genautomata.

My test system was with 1GiB of RAM and 2GiB of swap, when genautomata occupied all the RAM system freezed and soon got rebooted.
Comment 12 tt_1 2017-09-08 08:36:31 UTC
I can test with swap, but if 2 Gigabyte + 1 Gigabyte of ram are not enough there is a chance it won't be enough until genautomata hits the maximum amount of ram which can be adressed by the chip. From what I read in the case of armv6, this is close to 3 Gigabyte. 

User also could download a fresh stage3, chroot into it and extract a fresh copy of gcc-5 via quickpkg. However, the stages for arm have not been updated for a longer time, they still have gcc-4.9.4 and I believe glibc-2.22? 

I don't really know what amount of work the bump of the patchset would mean from your side, but if it involves a lot of compile and runtime testing and you feel that not too many people would benefit from it, please consider to add the patch to  the patchset of gcc-5.5 (if there ever should be) and gcc-6.5 (if there ever should be) so that people have an upgrade option at least.
Comment 13 tt_1 2017-09-14 19:04:11 UTC
To restrict jobs to one via MAKEOPTS="-j1" and 2GB of swap is enough to make it compile for gcc-5.4 and armv7. Still it would be desireable to see the patch inherited into the 5.5 or 6.5 patchset.
Comment 14 tt_1 2017-10-09 21:08:04 UTC
So yeah, I have been using the patch locally for three months now without any issues - is there a chance it is going to be included into the patchsets of gcc-5.4/6.4, or not?
Comment 15 tt_1 2017-10-20 10:08:56 UTC
additional patch/backport for genattrtab in gcc-6.4.0 

https://github.com/gcc-mirror/gcc/commit/ef0792f1418d7d4b99858e7233cd91dfdf2ad9d0

this got fixed from gcc-7 on
Comment 16 tt_1 2018-07-22 14:34:27 UTC
gcc-7.3.0-r3 got stabilized for arm, please ping if there still trouble with this.