tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

gcc_compile script - configure options for PiB or Pi3A ?

Thu Apr 22, 2021 12:18 am

I've used the gcc_compile script by @jahboater on a pi4, and that worked fine.

I would like to try it on the rest of the range of pi's that I own - pi0/0w, original (256MB) PiB, old Pi2, Pi3A+, and Pi3B (not B+). The version of the script that I have (for 10.2) contains the following section for configure. I would like confirmation of which bit to use for a couple of my machines:

Code: Select all

echo "Configuring at `date` ..." 1>&2
# x86_64
#../configure --disable-multilib --enable-languages=$LANG

# AArch64 Pi4 in 64-bit mode
#../configure --enable-languages=$LANG --with-cpu=cortex-a72

# Pi Zero
#../configure --enable-languages=$LANG --with-cpu=arm1176jzf-s \
#  --with-fpu=vfp --with-float=hard --build=arm-linux-gnueabihf \
#  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

# Pi3+, Pi3, Pi4 in 32-bit mode
../configure --enable-languages=$LANG --with-cpu=cortex-a53 \
  --with-fpu=neon-fp-armv8 --with-float=hard --build=arm-linux-gnueabihf \
  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf > /dev/null

# Old Pi2
#../configure --enable-languages=$LANG --with-cpu=cortex-a7 \
#  --with-fpu=neon-vfpv4 --with-float=hard --build=arm-linux-gnueabihf \
#  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
I think it's clear which section to use for the Zeros and the old Pi2. I assume I use the currently uncommented section for the Pi3B, perhaps also for the Pi3A+? I could only guess to try the Zero section for the PiB (which is actually the original 256MB model)? Or is that just impossible?

User avatar
jahboater
Posts: 7079
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: gcc_compile script - configure options for PiB or Pi3A ?

Thu Apr 22, 2021 12:35 am

tinker2much wrote:
Thu Apr 22, 2021 12:18 am
I assume I use the currently uncommented section for the Pi3B, perhaps also for the Pi3A+?
Yes.
I've never tried building on a Pi3A but I cant see why it should not work.
tinker2much wrote:
Thu Apr 22, 2021 12:18 am
I could only guess to try the Zero section for the PiB (which is actually the original 256MB model)? Or is that just impossible?
I failed to build GCC on my 256MB Pi1 Ver 1.
You may have better luck!
Yes, the Pi Zero configuration is the one to try, its the same processor.

There has been a new point release by the way, GCC 10.3

tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Thu Apr 22, 2021 12:48 am

I'm currently running as you suggested, but I wonder if I should have bumped the dphys-swapfile amount even more for the 3A+ and PiB - maybe to 1536 and 1792 so that in every case real memory and swap adds up to 2GB?

tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Thu Apr 22, 2021 12:51 pm

I started the gcc_compile script on the Pib(256), the old Pi2, a Pi3a+, and a Pi3B.

All but the PiB failed at the same spot; the PiB has apparently gotten past that point. Of course, they took different amounts of time to do so. Here's the last thirty lines of stdout/stderr, which I had redirected to a file, and then digested a bit since the lines are so long. If ten or fewer words on a line, I printed the whole line, else I printed the first two and last two with an ellipsis in the middle.

Code: Select all

fi
if [ -f ../stage_final ] \
   && cmp -s ../stage_current ../stage_final; then \
   cp ../prev-gcc/cc1plus-checksum.c cc1plus-checksum.c; \
else \
build/genchecksum cp/cp-lang.o  ...  ../libbacktrace/.libs/libbacktrace.a \
                     checksum-options > cc1plus-checksum.c.tmp &&          \
  ../../gcc/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c; \
fi
arm-linux-gnueabihf-g++ -std=gnu++98  ...  lto1 \
lto/lto-lang.o lto/lto.o  ...  ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a
arm-linux-gnueabihf-g++ -std=gnu++98  ...  lto-dump \
lto/lto-lang.o lto/lto-object.o  ...  ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a
arm-linux-gnueabihf-g++ -std=gnu++98  ...  ./.deps/cc1-checksum.TPo cc1-checksum.c
arm-linux-gnueabihf-g++ -std=gnu++98  ...  ./.deps/cc1plus-checksum.TPo cc1plus-checksum.c
arm-linux-gnueabihf-g++ -std=gnu++98  ...  glibc-c.o \
cc1-checksum.o libbackend.a  ...  -L./../zlib -lz
arm-linux-gnueabihf-g++ -std=gnu++98  ...  cc1plus \
cp/cp-lang.o c-family/stub-objc.o  ...  -L./../zlib -lz
collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[3]: *** [../../gcc/cp/Make-lang.in:120: cc1plus] Error 1
make[3]: *** Waiting for unfinished jobs....
rm gcc.pod
make[3]: Leaving directory '/home/pi/Documents/temptests/gcc-10.2.0/obj/gcc'
make[2]: *** [Makefile:4751: all-stage1-gcc] Error 2
make[2]: Leaving directory '/home/pi/Documents/temptests/gcc-10.2.0/obj'
make[1]: *** [Makefile:27699: stage1-bubble] Error 2
make[1]: Leaving directory '/home/pi/Documents/temptests/gcc-10.2.0/obj'
make: *** [Makefile:1007: all] Error 2
All boxes are equally up to date. I'm doing the compile with the regular Debian gcc:

Code: Select all

pi@pi2:~/Documents/temptests $ gcc --version
gcc (Raspbian 8.3.0-6+rpi1) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Got any suggestions?

lurk101
Posts: 594
Joined: Mon Jan 27, 2020 2:35 pm
Location: Cumming, GA (US)

Re: gcc_compile script - configure options for PiB or Pi3A ?

Thu Apr 22, 2021 3:27 pm

Google might help. Try looking for 'running multiple versions of GCC'. Also, man update-alternatives for details.

Another suggestion would be to add the following configure parameters, yielding a more conventional Debian installation.

--prefix=/usr --program-suffix=-10

A slightly modified version of the original

Code: Select all

#!/bin/bash

# REMEMBER TO UNCOMMENT THE CONFIGURE LINE FOR YOUR TARGET PLATFORM.
# ... and comment out the default of course.

#  This is the new GCC version to install.
#
MAJOR=10
MINOR=3
LANG=c,c++

VERSION=$MAJOR.$MINOR.0
PREFIX=/usr
COMMON="--disable-multilib --enable-languages=$LANG --prefix=$PREFIX --program-suffix=-$MAJOR --with-analyzer"

#  For any computer with less than 2GB of memory.
#
#if [ -f /etc/dphys-swapfile ]; then
#  sudo sed -i 's/^CONF_SWAPSIZE=[0-9]*$/CONF_SWAPSIZE=1024/' /etc/dphys-swapfile
#  sudo /etc/init.d/dphys-swapfile restart
#fi

if [ -d gcc-$VERSION ]; then
  cd gcc-$VERSION
  rm -rf build
else
  wget ftp://ftp.gnu.org/gnu/gcc/gcc-$VERSION/gcc-$VERSION.tar.xz
  tar xf gcc-$VERSION.tar.xz
  rm -f gcc-$VERSION.tar.xz
  cd gcc-$VERSION
  contrib/download_prerequisites
fi
mkdir -p build
cd build

#  Now run the ./configure which must be checked/edited beforehand.
#  Uncomment the sections below depending on your platform.  You may build
#  on a Pi3 for a target Pi Zero by uncommenting the Pi Zero section.
#  To alter the target directory set --prefix=<dir>
#  For a very quick build try: --disable-bootstrap

# x86_64
#../configure $COMMON

# AArch64 Pi4 in 64-bit mode
#../configure $COMMON --with-cpu=cortex-a72

# Pi Zero
../configure $COMMON --with-cpu=arm1176jzf-s \
  --with-fpu=vfp --with-float=hard --build=arm-linux-gnueabihf \
  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

# Pi4 in 32-bit mode
#../configure $COMMON --with-cpu=cortex-a72 \
#  --with-fpu=neon-fp-armv8 --with-float=hard --build=arm-linux-gnueabihf \
#  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

# Pi3+, Pi3, new Pi2
#../configure $COMMON --with-cpu=cortex-a53 \
#  --with-fpu=neon-fp-armv8 --with-float=hard --build=arm-linux-gnueabihf \
#  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

# Old Pi2
#../configure $COMMON --with-cpu=cortex-a7 \
#  --with-fpu=neon-vfpv4 --with-float=hard --build=arm-linux-gnueabihf \
#  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

#  Now build GCC which will take a long time.  This could range from
#  3.5 hours on a 4GB Pi4 up to about 50 hours on a Pi Zero.  It can be
#  left to complete overnight (or over the weekend for a Pi Zero :-)
#  The most likely causes of failure are lack of disk space, lack of
#  swap space or memory, or the wrong configure section uncommented.
#  The new compiler is placed in /usr/bin, in accordance with
#  debian/ubuntu convention with the major version appended to
#  installed files.

if time make -j`nproc`
then
  echo
  read -p "Do you wish to install the new GCC (y/n)? " yn
  case $yn in
   [Yy]* ) sudo make install-strip ;;
         * ) exit ;;
  esac
fi
How to make your arguments stronger? Longer is not the answer.

swampdog
Posts: 698
Joined: Fri Dec 04, 2015 11:22 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Thu Apr 22, 2021 7:30 pm

tinker2much wrote: collect2: fatal error: ld terminated with signal 9 [Killed]
compilation terminated.
make[3]: *** [../../gcc/cp/Make-lang.in:120: cc1plus] Error 1
make[3]: *** Waiting for unfinished jobs....
Most likely out of memory. Easy to test, just 'cd' into the top level object folder and "make -j $(nproc)" and it should fail again. Repeat with "make -j1".

tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Fri Apr 23, 2021 1:57 pm

Most likely out of memory. Easy to test, just 'cd' into the top level object folder and "make -j $(nproc)" and it should fail again. Repeat with "make -j1".
It makes no difference. I tried both ways on the pi2, and both make -j `nproc`and make -j 1 end with the following error (after a few pages of preceding stuff that varies):

Code: Select all

  make[3]: Entering directory '/home/pi/Documents/temptests/gcc-10.2.0/obj/gcc'
  /home/pi/Documents/temptests/gcc-10.2.0/obj/./gcc/xgcc -B/home/pi/Documents/temptests/gcc-10.2.0/obj/./gcc/ -xc++ -nostdinc /dev/null -S -o /dev/null -fself-test=../../gcc/testsuite/selftests
  xgcc: fatal error: cannot execute \u2018cc1plus\u2019: execvp: No such file or directory
  compilation terminated.
  make[3]: *** [../../gcc/cp/Make-lang.in:178: s-selftest-c++] Error 1
  make[3]: Leaving directory '/home/pi/Documents/temptests/gcc-10.2.0/obj/gcc'
  make[2]: *** [Makefile:4751: all-stage1-gcc] Error 2
  make[2]: Leaving directory '/home/pi/Documents/temptests/gcc-10.2.0/obj'
  make[1]: *** [Makefile:27699: stage1-bubble] Error 2
  make[1]: Leaving directory '/home/pi/Documents/temptests/gcc-10.2.0/obj'
Same story on the pi3a+.
Same story on the pi3b.

tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Fri Apr 23, 2021 1:59 pm

FYI: the pib(256) is still compiling, at almost 35 hours.

lurk101
Posts: 594
Joined: Mon Jan 27, 2020 2:35 pm
Location: Cumming, GA (US)

Re: gcc_compile script - configure options for PiB or Pi3A ?

Fri Apr 23, 2021 2:47 pm

tinker2much wrote:
Fri Apr 23, 2021 1:59 pm
FYI: the pib(256) is still compiling, at almost 35 hours.
At 35 hours you'd be about halfway there on a Pi0.
How to make your arguments stronger? Longer is not the answer.

User avatar
jahboater
Posts: 7079
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: gcc_compile script - configure options for PiB or Pi3A ?

Fri Apr 23, 2021 3:43 pm

tinker2much wrote:
Fri Apr 23, 2021 1:57 pm
Same story on the pi3a+.
Same story on the pi3b.
May be over temperature, even if it didn't throttle.
I have had large builds on the Pi3 fail for that reason.
In the early days of the Pi3 it would produce incorrect results sometimes (failed Linpack tests).
Later the engineers tweaked the voltages which improved stability a lot. Then the Pi3B+ arrived with better thermal management.

All my Pi3's are retired now.
Any Pi4 model just breezes through jobs the Pi3 would struggle with, and it appears to be unconditionally stable even with huge overclocks.
The early Pi's were very stable too of course, as is the Pi Zero.

tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Fri Apr 23, 2021 11:58 pm

May be over temperature, even if it didn't throttle.
As part of this process, I was checking arm frequency and temperature and throttling status every minute. Given the different ages and architectures and features of these different models, they showed - as expected - different frequency and thermal and throttling behavior. I've attached the digests I made of the data from those three runs. The pi2 didn't get that hot - max 65C. The pi3a seemed to throttle hard and never got above 77C. The Pi3B also throttled but it still got to 86C. THAT one, I could see thermally-induced failures. But given that all three - the old Pi2, the Pi3B+, and the Pi3B - failed at the identical point in the original build, I don't see some random temperature-triggered issue as the culprit.

I could maybe see running out of memory as the common cause, since that could happen consistently at the same point in the build. With all three being quad-core, maybe the make -j `nproc` just required too much memory at that point, even given the added swap?
Most likely out of memory. Easy to test, just 'cd' into the top level object folder and "make -j $(nproc)" and it should fail again. Repeat with "make -j1".
It makes no difference. I tried both ways on the pi2, and both make -j `nproc`and make -j 1 end with the following error (after a few pages of preceding stuff that varies):
When I tried recommencing as suggested above, the machines were all cool, and they still fail, so that seems to exonerate temperature. When I ran "make -j `nproc`, they all still failed, so that could be consistent with memory. But, now this is what really puzzles me - when I ran "make -j 1" they STILL failed. Doesn't that exonerate memory too? What single step could take up more than the combined total of memory and swap?

PiB256 still running, at 44 hours.

I started a Pi0W about six hours ago, and its plugging along steadily, arm_frequency 1000 and a consistent temperature of 50 or 51:

Code: Select all

pi@pi0w3:~/Documents/temptests $ cat pi0w.gcc_compile_sum.txt 
gcc_compile
1
Fri 23 Apr 2021 01:29:33 PM CDT
%Cpu(s):  4.5 us, 27.3 sy,  0.0 ni, 68.2 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
temp=34.2'C
frequency(48)=1000104000
throttled=0x0

temperatures
      1 temp=34\u00b0C
      1 temp=37\u00b0C
      1 temp=40\u00b0C
      1 temp=41\u00b0C
      3 temp=42\u00b0C
      1 temp=44\u00b0C
      2 temp=45\u00b0C
      4 temp=46\u00b0C
      8 temp=47\u00b0C
      7 temp=48\u00b0C
     11 temp=49\u00b0C
    132 temp=50\u00b0C
    145 temp=51\u00b0C

arm_frequencies
     28 0999
    289 1000

throttling status
    317 throttled=0x0

317
Fri 23 Apr 2021 06:48:50 PM CDT
%Cpu(s): 92.9 us,  7.1 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
temp=51.4'C
frequency(48)=1000000000
throttled=0x0

Hmmm... I tried to attach the summary reports for the three machines (similar to the partial-so-far one for the pi0w) but no matter what I try it says I have an invalid file extension ???

swampdog
Posts: 698
Joined: Fri Dec 04, 2015 11:22 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Sat Apr 24, 2021 3:40 am

tinker2much wrote:
Fri Apr 23, 2021 11:58 pm
When I tried recommencing as suggested above, the machines were all cool, and they still fail, so that seems to exonerate temperature. When I ran "make -j `nproc`, they all still failed, so that could be consistent with memory. But, now this is what really puzzles me - when I ran "make -j 1" they STILL failed. Doesn't that exonerate memory too? What single step could take up more than the combined total of memory and swap?
Not if you're unlucky. Assumption here is sdcard is verified okay btw.

It's possible the linker is trying to work with a previously corrupted file. In IBM aix unix for instance, it was a nightmare because its linker isn't usually binutils but the aix linker, which happily remains quiet about missing symbols (you only find out at runtime) so in that environment you could be looking for a corrupt (often zero length) object file. Fortunately in linux I've only seen this happen with libs: there may be a corrupt *.a or *.so somewhere. Sadly, it's not 100% guaranteed safe the gcc build will fail immediately on a fault.

In any case, "make >/tmp/z 2>&1" with "j>1" won't be logging errors in order. This is why for my final production build of gcc I take the hit and perform it with a single core (so the log is correct lest I need to refer to it later). I initially perform a "--disable-bootstrap --disable-multilib" on a new gcc version just to check "--enable-languages=c,c++" (the only features I typically build) that it will in fact compile.

'cd' into the failed object directory. "make clean" & "make -j1 >/tmp/z 2>&1". That tends to make the problem go away. If it's still there, fish out the bad compile line from the log and duplicate it manually. Hunt down the libs referenced from outside the failed directory, delete them & 'cd' into each one and "make -j1" in each. Personally I'd copy them out somewhere (but not this time, too much to do) so they can be compared later. As this isn't aix invariably it'll come together.

However, when you do get past the original failing link line, consider the entire build broken but don't give up on it yet. Figure out how much extra swap is required (if any) and repeat/rinse until entire build is complete. You now have max swap which will give you the basis of how many cores can be used.

User avatar
Paeryn
Posts: 3281
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: gcc_compile script - configure options for PiB or Pi3A ?

Sat Apr 24, 2021 8:50 pm

If it's failing on the linking you could try cd-ing into the relevant directory, copying the compile line which failed (it's about a page long), paste it to the command line, add the following option to the end and press enter.

Code: Select all

 -Wl,--reduce-memory-overheads
This does increase link time quite a bit but if it still fails you can try

Code: Select all

 -Wl,--reduce-memory-overheads,--no-keep-memory
which will also increase i/o reads as files aren't cached.

You might need to redo everything from the initial ./configure to get the settings passed for the whole build by changing the configure line in the build script so it begins

Code: Select all

LDFLAGS="-Wl,--reduce-memory-overheads,--no-keep-memory" ./configure
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Mon Apr 26, 2021 1:31 am

Hmmm... I tried to attach the summary reports for the three machines (similar to the partial-so-far one for the pi0w) but no matter what I try it says I have an invalid file extension ???
I searched for the message "invalid file extension" and learned from here viewtopic.php?f=66&t=308049&hilit=Inval ... n#p1843264 that zip files are OK. And that's it? So instead I'm putting the frequency/temperature/throttling summary reports that I had intended to attach, between code tags instead.

I was doing these compiles both just to see if it could be done, and as stress tests for the different pi's (gcc_compile is clearly an excellent stress test). I appreciate the generous suggestions as to how I might recover the failed compiles, but that may be more work than I'm up for.

Here are the summaries as to temperature, arm_frequency, and throttling status, for each of the machines, the data having been noted once a minute for the duration of the run (or longer, if I didn't notice exactly when they finished). The pib(256) and pi0w compiles are still running, the pi2, pi3a+ and pi3b failed, and the two different pi4s finished successfully. These were run at different times so there may be some differences in what's reported on or how its presented. There's a gap of 320 minutes on the pib where the compile was still running but I wasn't producing the data, but I don't think anything different happened during that time, the pib is the poster child for slow and steady... See the comment at the beginning of each section.

Code: Select all

pi@pib: runs at 700 (and runs forever), but stays cool
highest temperatures
      1 temp=48\u00b0C
     29 temp=49\u00b0C
   1874 temp=50\u00b0C
   2939 temp=51\u00b0C
     42 temp=52\u00b0C
    102 temp=53\u00b0C
     49 temp=54\u00b0C
      6 temp=55\u00b0C

arm_frequencies
     67 0699
   4975 0700

throttling status
   5042 throttled=0x0

5361
Sun 25 Apr 2021 06:42:13 PM CDT
%Cpu(s): 80.0 us, 20.0 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
temp=50.8'C
frequency(48)=700000000

Code: Select all

pi@pi0w3: more simple dependability - runs "faster" at 1000, runs cool
highest temperatures
      1 temp=34\u00b0C
      1 temp=37\u00b0C
      1 temp=40\u00b0C
      1 temp=41\u00b0C
      3 temp=42\u00b0C
      1 temp=44\u00b0C
      2 temp=45\u00b0C
      4 temp=46\u00b0C
      8 temp=47\u00b0C
      9 temp=48\u00b0C
    179 temp=49\u00b0C
   1218 temp=50\u00b0C
   1713 temp=51\u00b0C
     15 temp=52\u00b0C
      5 temp=53\u00b0C

arm_frequencies
    252 0999
   2909 1000

throttling status
   3161 throttled=0x0

3161
Sun 25 Apr 2021 06:41:30 PM CDT
%Cpu(s): 79.3 us, 20.7 sy,  0.0 ni,  0.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
temp=50.8'C
frequency(48)=1000000000
throttled=0x0

Code: Select all

pi@pi2: more dependable older technology - plugs along at 900 or less, doesn't get too hot
highest temperatures
      3 temp=46\u00b0C
     77 temp=47\u00b0C
     88 temp=48\u00b0C
      4 temp=49\u00b0C
      3 temp=51\u00b0C
      1 temp=52\u00b0C
      1 temp=54\u00b0C
      1 temp=55\u00b0C
      2 temp=56\u00b0C
      3 temp=57\u00b0C
      1 temp=58\u00b0C
      1 temp=59\u00b0C
      3 temp=60\u00b0C
      3 temp=61\u00b0C
      3 temp=62\u00b0C
      3 temp=63\u00b0C
     15 temp=64\u00b0C
     22 temp=65\u00b0C

arm_frequencies
     95 0600
     39 0700
      7 0899
     93 0900

throttling status
    234 throttled=0x0

234
Thu 22 Apr 2021 12:29:35 AM CDT
%Cpu(s):  1.2 us,  5.0 sy,  0.0 ni, 93.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
temp=47.1'C
frequency(48)=700000000
throttled=0x0

Code: Select all

pi@pi3a: in an official case, throttles below 1400 nearly all the time, but stays under 80 
highest temperatures
      3 temp=41\u00b0C
      3 temp=42\u00b0C
      3 temp=43\u00b0C
     18 temp=44\u00b0C
    249 temp=45\u00b0C
     26 temp=46\u00b0C
      7 temp=47\u00b0C
      2 temp=48\u00b0C
      3 temp=49\u00b0C
      1 temp=50\u00b0C
      1 temp=51\u00b0C
      1 temp=52\u00b0C
      1 temp=53\u00b0C
      1 temp=54\u00b0C
      1 temp=55\u00b0C
      1 temp=56\u00b0C
      1 temp=58\u00b0C
      1 temp=59\u00b0C
      2 temp=60\u00b0C
      1 temp=61\u00b0C
      3 temp=62\u00b0C
      2 temp=63\u00b0C
      2 temp=64\u00b0C
      4 temp=65\u00b0C
      2 temp=66\u00b0C
      1 temp=67\u00b0C
      2 temp=68\u00b0C
      1 temp=69\u00b0C
      1 temp=70\u00b0C
      1 temp=71\u00b0C
      1 temp=72\u00b0C
      2 temp=73\u00b0C
      5 temp=75\u00b0C
      3 temp=76\u00b0C
      2 temp=77\u00b0C

arm_frequencies
      6 0600
      1 0699
    226 0700
      1 0799
     65 0800
      6 0900
      3 1000
     33 1200
      1 1399
     16 1400

throttling status
    325 throttled=0x80000
     33 throttled=0x80008

358
Thu 22 Apr 2021 04:19:37 AM CDT
%Cpu(s):  1.3 us,  4.0 sy,  0.0 ni, 94.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
temp=41.3'C
frequency(48)=700000000
throttled=0x80000

Code: Select all

pi@pi3: in an official case, throttles way below 1200 but still gets up to 86 degrees
highest temperatures
      1 temp=54\u00b0C
      1 temp=58\u00b0C
      2 temp=59\u00b0C
      2 temp=60\u00b0C
      1 temp=61\u00b0C
      1 temp=62\u00b0C
      1 temp=65\u00b0C
      2 temp=70\u00b0C
      1 temp=71\u00b0C
      3 temp=72\u00b0Cstays
      1 temp=73\u00b0C
      2 temp=74\u00b0C
      3 temp=75\u00b0C
      2 temp=76\u00b0C
      1 temp=78\u00b0C
      2 temp=79\u00b0C
      1 temp=80\u00b0C
      2 temp=82\u00b0C
      4 temp=83\u00b0C
      8 temp=84\u00b0C
     10 temp=85\u00b0C
     12 temp=86\u00b0C

arm_frequencies
      3 0600
      7 0603
      1 0656
      8 0657
      3 0700
     11 0711
      4 0765
      4 0800
      1 0817
      1 0818
      1 0872
      2 0926
      1 1034
     16 1200

throttling status
      2 throttled=0x0
      4 throttled=0x20000
     21 throttled=0x20002
     20 throttled=0x60000
     16 throttled=0x60002

63
Wed 21 Apr 2021 08:43:14 PM CDT
%Cpu(s):  0.0 us,  6.3 sy,  0.0 ni, 93.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
temp=58.5'C
frequency(48)=600000000
throttled=0x60000

Code: Select all

pi@pi4: a pi 4 4GB in an official case with official fan - stays at 1500, but sawtooths between 80 and 70 as the fans kicks in hard, loud and annoying, but it never throttles
highest temperatures
      1 temp=59\u00b0C
     19 temp=60\u00b0C
     17 temp=61\u00b0C
     13 temp=62\u00b0C
      6 temp=63\u00b0C
      5 temp=64\u00b0C
      1 temp=65\u00b0C
      1 temp=68\u00b0C
      4 temp=69\u00b0C
     13 temp=70\u00b0C
     39 temp=71\u00b0C
     32 temp=72\u00b0C
     33 temp=73\u00b0C
     30 temp=74\u00b0C
     30 temp=75\u00b0C
     17 temp=76\u00b0C
     16 temp=77\u00b0C
     11 temp=78\u00b0C
     12 temp=79\u00b0C

arm_frequencies
     38 0600
     11 0700
      9 0800
      3 0900
      3 1000
    236 1500

throttling status
    300 throttled=0x0

300
Tue 20 Apr 2021 11:38:05 PM CDT
%Cpu(s):  1.4 us,  4.2 sy,  0.0 ni, 94.4 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
temp=61.3'C
frequency(48)=1500345728
throttled=0x0

Code: Select all

pi@pi8:  a pi4/8GB in an open case with a slow but always on fan - runs at 1700 the whole run and stays in the low 70's, never throttles
highest temperatures
      2 temp=61\u00b0C
      4 temp=62\u00b0C
      5 temp=63\u00b0C
      6 temp=64\u00b0C
      2 temp=65\u00b0C
      7 temp=66\u00b0C
      8 temp=67\u00b0C
     12 temp=68\u00b0C
      9 temp=69\u00b0C
     29 temp=70\u00b0C
     43 temp=71\u00b0C
     61 temp=72\u00b0C
     24 temp=73\u00b0C
     13 temp=74\u00b0C
      3 temp=75\u00b0C

arm_frequencies
      7 0600
      5 0700
      3 0800
      5 0900
      4 1100
    258 1700

throttling status
    282 throttled=0x0

282
Wed 21 Apr 2021 03:36:10 PM CDT
%Cpu(s):  1.3 us,  8.0 sy,  0.0 ni, 90.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
temp=48.7'C
frequency(48)=1700419968
throttled=0x0

tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Tue Apr 27, 2021 1:33 am

My gcc_compile on the pi0w finished successfully after 76 hours.

My gcc_compile on the pib (256) finished successfully after 113 hours.

User avatar
jahboater
Posts: 7079
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: gcc_compile script - configure options for PiB or Pi3A ?

Tue Apr 27, 2021 1:06 pm

tinker2much wrote:
Tue Apr 27, 2021 1:33 am
My gcc_compile on the pi0w finished successfully after 76 hours.

My gcc_compile on the pib (256) finished successfully after 113 hours.
Wow!

Please could you post your script for the Pi1 256MB as mine failed?

tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Tue Apr 27, 2021 3:08 pm

jahboater wrote:
Tue Apr 27, 2021 1:06 pm
tinker2much wrote:
Tue Apr 27, 2021 1:33 am
My gcc_compile on the pi0w finished successfully after 76 hours.

My gcc_compile on the pib (256) finished successfully after 113 hours.
Wow!

Please could you post your script for the Pi1 256MB as mine failed?
Be aware that this is for 10.2, also note what should be inconsequential changes (like: the specific download site, not pausing before prerequisites, and not giving the option to install at the end). Besides the large swap, I don't know what magic I did that you didn't.

I hope it works for you!

Code: Select all

#!/bin/bash

# see: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=6201&start=1150#p1779273

# REMEMBER TO UNCOMMENT THE CONFIGURE LINE FOR YOUR TARGET PLATFORM.
# ... and comment out the default of course.

#
#  This is the new GCC version to install.
#
VERSION=10.2.0

#
#  These are the languages the new compiler should support.
#
LANG=c,c++,fortran

#
#  For any computer with less than 2GB of memory.
#
if [ -f /etc/dphys-swapfile ]; then
  sudo sed -i 's/^CONF_SWAPSIZE=[0-9]*$/CONF_SWAPSIZE=1792/' /etc/dphys-swapfile
  sudo /etc/init.d/dphys-swapfile restart
fi

if [ -d gcc-$VERSION ]; then
  cd gcc-$VERSION
  rm -rf obj
else
  #wget ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$VERSION/gcc-$VERSION.tar.xz
  wget https://ftp.wayne.edu/gnu/gcc/gcc-$VERSION/gcc-$VERSION.tar.xz
  tar xf gcc-$VERSION.tar.xz
  rm -f gcc-$VERSION.tar.xz
  cd gcc-$VERSION
#	echo "Now sleeping to check the `pwd`/contrib/Download_prerequisites file..."
#	sleep 300 
  contrib/download_prerequisites
fi
mkdir -p obj
cd obj

#
#  Now run the ./configure which must be checked/edited beforehand.
#  Uncomment the sections below depending on your platform.  You may build
#  on a Pi3 for a target Pi Zero by uncommenting the Pi Zero section.
#  To alter the target directory set --prefix=<dir>
#  For a very quick build try: --disable-bootstrap
#

# x86_64
#../configure --disable-multilib --enable-languages=$LANG

# AArch64 Pi4 in 64-bit mode
#../configure --enable-languages=$LANG --with-cpu=cortex-a72

# Pi Zero
../configure --enable-languages=$LANG --with-cpu=arm1176jzf-s \
  --with-fpu=vfp --with-float=hard --build=arm-linux-gnueabihf \
  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

# Pi3+, Pi3, Pi4 in 32-bit mode
#../configure --enable-languages=$LANG --with-cpu=cortex-a53 \
#  --with-fpu=neon-fp-armv8 --with-float=hard --build=arm-linux-gnueabihf \
#  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

# Old Pi2
#../configure --enable-languages=$LANG --with-cpu=cortex-a7 \
#  --with-fpu=neon-vfpv4 --with-float=hard --build=arm-linux-gnueabihf \
#  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

#
#  Now build GCC which will take a long time.  This could range from
#  3.5 hours on a 4GB Pi4 up to about 50 hours on a Pi Zero.  It can be
#  left to complete overnight (or over the weekend for a Pi Zero :-)
#  The most likely causes of failure are lack of disk space, lack of
#  swap space or memory, or the wrong configure section uncommented.
#  The new compiler is placed in /usr/local/bin, the existing compiler remains
#  in /usr/bin and may be used by giving its version gcc-6 (say).
#
if make -j `nproc`
then
  echo
  echo read -p "Do you wish to install the new GCC (y/n)? " yn
#   case $yn in
#    [Yy]* ) sudo make install ;;
# 	 * ) exit ;;
#   esac
fi


User avatar
jahboater
Posts: 7079
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: gcc_compile script - configure options for PiB or Pi3A ?

Tue Apr 27, 2021 6:17 pm

Thanks, I'll try it with GCC 11.1 which has just been released!

https://gcc.gnu.org/gcc-11/

I added the D language which may be too much, because D is a very large and powerful language.

My Pi1 is very early - Revision 0002
I overclocked it to 800MHz for this build.

tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Thu Apr 29, 2021 12:42 pm

My pib is also revision code 2, so that bodes well for you.

I didn't specially overclock my pi's for the compiles; except the pi 4/8GB is always mildly overclocked to 1700 with over-voltage 2. (I've tried a lot more than that, which gives me a lot more peak performance, but it ups the idling temperatures too much and this way it keeps under 80C even under massive load just using a small 5v fan under powered by a 3v3 gpio pin, and therefore running so quietly I can't hear it.

A few of my machines have SSDs, the pi2 runs off an old hard drive, the rest are all just SD or microSD cards. I wonder how much such storage affected my compiles?

Do you do anything besides overclocking for your compiles? What storage do you use?

User avatar
jahboater
Posts: 7079
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: gcc_compile script - configure options for PiB or Pi3A ?

Thu Apr 29, 2021 2:29 pm

tinker2much wrote:
Thu Apr 29, 2021 12:42 pm
Do you do anything besides overclocking for your compiles? What storage do you use?
My 8GB Pi4 runs at 2.1GHz and reaches around 67 - 68 C max during the build. It idles at around 37C
Normal compiles of a few thousand lines or so are very quick on this Pi. The GCC build still takes over 3 hours.
I use arm_freq_min=400 which I think helps keep the idle temp down.

For all the Pi's I just use the usual Sandisk A1 class SD cards, they seem totally reliable, are "fast enough", and convenient.
The Pi4's require no swap so that's easy.

For my Intel PC with 16GB of memory, I do the entire GCC download/untar/build in /tmp - which is in memory.
So it is very fast and doesn't wear out the SSD (takes around 20mins).

I tried doing that on the 8GB Pi4 but it failed, sadly :(
A 7GB virtual memory disk wasn't enough!
Roll on a 16GB Pi4 ....

User avatar
jahboater
Posts: 7079
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: gcc_compile script - configure options for PiB or Pi3A ?

Sun May 02, 2021 6:23 pm

111.4 hours to build C, D, C++, and Fortran on the Pi1 Rev1 (code 0002) 256MB Pi :(
Overclocked to: CPU 800MHz, core 400MHz, SDRAM 400MHz.
Around 42C all the time with no heatsink.

Works like a charm, amazing.

tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Tue May 11, 2021 1:42 am

swampdog wrote:
Thu Apr 22, 2021 7:30 pm
Most likely out of memory.
Recap: my gcc_compile attempts on the pi2, pi3a+, and pi3b had all failed, seemingly at the same point.

Summary: I increased the swap, entered swap hell, but eventually got out of it

I decided to try again, still with make -j `nproc`, just increasing the swap size. On the pi2 and pi3b, I made it 1536MB. On the pi3a+ (given only 512MB of memory), I made it 2048MB. On the pi2, boot is on a micro-SD card and / is a 500GB hard drive. On the pi3a+, boot and / are on a regular old micro-SD card. On the pi3b, everything's on a 120GB SSD. No fans, no heatsinks, but I opened up the tops of the cases. I fired them off and kept watching factors like temperature, make progress (as given by tail -f on stdout and stderr as redirected from the script), throttling, and swap usage. The pi3b finished in about 9.5 hours. The other two are still running.

At some point, I saw that, for each of them, top was reporting very little user cpu and a whole lot of wait, swap usage was very high, progress seemed to have stopped, and four instances of "ld" were running. The last 30 lines or so of the compile output (with some lines continued by \ having been rejoined by me) being the following:

Code: Select all

cat gcc_compile.out.slowpoint2 
/bin/bash ../../gcc/../move-if-change tmp-fixinc_list fixinc_list
echo timestamp > s-fixinc_list
rm -rf libbackend.a
arm-linux-gnueabihf-ar rcT libbackend.a gimple-match.o generic-match.o insn-attrtab.o insn-automata.o insn-dfatab.o insn-emit.o insn-extract.o insn-latencytab.o insn-modes.o insn-opinit.o insn-output.o insn-peep.o insn-preds.o insn-recog.o insn-enums.o ggc-page.o alias.o alloc-pool.o auto-inc-dec.o auto-profile.o bb-reorder.o bitmap.o builtins.o caller-save.o calls.o ccmp.o cfg.o cfganal.o cfgbuild.o cfgcleanup.o cfgexpand.o cfghooks.o cfgloop.o cfgloopanal.o cfgloopmanip.o cfgrtl.o symtab.o cgraph.o cgraphbuild.o cgraphunit.o cgraphclones.o combine.o combine-stack-adj.o compare-elim.o context.o convert.o coroutine-passes.o coverage.o cppbuiltin.o cppdefault.o cprop.o cse.o cselib.o data-streamer.o data-streamer-in.o data-streamer-out.o dbxout.o dbgcnt.o dce.o ddg.o debug.o df-core.o df-problems.o df-scan.o dfp.o digraph.o dojump.o dominance.o domwalk.o double-int.o dse.o dumpfile.o dwarf2asm.o dwarf2cfi.o dwarf2out.o early-remat.o emit-rtl.o et-forest.o except.o explow.o expmed.o expr.o fibonacci_heap.o file-prefix-map.o final.o fixed-value.o fold-const.o fold-const-call.o function.o function-abi.o function-tests.o fwprop.o gcc-rich-location.o gcse.o gcse-common.o ggc-common.o ggc-tests.o gimple.o gimple-builder.o gimple-expr.o gimple-iterator.o gimple-fold.o gimple-laddress.o gimple-loop-interchange.o gimple-loop-jam.o gimple-loop-versioning.o gimple-low.o gimple-pretty-print.o gimple-ssa-backprop.o gimple-ssa-evrp.o gimple-ssa-evrp-analyze.o gimple-ssa-isolate-paths.o gimple-ssa-nonnull-compare.o gimple-ssa-split-paths.o gimple-ssa-store-merging.o gimple-ssa-strength-reduction.o gimple-ssa-sprintf.o gimple-ssa-warn-alloca.o gimple-ssa-warn-restrict.o gimple-streamer-in.o gimple-streamer-out.o gimple-walk.o gimplify.o gimplify-me.o godump.o graph.o graphds.o graphviz.o graphite.o graphite-isl-ast-to-gimple.o graphite-dependences.o graphite-optimize-isl.o graphite-poly.o graphite-scop-detection.o graphite-sese-to-poly.o gtype-desc.o haifa-sched.o hash-map-tests.o hash-set-tests.o hsa-common.o hsa-gen.o hsa-regalloc.o hsa-brig.o hsa-dump.o hw-doloop.o hwint.o ifcvt.o ree.o inchash.o incpath.o init-regs.o internal-fn.o ipa-cp.o ipa-sra.o ipa-devirt.o ipa-fnsummary.o ipa-polymorphic-call.o ipa-split.o ipa-inline.o ipa-comdats.o ipa-visibility.o ipa-inline-analysis.o ipa-inline-transform.o ipa-predicate.o ipa-profile.o ipa-prop.o ipa-param-manipulation.o ipa-pure-const.o ipa-icf.o ipa-icf-gimple.o ipa-reference.o ipa-hsa.o ipa-ref.o ipa-utils.o ipa.o ira.o ira-build.o ira-costs.o ira-conflicts.o ira-color.o ira-emit.o ira-lives.o jump.o langhooks.o lcm.o lists.o loop-doloop.o loop-init.o loop-invariant.o loop-iv.o loop-unroll.o lower-subreg.o lra.o lra-assigns.o lra-coalesce.o lra-constraints.o lra-eliminations.o lra-lives.o lra-remat.o lra-spills.o lto-cgraph.o lto-streamer.o lto-streamer-in.o lto-streamer-out.o lto-section-in.o lto-section-out.o lto-opts.o lto-compress.o mcf.o mode-switching.o modulo-sched.o multiple_target.o omp-offload.o omp-expand.o omp-general.o omp-grid.o omp-low.o omp-simd-clone.o opt-problem.o optabs.o optabs-libfuncs.o optabs-query.o optabs-tree.o optinfo.o optinfo-emit-json.o options-save.o opts-global.o ordered-hash-map-tests.o passes.o plugin.o postreload-gcse.o postreload.o predict.o print-rtl.o print-rtl-function.o print-tree.o profile.o profile-count.o range.o range-op.o read-md.o read-rtl.o read-rtl-function.o real.o realmpfr.o recog.o reg-stack.o regcprop.o reginfo.o regrename.o regstat.o reload.o reload1.o reorg.o resource.o rtl-error.o rtl-tests.o rtl.o rtlhash.o rtlanal.o rtlhooks.o rtx-vector-builder.o run-rtl-passes.o sched-deps.o sched-ebb.o sched-rgn.o sel-sched-ir.o sel-sched-dump.o sel-sched.o selftest-rtl.o selftest-run-tests.o sese.o shrink-wrap.o simplify-rtx.o sparseset.o spellcheck.o spellcheck-tree.o sreal.o stack-ptr-mod.o statistics.o stmt.o stor-layout.o store-motion.o streamer-hooks.o stringpool.o substring-locations.o target-globals.o targhooks.o timevar.o toplev.o tracer.o trans-mem.o tree-affine.o asan.o tsan.o ubsan.o sanopt.o sancov.o tree-call-cdce.o tree-cfg.o tree-cfgcleanup.o tree-chrec.o tree-complex.o tree-data-ref.o tree-dfa.o tree-diagnostic.o tree-diagnostic-path.o tree-dump.o tree-eh.o tree-emutls.o tree-if-conv.o tree-inline.o tree-into-ssa.o tree-iterator.o tree-loop-distribution.o tree-nested.o tree-nrv.o tree-object-size.o tree-outof-ssa.o tree-parloops.o tree-phinodes.o tree-predcom.o tree-pretty-print.o tree-profile.o tree-scalar-evolution.o tree-sra.o tree-switch-conversion.o tree-ssa-address.o tree-ssa-alias.o tree-ssa-ccp.o tree-ssa-coalesce.o tree-ssa-copy.o tree-ssa-dce.o tree-ssa-dom.o tree-ssa-dse.o tree-ssa-forwprop.o tree-ssa-ifcombine.o tree-ssa-live.o tree-ssa-loop-ch.o tree-ssa-loop-im.o tree-ssa-loop-ivcanon.o tree-ssa-loop-ivopts.o tree-ssa-loop-manip.o tree-ssa-loop-niter.o tree-ssa-loop-prefetch.o tree-ssa-loop-split.o tree-ssa-loop-unswitch.o tree-ssa-loop.o tree-ssa-math-opts.o tree-ssa-operands.o tree-ssa-phiopt.o tree-ssa-phiprop.o tree-ssa-pre.o tree-ssa-propagate.o tree-ssa-reassoc.o tree-ssa-sccvn.o tree-ssa-scopedtables.o tree-ssa-sink.o tree-ssa-strlen.o tree-ssa-structalias.o tree-ssa-tail-merge.o tree-ssa-ter.o tree-ssa-threadbackward.o tree-ssa-threadedge.o tree-ssa-threadupdate.o tree-ssa-uncprop.o tree-ssa-uninit.o tree-ssa.o tree-ssanames.o tree-stdarg.o tree-streamer.o tree-streamer-in.o tree-streamer-out.o tree-tailcall.o tree-vect-generic.o tree-vect-patterns.o tree-vect-data-refs.o tree-vect-stmts.o tree-vect-loop.o tree-vect-loop-manip.o tree-vect-slp.o tree-vectorizer.o tree-vector-builder.o tree-vrp.o tree.o tristate.o typed-splay-tree.o unique-ptr-tests.o valtrack.o value-range.o value-prof.o var-tracking.o varasm.o varpool.o vec-perm-indices.o vmsdbgout.o vr-values.o vtable-verify.o web.o wide-int.o wide-int-print.o xcoffout.o arm.o analyzer/analysis-plan.o analyzer/analyzer.o analyzer/analyzer-logging.o analyzer/analyzer-pass.o analyzer/analyzer-selftests.o analyzer/bar-chart.o analyzer/call-string.o analyzer/checker-path.o analyzer/constraint-manager.o analyzer/diagnostic-manager.o analyzer/engine.o analyzer/function-set.o analyzer/pending-diagnostic.o analyzer/program-point.o analyzer/program-state.o analyzer/region-model.o analyzer/sm.o analyzer/sm-file.o analyzer/sm-malloc.o analyzer/sm-pattern-test.o analyzer/sm-sensitive.o analyzer/sm-signal.o analyzer/sm-taint.o analyzer/state-purge.o analyzer/supergraph.o arm-builtins.o aarch-common.o linux.o host-linux.o
if [ -f ../stage_final ] \
   && cmp -s ../stage_current ../stage_final; then \
  cp ../prev-gcc/cc1-checksum.c cc1-checksum.c; \
else \
  build/genchecksum c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-fold.o c/gimple-parser.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o arm-c.o glibc-c.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a   ../libdecnumber/libdecnumber.a ../libbacktrace/.libs/libbacktrace.a \
                     checksum-options > cc1-checksum.c.tmp && 		 \
  ../../gcc/../move-if-change cc1-checksum.c.tmp cc1-checksum.c; \
fi
if [ -f ../stage_final ] \
   && cmp -s ../stage_current ../stage_final; then \
   cp ../prev-gcc/cc1plus-checksum.c cc1plus-checksum.c; \
else \
  build/genchecksum cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o cp/coroutines.o cp/cp-gimplify.o cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o cp/cxx-pretty-print.o cp/decl.o cp/decl2.o cp/dump.o cp/error.o cp/except.o cp/expr.o cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o cp/mangle.o cp/method.o cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/rtti.o cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o cp/vtable-class-hierarchy.o attribs.o incpath.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o arm-c.o glibc-c.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a   ../libdecnumber/libdecnumber.a ../libbacktrace/.libs/libbacktrace.a \
                     checksum-options > cc1plus-checksum.c.tmp &&	   \
  ../../gcc/../move-if-change cc1plus-checksum.c.tmp cc1plus-checksum.c; \
fi
arm-linux-gnueabihf-g++ -std=gnu++98 -no-pie   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  -o lto1 lto/lto-lang.o lto/lto.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o lto/lto-common.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./isl/.libs  -lisl -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./gmp/.libs -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./mpfr/src/.libs -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./mpc/src/.libs -lmpc -lmpfr -lgmp -rdynamic -ldl  -L./../zlib -lz  libcommon.a ../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a 
arm-linux-gnueabihf-g++ -std=gnu++98 -no-pie   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  -o lto-dump lto/lto-lang.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o lto/lto-dump.o lto/lto-common.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./isl/.libs  -lisl -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./gmp/.libs -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./mpfr/src/.libs -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./mpc/src/.libs -lmpc -lmpfr -lgmp -rdynamic -ldl  -L./../zlib -lz  libcommon.a ../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a 
arm-linux-gnueabihf-g++ -std=gnu++98 -fno-PIE -c  -DIN_GCC_FRONTEND -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include -I/home/pi/Documents/temptests/gcc-10.2.0/obj/./gmp -I/home/pi/Documents/temptests/gcc-10.2.0/gmp -I/home/pi/Documents/temptests/gcc-10.2.0/obj/./mpfr/src -I/home/pi/Documents/temptests/gcc-10.2.0/mpfr/src -I/home/pi/Documents/temptests/gcc-10.2.0/mpc/src  -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/../libbacktrace -I/home/pi/Documents/temptests/gcc-10.2.0/obj/./isl/include -I/home/pi/Documents/temptests/gcc-10.2.0/isl/include  -o cc1-checksum.o -MT cc1-checksum.o -MMD -MP -MF ./.deps/cc1-checksum.TPo cc1-checksum.c
arm-linux-gnueabihf-g++ -std=gnu++98 -fno-PIE -c  -DIN_GCC_FRONTEND -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -I. -I. -I../../gcc -I../../gcc/. -I../../gcc/../include -I../../gcc/../libcpp/include -I/home/pi/Documents/temptests/gcc-10.2.0/obj/./gmp -I/home/pi/Documents/temptests/gcc-10.2.0/gmp -I/home/pi/Documents/temptests/gcc-10.2.0/obj/./mpfr/src -I/home/pi/Documents/temptests/gcc-10.2.0/mpfr/src -I/home/pi/Documents/temptests/gcc-10.2.0/mpc/src  -I../../gcc/../libdecnumber -I../../gcc/../libdecnumber/dpd -I../libdecnumber -I../../gcc/../libbacktrace -I/home/pi/Documents/temptests/gcc-10.2.0/obj/./isl/include -I/home/pi/Documents/temptests/gcc-10.2.0/isl/include  -o cc1plus-checksum.o -MT cc1plus-checksum.o -MMD -MP -MF ./.deps/cc1plus-checksum.TPo cc1plus-checksum.c
arm-linux-gnueabihf-g++ -std=gnu++98 -no-pie   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  -o cc1 c/c-lang.o c-family/stub-objc.o attribs.o c/c-errors.o c/c-decl.o c/c-typeck.o c/c-convert.o c/c-aux-info.o c/c-objc-common.o c/c-parser.o c/c-fold.o c/gimple-parser.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o arm-c.o glibc-c.o cc1-checksum.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./isl/.libs  -lisl -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./gmp/.libs -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./mpfr/src/.libs -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./mpc/src/.libs -lmpc -lmpfr -lgmp -rdynamic -ldl  -L./../zlib -lz 
arm-linux-gnueabihf-g++ -std=gnu++98 -no-pie   -g -DIN_GCC     -fno-exceptions -fno-rtti -fasynchronous-unwind-tables -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wno-format -Wmissing-format-attribute -Woverloaded-virtual -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -fno-common  -DHAVE_CONFIG_H -static-libstdc++ -static-libgcc  -o cc1plus cp/cp-lang.o c-family/stub-objc.o cp/call.o cp/class.o cp/constexpr.o cp/constraint.o cp/coroutines.o cp/cp-gimplify.o cp/cp-objcp-common.o cp/cp-ubsan.o cp/cvt.o cp/cxx-pretty-print.o cp/decl.o cp/decl2.o cp/dump.o cp/error.o cp/except.o cp/expr.o cp/friend.o cp/init.o cp/lambda.o cp/lex.o cp/logic.o cp/mangle.o cp/method.o cp/name-lookup.o cp/optimize.o cp/parser.o cp/pt.o cp/ptree.o cp/rtti.o cp/search.o cp/semantics.o cp/tree.o cp/typeck.o cp/typeck2.o cp/vtable-class-hierarchy.o attribs.o incpath.o c-family/c-common.o c-family/c-cppbuiltin.o c-family/c-dump.o c-family/c-format.o c-family/c-gimplify.o c-family/c-indentation.o c-family/c-lex.o c-family/c-omp.o c-family/c-opts.o c-family/c-pch.o c-family/c-ppoutput.o c-family/c-pragma.o c-family/c-pretty-print.o c-family/c-semantics.o c-family/c-ada-spec.o c-family/c-ubsan.o c-family/known-headers.o c-family/c-attribs.o c-family/c-warn.o c-family/c-spellcheck.o arm-c.o glibc-c.o cc1plus-checksum.o libbackend.a main.o libcommon-target.a libcommon.a ../libcpp/libcpp.a ../libdecnumber/libdecnumber.a libcommon.a ../libcpp/libcpp.a   ../libbacktrace/.libs/libbacktrace.a ../libiberty/libiberty.a ../libdecnumber/libdecnumber.a  -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./isl/.libs  -lisl -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./gmp/.libs -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./mpfr/src/.libs -L/home/pi/Documents/temptests/gcc-10.2.0/obj/./mpc/src/.libs -lmpc -lmpfr -lgmp -rdynamic -ldl  -L./../zlib -lz
I am no expert on gcc, but I think that this says that I was trying to link cc1 and cc1plus and two other presumably large bits of software at the same time. They stayed on these same bits of work for about <<<5 hours>>>. Swapping must have been brutal for progress to have slowed down so much. I'll attach a couple of screen shots showing the output of "top" when in this state. You can see how little memory was available, how little memory was being used for buffers or cache, and how close I was to using all of the swap. Also how the load averages were 6 or higher, on 4-core boxes.

Sidebar: The pi2 with the hard drive got out of swap hell a little sooner than the pi3a+ with the micro-Sd card. Seems counter-intuitive.

Can anyone else speak to the extent and effect of swapping during gcc compiles? I wonder whether lowering the make -j from nproc (=4) down to 3 or even 2 would actually reduce the elapsed time, if such a change prevented swap hell.
Attachments
2021-05-10-185551_1485x983_scrot.png
2021-05-10-185551_1485x983_scrot.png (226.96 KiB) Viewed 1181 times
2021-05-10-193218_1465x831_scrot.png
2021-05-10-193218_1465x831_scrot.png (188.38 KiB) Viewed 1181 times

swampdog
Posts: 698
Joined: Fri Dec 04, 2015 11:22 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Tue May 11, 2021 5:02 am

Yes. That's "swap hell". It's one of the reasons why I use max of "nproc-1". Linking doesn't happen that much but when it does, it can be intense.

Couple of useful commands:
  • iostat -N 1 <-ctrl-c to exit
    man lsof
    man 7 signal
The first being most useful. 'lsof' can find the file/process with enough effort and iirc it should be possible to use SIGSTOP/SIGCONT to temporarily halt all but one of the linker subprocesses. You will (of course), need a core free for the command line to be even vaguely responsive. ;-)

There are a couple of options (man ld) to reduce linker overhead (eg: --no-keep-memory,--reduce-memory-overheads) which I have never used. As noted earlier: I perform my final "production" build on one core so the logs are in order. Moreover, you'd have to figure out how to patch the build tree in order to insert those options in the correct place using internal gcc variables. Too much hassle for my liking!

User avatar
jahboater
Posts: 7079
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: gcc_compile script - configure options for PiB or Pi3A ?

Tue May 11, 2021 9:23 am

Ah the luxury of a Pi4 ...

I am just adding support for the "go" language.

Code: Select all

LANG=c,d,c++,go,fortran
using make -j 5 and no swap at all.
Should complete in 3 hours or so at 2.1GHz.
Also /tmp is in memory (4GB tmpfs disk) which might speed up compiler temporary files.

Code: Select all

$ free -h
              total        used        free      shared  buff/cache   available
Mem:          7.6Gi       892Mi       2.7Gi        84Mi       4.0Gi       6.5Gi
Swap:            0B          0B          0B
:) order a Pi4 from the Pi Hut and it will arrive the next morning. Build GCC 11 and its all good to go by lunchtime. Quicker than messing with the linker, swap, and waiting for a Pi3 with 2 cores ... :)

People suggest N cores + 1 so that if a task is held up by I/O, then another may takes its place.
However I am suspecting it will be wasting more time context switching ?

Code: Select all

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                        
10442 pi        20   0  119476 100364  38928 R  82.7   1.3   0:24.41 cc1plus                        
10447 pi        20   0  113196  95252  38920 R  81.7   1.2   0:19.91 cc1plus                        
10471 pi        20   0  113232  86872  33748 R  81.7   1.1   0:08.95 cc1plus                        
10476 pi        20   0   82472  55864  30552 R  76.7   0.7   0:02.77 cc1plus                        
10481 pi        20   0   74988  46384  30208 R  41.9   0.6   0:01.26 cc1plus                        
With make -j 4, I would expect four tasks using 100% (near enough) CPU each, whereas here the cores are being shared.

tinker2much
Posts: 279
Joined: Wed Jun 20, 2018 12:38 am

Re: gcc_compile script - configure options for PiB or Pi3A ?

Tue May 11, 2021 1:45 pm

tinker2much wrote:
Tue Apr 27, 2021 1:33 am
My gcc_compile on the pi0w finished successfully after 76 hours.

My gcc_compile on the pib (256) finished successfully after 113 hours.
The others all eventually survived swapping and finished. Times:

pi2: 19 hours
pi3a+: 14 hours
pi3b: 9.5 hours

Of course, doing this on a pi4 with lots of memory and an SSD would be more sensible/effective/easy. I may do that just to have times for ALL of my Pi's. But that's obviously less fun/challenging/interesting. ;-)

Thanks to everyone for their suggestions and support throughout this long thread.

Return to “C/C++”