jahboater
Posts: 5434
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

GCC 6.1 Released

Thu Apr 28, 2016 7:22 am

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
Last edited by jahboater on Fri Apr 29, 2016 9:28 am, edited 2 times in total.
"We are in the beginning of a mass extinction, and all you can talk
about is money and fairy tales of eternal economic growth."
- Greta Thunberg

SteveSpencer
Posts: 351
Joined: Thu Mar 28, 2013 9:19 am
Location: Nottingham, UK

Re: GCC 6.1 Released

Thu Apr 28, 2016 3:35 pm

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 :)
Steve S
No, I can't think of anything funny that won't offend someone if they want it to...

jahboater
Posts: 5434
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: GCC 6.1 Released

Thu Apr 28, 2016 4:20 pm

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).
"We are in the beginning of a mass extinction, and all you can talk
about is money and fairy tales of eternal economic growth."
- Greta Thunberg

ejolson
Posts: 4878
Joined: Tue Mar 18, 2014 11:47 am

Re: GCC 6.1 Released

Fri Apr 29, 2016 5:59 am

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?

SteveSpencer
Posts: 351
Joined: Thu Mar 28, 2013 9:19 am
Location: Nottingham, UK

Re: GCC 6.1 Released

Fri Apr 29, 2016 9:00 am

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 ? :|
Steve S
No, I can't think of anything funny that won't offend someone if they want it to...

jahboater
Posts: 5434
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: GCC 6.1 Released

Fri Apr 29, 2016 9:11 am

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".
"We are in the beginning of a mass extinction, and all you can talk
about is money and fairy tales of eternal economic growth."
- Greta Thunberg

jahboater
Posts: 5434
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: GCC 6.1 Released

Fri Apr 29, 2016 9:28 am

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.
"We are in the beginning of a mass extinction, and all you can talk
about is money and fairy tales of eternal economic growth."
- Greta Thunberg

echmain
Posts: 296
Joined: Fri Mar 04, 2016 8:26 pm

Re: GCC 6.1 Released

Sun May 01, 2016 2:16 pm

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?

jahboater
Posts: 5434
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: GCC 6.1 Released

Sun May 01, 2016 6:37 pm

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.
"We are in the beginning of a mass extinction, and all you can talk
about is money and fairy tales of eternal economic growth."
- Greta Thunberg

User avatar
rpdom
Posts: 16737
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: GCC 6.1 Released

Sun May 01, 2016 7:02 pm

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.

jahboater
Posts: 5434
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: GCC 6.1 Released

Fri May 13, 2016 12:01 pm

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!
"We are in the beginning of a mass extinction, and all you can talk
about is money and fairy tales of eternal economic growth."
- Greta Thunberg

iJean
Posts: 4
Joined: Sat Jan 10, 2015 1:54 am

Re: GCC 6.1 Released

Sat Jun 25, 2016 5:54 am

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

ejolson
Posts: 4878
Joined: Tue Mar 18, 2014 11:47 am

Re: GCC 6.1 Released

Sat Jun 25, 2016 11:03 am

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.

jahboater
Posts: 5434
Joined: Wed Feb 04, 2015 6:38 pm
Location: West Dorset

Re: GCC 6.1 Released

Sat Jun 25, 2016 1:17 pm

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
"We are in the beginning of a mass extinction, and all you can talk
about is money and fairy tales of eternal economic growth."
- Greta Thunberg

iJean
Posts: 4
Joined: Sat Jan 10, 2015 1:54 am

Re: GCC 6.1 Released

Sat Jun 25, 2016 3:17 pm

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.

Return to “C/C++”