Page 1 of 1

GCC 6.1 Released

Posted: Thu Apr 28, 2016 7:22 am
by jahboater
GCC 6.1 is now available if anyone is interested in the latest version.

https://gcc.gnu.org/

It runs fine on the Pi.
This means the default compiler on Jessie is now two major versions out of date (4.9).

To build:-

Code: Select all

tar xf gcc-6.1.0.tar.bz2

cd gcc-6.1.0

contrib/download_prerequisites

mkdir obj

cd obj

../configure -v --enable-languages=c,c++ --with-cpu=cortex-a53 \
  --with-fpu=neon-fp-armv8 --with-float=hard --build=arm-linux-gnueabihf \
  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

sudo dd if=/dev/zero of=/swapfile1GB bs=1M count=1024
sudo mkswap /swapfile1GB
sudo swapon /swapfile1GB

make -j5

sudo make install
Leave it running overnight (should take around 6.5 hours on a Pi3).
It is a large project - over 17 million lines of code in 104 thousand source files.
You can omit the -j5 (which uses all the cores) and the swapfile is not needed, but it will take ages to build.
Type "gcc -v" to check its all OK

Re: GCC 6.1 Released

Posted: Thu Apr 28, 2016 3:35 pm
by SteveSpencer
Yup, works for me. :D

Although on my Pi3B it took around 6.5 hours, building on an 8GB SD card with 1GB of swap and -j5 specified.
This is with a class 10 card, and gpu_mem set to 16, with no ipv6 loaded.
All other things are standard, no overclocking, and no i2c or spi loaded. If I tried hard I could free up more RAM, but it would be quicker on a USB SSD, I suspect :)

Re: GCC 6.1 Released

Posted: Thu Apr 28, 2016 4:20 pm
by jahboater
Out of interest, was it throttling back?
I found adding a heatsink gained half an hour or so because it ran at 1200Mhz all the time (well all the time I happened to be watching anyway).

Re: GCC 6.1 Released

Posted: Fri Apr 29, 2016 5:59 am
by ejolson
SteveSpencer wrote:Yup, works for me. :D

Although on my Pi3B it took around 6.5 hours, building on an 8GB SD card with 1GB of swap and -j5 specified.
This is with a class 10 card, and gpu_mem set to 16, with no ipv6 loaded.
All other things are standard, no overclocking, and no i2c or spi loaded. If I tried hard I could free up more RAM, but it would be quicker on a USB SSD, I suspect :)
Does libcilkrts now build by default as it does on Intel, or does one still need to patch the codebase for ARM?

Re: GCC 6.1 Released

Posted: Fri Apr 29, 2016 9:00 am
by SteveSpencer
jahboater wrote:Out of interest, was it throttling back?
I found adding a heatsink gained half an hour or so because it ran at 1200Mhz all the time (well all the time I happened to be watching anyway).
Possibly, I didn't check, I just left it to run to completion. It does have a heat-sink installed (Pimoroni HAT compatible), though.
Maybe I should have set force_turbo ? :|

Re: GCC 6.1 Released

Posted: Fri Apr 29, 2016 9:11 am
by jahboater
ejolson wrote:Does libcilkrts now build by default as it does on Intel, or does one still need to patch the codebase for ARM?
I don't know. I just tried compiling something with "-lcilkrts" and it failed with "/usr/bin/ld: cannot find -lcilkrts".

Re: GCC 6.1 Released

Posted: Fri Apr 29, 2016 9:28 am
by jahboater
SteveSpencer wrote:
jahboater wrote:Out of interest, was it throttling back?
I found adding a heatsink gained half an hour or so because it ran at 1200Mhz all the time (well all the time I happened to be watching anyway).
Possibly, I didn't check, I just left it to run to completion. It does have a heat-sink installed (Pimoroni HAT compatible), though.
Maybe I should have set force_turbo ? :|
This is my bad, it seems GCC 6 takes more time to build than GCC 5. I just timed a build on another Pi3 and it took 6.5 hours like yours.
I'll edit the original post.

Re: GCC 6.1 Released

Posted: Sun May 01, 2016 2:16 pm
by echmain
jahboater wrote:GCC 6.1 is now available if anyone is interested in the latest version.
This means the default compiler on Jessie is now two major versions out of date (4.9).
I'm curious...why is it so far behind? Is it because 6.1 (or 5.x) must be released in Debian before appearing in Raspbian?

Re: GCC 6.1 Released

Posted: Sun May 01, 2016 6:37 pm
by jahboater
echmain wrote:I'm curious...why is it so far behind? Is it because 6.1 (or 5.x) must be released in Debian before appearing in Raspbian?
I guess so. And it probably has to work its way up from "testing" to "stable" in Debian.

Re: GCC 6.1 Released

Posted: Sun May 01, 2016 7:02 pm
by rpdom
jahboater wrote:
echmain wrote:I'm curious...why is it so far behind? Is it because 6.1 (or 5.x) must be released in Debian before appearing in Raspbian?
I guess so. And it probably has to work its way up from "testing" to "stable" in Debian.
Nothing new enters Stable, other than security fixes and occasional major bug fixes.
New packages have to wait for Debian to release a new Stable version, like when they switched from Wheezy to Jessie. We will have to wait a year or so for Stretch to replace Jessie before we see new versions - unless you are really keen, can handle some breakage caused by new bugs and fix things yourself, in which case you could try Stretch now. I don't know how well it integrates with the RPF provided packages, as I believe they only support Jessie at the moment. I may be wrong and don't have time to check right now.

Re: GCC 6.1 Released

Posted: Fri May 13, 2016 12:01 pm
by jahboater
SteveSpencer wrote:Yup, works for me. :D

Although on my Pi3B it took around 6.5 hours, building on an 8GB SD card with 1GB of swap and -j5 specified.
This is with a class 10 card, and gpu_mem set to 16, with no ipv6 loaded.
All other things are standard, no overclocking, and no i2c or spi loaded. If I tried hard I could free up more RAM, but it would be quicker on a USB SSD, I suspect :)
Purely for amusement, I tried on a Pi Zero - it took 48.7 hours, but it worked fine.

Pretty cool that a tiny £4 computer can build a 17 million line project!

Re: GCC 6.1 Released

Posted: Sat Jun 25, 2016 5:54 am
by iJean
Hi jahboater,
what is the configure line for a Raspberry Pi 2 ? I've tried to change armv8 to armv7 but it wasn't enough.
Thanks,
Jean

Re: GCC 6.1 Released

Posted: Sat Jun 25, 2016 11:03 am
by ejolson
A configure command for armv6 in the Pi B/B+/Zero would be

$ ../gcc-src/configure -v --enable-languages=c,c++ \
--prefix=/usr/local/gcc-6.1 --with-arch=armv6 \
--with-fpu=vfp --with-float=hard --build=arm-linux-gnueabihf \
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

For the Pi 2B try

$ ../gcc-src/configure -v --enable-languages=c,c++ \
--prefix=/usr/local/gcc-6.1 --with-arch=armv7-a \
--with-fpu=vfp --with-float=hard --build=arm-linux-gnueabihf \
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

Note that the B/B++/Zero binary of the compiler will run on all Pi computers. All compiler binaries can produce code optimized for the 2B or the 3B, but by default they target the same architecture they were compiled for.

Re: GCC 6.1 Released

Posted: Sat Jun 25, 2016 1:17 pm
by jahboater
Or try this (I tend to give cpu/fpu defaults exactly):

Code: Select all

../configure -v --enable-languages=c,c++ --with-cpu=cortex-a7 \
  --with-fpu=neon-vfpv4 --with-float=hard --build=arm-linux-gnueabihf \
  --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf

Re: GCC 6.1 Released

Posted: Sat Jun 25, 2016 3:17 pm
by iJean
Hmmm, curious, I've used a configure command similar with what ejolson recommends and always I have an error related to:

build/automata

I think, my problem was that I didn't created a swap file like jahboater initially suggested. I'll enable a swap partition and try again.