0

I am trying to install gcc-5 on debian 8.10 on a beaglebone green.

I have looked at many threads, of which the following was the most promising. How to install GCC 5 on debian jessie 8.1

When I try to follow the instruction of

echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list.d/unstable.list

I get an error, similarly when I try the same with sudo.

If I elevate the user, using sudo su -, It seems I am successful.

debian@beaglebone:~$ echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list.d/unstable.list
-bash: /etc/apt/sources.list.d/unstable.list: Permission denied
debian@beaglebone:~$ sudo echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list.d/unstable.list
-bash: /etc/apt/sources.list.d/unstable.list: Permission denied
debian@beaglebone:~$ sudo su -
root@beaglebone:~# echo "deb http://ftp.us.debian.org/debian unstable main contrib non-free" >> /etc/apt/sources.list.d/unstable.list
root@beaglebone:~# cat /etc/apt/sources.list.d/unstable.list

deb http://ftp.us.debian.org/debian unstable main contrib non-free root@beaglebone:~# exit logout debian@beaglebone:~$ sudo cat /etc/apt/sources.list.d/unstable.list

deb http://ftp.us.debian.org/debian unstable main contrib non-free debian@beaglebone:~$

Continuing, sudo apt-get update all seems fine.

debian@beaglebone:~$ sudo apt-get update
Ign http://deb.debian.org jessie InRelease
Hit http://repos.rcn-ee.com jessie InRelease                                                            
Hit http://deb.debian.org jessie-updates InRelease                                                      
Hit http://deb.debian.org jessie/updates InRelease
Hit https://deb.nodesource.com jessie InRelease
Hit https://deb.nodesource.com jessie InRelease
Hit http://ftp.us.debian.org unstable InRelease
Hit http://deb.debian.org jessie Release.gpg   
Hit http://deb.debian.org jessie Release
Get:1 http://repos.rcn-ee.com jessie/main armhf Packages [987 kB]
Get:2 http://deb.debian.org jessie-updates/main armhf Packages [20 B]            
Get:3 http://deb.debian.org jessie-updates/contrib armhf Packages [20 B]                           
Get:4 https://deb.nodesource.com jessie/main armhf Packages [980 B]                    
Get:5 http://deb.debian.org jessie-updates/non-free armhf Packages [20 B]                               
Get:6 http://deb.debian.org jessie/updates/main armhf Packages [961 kB]                
Get:7 https://deb.nodesource.com jessie/main Sources [20 B]                          
Get:8 https://deb.nodesource.com jessie/main armhf Packages [765 B]                                     
Get:9 http://ftp.us.debian.org unstable/main armhf Packages [11.9 MB]                                   
Get:10 http://deb.debian.org jessie/updates/contrib armhf Packages [994 B]                              
Get:11 http://deb.debian.org jessie/updates/non-free armhf Packages [4,393 B]                           
Get:12 http://deb.debian.org jessie/main armhf Packages [8,898 kB]                                      
Get:13 http://ftp.us.debian.org unstable/contrib armhf Packages [61.4 kB]                               
Get:14 http://ftp.us.debian.org unstable/non-free armhf Packages [78.7 kB]                              
Get:15 http://deb.debian.org jessie/contrib armhf Packages [44.3 kB]                                    
Get:16 http://deb.debian.org jessie/non-free armhf Packages [74.9 kB]                                   
Fetched 23.0 MB in 1min 22s (281 kB/s)                                                                  
Reading package lists... Done
debian@beaglebone:~$ 

But when I try the last instruction of:

apt-get install -t unstable gcc-5

It does not work: as default user:

debian@beaglebone:~$ sudo apt-get install -t unstable gcc-5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package gcc-5
debian@beaglebone:~$ 

The same happens if I elevate user:

root@beaglebone:~# apt-get install -t unstable gcc-5
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package gcc-5
root@beaglebone:~#

I am using this kernel image Debian 8.10 2018-02-01 4GB SD SeeedStudio IoT

I need to run this specific image because it is the most recent image that supports the HDMI Cape.

I am trying to run a node.js server as well as C/C++ code. Being unable to run the node.js server and the app boiled down to not having the correct version of gcc because:

whenever I run node server.js, I get the following error:

My host has gcc version 9.4, and node js version 10.19

Yes I ran,

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

on both host and target.

I also followed the debian 8 guide to install different versions of nodejs, the same issue persists.

https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-debian-8

Any help would be appreciated.

  • Debian "unstable" at the time of Jessie is probably old-stable now. Oh wait, it's worse - it's oldoldstable: https://packages.debian.org/search?keywords=gcc-5 – muru Apr 10 '22 at 08:58
  • I see, thank you for sharing! I've wracked my head at this for 5 hours, unsure how to proceed. There's no newer kernel image that supports this HDMI Cape. – big friendly giant Apr 10 '22 at 09:01
  • 1
    In that case, once you have that Debian Jessie, why not try LXC or Docker or even just a chroot to run a container of a newer version, within which you can then run gcc 5 or even newer versions? – muru Apr 10 '22 at 09:04
  • 1
    In case "BeagleBone Green" really means "SeeedStudio BeagleBone Green (BBG)", then BeagleBoard currently offers buster / Debian 10 images, which would be better than Debian 8 (but would have even less chance to install this older gcc-5 version): https://beagleboard.org/latest-images – A.B Apr 10 '22 at 12:00
  • can you tell us why you'd want to run an extremely old GCC, which is even older than the already ancient Debian you want to run it on (stretch/9, which came after Debian 8, already ships GCC 6.3), on your embedded device? That sounds like "two bad ideas for the price of one"! – Marcus Müller Apr 10 '22 at 13:50
  • 1
    So, maybe, you should take a step back, and ask a new question, separately that explains what you're trying to do, and your current approach, and asks for advice on how to achieve the goal that's behind trying to install GCC 5! That will probably take you much further. Nothing says NPM needs an prehistoric GCC... quite the contrary, actually. Something here just doesn't line up. – Marcus Müller Apr 10 '22 at 13:54
  • removed the screenshots of text, because they didn't contain anything not in the text, and only cluttered the question. – Marcus Müller Apr 10 '22 at 13:56

1 Answers1

0

Your problem is, that the instructions you found are as ancient as the Debian version you want to use. I must highly discourage using such old software. Please consider using a more recent version of Debian.

That said, you need to find a repository with gcc-5 that fits to your desired Debain version. "unstable" is a codename that refers to current, as in "right now" versions, which means everything in unstable is ahead of the current stable release. Jessie, on the other hand, is eons behind the current stable release. The packages are not compatible.

Even jessie-backports will only ship gcc-4.9 and not 5. You can try using a Debian stretch repository, but this may turn out tricky, because a lot of things depend on gcc packages and may not respond well to a new major version.

You can simply add the Stretch repo through

echo "deb http://ftp.us.debian.org/debian stretch main contrib non-free" >> /etc/apt/sources.list.d/buster.list

In order to prevent upgrades that have every chance of breaking your system, we have to assign a lower priority to these new repos.

cat - > /etc/apt/preferences.d/99stretch <<EOF
Package: *
Pin: release v=9.13
Pin-Priority: 99
EOF

Please refer to AptPreferences and DontBreakDebian. The new file S99stretch should set up the stretch repository, so that by default your system will not install packages from it. You can and must explicitly enable installing software from this repository, for instance

apt-get install -t strech-main gcc-5

This should allow you to specifically install gcc from the strech repo. Still, there is a high chance that this will either not work at all, or eventually force a full upgrade to stretch. I didn't try this out, this is just how I would approach this, if I was hell bent on sticking to Jessie.

Bananguin
  • 7,984