Hello,
I've just installed the latest version of raspbian and it comes with gcc 4.9.2-10. I'm using gcc 5 in my main linux distro (openSuse) and I'm looking into having the same version on both platforms.
If I look search for gcc in aptitude I only get version up to 4.9. Can anyone tell me if there is (and where is it) the repository where I can get gcc 5 for raspbian?
Thank you in advance
A
Re: gcc5 repository
I use GCC 5.3 on the Pi2.
I don't think you can get it from the repositories.
You will have to build it yourself which takes a few hours!
I don't think you can get it from the repositories.
You will have to build it yourself which takes a few hours!
Pi4 8GB and Pi4 4GB running Raspberry Pi OS 64-bit
Re: gcc5 repository
gcc 5 is in raspbian stretch if you are mad enough to upgrade to that 

Re: gcc5 repository
My recollection is a that few hours means about 8 when compiling on the Pi 2B. Note that you will need a 2 GB swap file for the compilation to finish.jahboater wrote:I use GCC 5.3 on the Pi2.
I don't think you can get it from the repositories.
You will have to build it yourself which takes a few hours!
Though I haven't tested it, David Carver has placed a build of gcc 5.1.0 on github that he says includes my port of the cilkrts parallel processing library to ARM CPUs. As the patches are only a few lines, I would suggest following my build instructions.
Re: gcc5 repository
It all depends on how long you have - "make" or "make -j1" will take nearly two days, but will succeed without any extra swap space. As you increase towards -j4 it needs more and more memory, but never needs more than 1GB swap even with "make -j4" (at least it doesn't for me).My recollection is a that few hours means about 8 when compiling on the Pi 2B. Note that you will need a 2 GB swap file for the compilation to finish.
Create the swapfile if needed
Code: Select all
sudo dd if=/dev/zero of=/swapfile1GB bs=1M count=1024
sudo mkswap /swapfile1GB
sudo swapon /swapfile1GB
Code: Select all
cd gcc-5.3.0
contrib/download_prerequisites
Code: Select all
mkdir obj
cd obj
../configure -v --with-arch=armv6 --with-fpu=vfp \
--with-float=hard --build=arm-linux-gnueabihf \
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf \
--prefix=/home/pi/gcc-5.3 \
--disable-softfloat \
--enable-languages=c
make -j4
Pi4 8GB and Pi4 4GB running Raspberry Pi OS 64-bit
Re: gcc5 repository
That is interesting. I chose 2GB based on the rule of thumb that swap should be 2x available RAM. Getting by with less could be useful, especially for those putting swap on the sdcard.jahboater wrote:As you increase towards -j4 it needs more and more memory, but never needs more than 1GB swap even with "make -j4" (at least it doesn't for me).
Re: gcc5 repository
I added:-
The configure in your build instructions looks better
to try and speed things up a little, which may reduce the swap needed, I don't know.--disable-softfloat \
--enable-languages=c
The configure in your build instructions looks better
Code: Select all
../gcc-src/configure -v --enable-languages=c,c++ \
--prefix=/usr/local/gcc-5.3 --with-arch=armv7-a \
--with-fpu=vfp --with-float=hard --build=arm-linux-gnueabihf \
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Pi4 8GB and Pi4 4GB running Raspberry Pi OS 64-bit
-
- Posts: 5
- Joined: Thu Mar 24, 2016 11:03 pm
Re: gcc5 repository
Does that command work when cross compiling on a 64-bit desktop of Ubuntu with the arm binaries installed? If not, how would you set the cross compiler to avoid all of the memory constraints and decrease compile time?
I'm looking at using --thumb-interwork, graphite, gold, and lto to eventually compile recalbox. I'm also looking at compiling a Thumb based distro for the RPi3 with ARM code as needed.
I'm looking at using --thumb-interwork, graphite, gold, and lto to eventually compile recalbox. I'm also looking at compiling a Thumb based distro for the RPi3 with ARM code as needed.
Re: gcc5 repository
To be honest I don't know.d3m0n1q_733rz wrote:Does that command work when cross compiling on a 64-bit desktop of Ubuntu with the arm binaries installed? If not, how would you set the cross compiler to avoid all of the memory constraints and decrease compile time?
I'm looking at using --thumb-interwork, graphite, gold, and lto to eventually compile recalbox. I'm also looking at compiling a Thumb based distro for the RPi3 with ARM code as needed.
The GCC build time on the Pi3 is down to 4.5 - 5 hours which is good enough for me, new releases don't come out that often.
Now I use:-
Code: Select all
../configure -v --enable-languages=c,c++ \
--prefix=/home/pi/gcc-5.3 --with-arch=armv8-a \
--with-fpu=neon-vfpv4 --with-float=hard --build=arm-linux-gnueabihf \
--host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Pi4 8GB and Pi4 4GB running Raspberry Pi OS 64-bit
-
- Posts: 5
- Joined: Thu Mar 24, 2016 11:03 pm
Re: gcc5 repository
I'm not entirely sure why it states that it's depreciated unless it's still trying to consider A32 mode instead of T32. You did specify to compile in Thumb as default and maybe interwork with ARM where it makes sense? In ARM mode, it doesn't use if-then statements as far as I understand. It's also possible that it's trying to use depreciated conditions in the if-then command. So it's sort of a toss-up to see what's going on unless you can disassemble and find the block it's talking about.
Re: gcc5 repository
I use thumb2 (-mthumb) for the entire program so there is no interwork. I've been doing this ever since the Pi2 came out. Perhaps its a GCC or gas bug, I know conditional execution is limited in aarch64 and may be its getting mixed up somehow.d3m0n1q_733rz wrote:I'm not entirely sure why it states that it's depreciated unless it's still trying to consider A32 mode instead of T32. You did specify to compile in Thumb as default and maybe interwork with ARM where it makes sense? In ARM mode, it doesn't use if-then statements as far as I understand. It's also possible that it's trying to use depreciated conditions in the if-then command. So it's sort of a toss-up to see what's going on unless you can disassemble and find the block it's talking about.
I narrowed it down to the -mfpu=neon-vfpv4 flag without which it assembles cleanly. /tmp/cckgobmA.s is removed before I can look at it. Using -S, there are no IT blocks near the lines stated./tmp/cckgobmA.s: Assembler messages:
/tmp/cckgobmA.s:1280: Warning: IT blocks containing 32-bit Thumb instructions are deprecated in ARMv8
/tmp/cckgobmA.s:22025: Warning: IT blocks containing 32-bit Thumb instructions are deprecated in ARMv8
/tmp/cckgobmA.s:22940: Warning: IT blocks containing 32-bit Thumb instructions are deprecated in ARMv8
EDIT:
I think it is a bug.
https://gcc.gnu.org/ml/gcc-bugs/2015-09/msg01248.html
Adding -mrestrict-it doesn't help.-mrestrict-it
Restricts generation of IT blocks to conform to the rules of ARMv8. IT blocks can
only contain a single 16-bit instruction from a select set of instructions. This
option is on by default for ARMv8 Thumb mode.
Pi4 8GB and Pi4 4GB running Raspberry Pi OS 64-bit