How to install gcc-4.8 or 4.9 on Debian 10?

Need help with C, C++, perl, python, etc?

How to install gcc-4.8 or 4.9 on Debian 10?

Postby flyingosprey » 2020-04-10 20:56

I need build some old projects, using gcc-4.8 or 4.9. (Latest gcc prompts tons of errors. I don't have time for the fix)

How to install gcc-4.8 or 4.9 on Debian 10?

Thanks.
flyingosprey
 
Posts: 3
Joined: 2020-04-10 20:53

Re: How to install gcc-4.8 or 4.9 on Debian 10?

Postby neuraleskimo » 2020-04-10 21:41

Docker Hub has Jessie images, which will get you ~4.9. You probably don’t want to hear me say this, but I would fix the errors instead. Either way, good luck!
Black Lives Matter
neuraleskimo
 
Posts: 195
Joined: 2019-03-12 23:26

Re: How to install gcc-4.8 or 4.9 on Debian 10?

Postby flyingosprey » 2020-04-11 00:02

Thanks. Currently, I am using Debian 8 to build the project.

Fixing errors is not an optional for me because it's a monster level project.

Seems there is no easy way to install gcc-4.8 or 4.9 on Debian 10, which is bad. As a comparison it's easy to install gcc-4.8 on Ubuntu 18 LTS.
flyingosprey
 
Posts: 3
Joined: 2020-04-10 20:53

Re: How to install gcc-4.8 or 4.9 on Debian 10?

Postby neuraleskimo » 2020-04-11 00:50

If you use the Jesse Docker image, you are installing GCC on Debian 10. It just lives in a container. Of course, I am laughing as I write that because some would argue that is a huge difference. Yes, in a concrete sense it is a container. However, think of it as an abstraction layer that allows you to separate your development environment from your workstation. Heck, I run Debian 10 dev tools inside a Debian 10 container on my Debian 10 workstation. This allows me to have different build environments for each project. Take a look at my GitHub (https://github.com/tonywalker1/cpp_dev) for an example.

I hope this helps.
Black Lives Matter
neuraleskimo
 
Posts: 195
Joined: 2019-03-12 23:26

Re: How to install gcc-4.8 or 4.9 on Debian 10?

Postby flyingosprey » 2020-04-11 01:31

Thanks. Currently, I install Debian 8 on a VM, using the ISO from https://cdimage.debian.org/mirror/cdima ... 64/iso-cd/.

If there is a direct easy way to install old gcc on Debian 10, that would be perfect.
flyingosprey
 
Posts: 3
Joined: 2020-04-10 20:53

Re: How to install gcc-4.8 or 4.9 on Debian 10?

Postby stevepusser » 2020-04-12 00:53

I use pbuilder and sbuild all the time to compile packages with Jessie's gcc on a Buster base. If you have to manually compile stuff, you can also log into an sbuild chroot and do that in the terminal there. It's a lot faster and more lightweight than using virtualization, and it's even possible to build any architecture, such as for ARM or S390 (those non-x86 arches suffer a lot of overhead, though. Someone requested an Ubuntu Bionic armhf armbian Pale Moon build, and it took ten times as long as the x86 arch builds)
MX Linux packager and developer
User avatar
stevepusser
 
Posts: 12139
Joined: 2009-10-06 05:53

Re: How to install gcc-4.8 or 4.9 on Debian 10?

Postby Head_on_a_Stick » 2020-04-13 10:18

I've just tried adding the jessie repositories (including security) to my buster system and this seems to work:
Code: Select all
empty@E485 ~ % apt install -s gcc-4.9
NOTE: This is only a simulation!
      apt needs root privileges for real execution.
      Keep also in mind that locking is deactivated,
      so don't depend on the relevance to the real current situation!
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  cpp-4.9 gcc-4.9-base libasan1 libcloog-isl4 libgcc-4.9-dev libisl10 libmpfr4
  multiarch-support
Suggested packages:
  gcc-4.9-locales gcc-4.9-multilib gcc-4.9-doc libgcc1-dbg libgomp1-dbg libitm1-dbg
  libatomic1-dbg libasan1-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg libcilkrts5-dbg
  libquadmath0-dbg
The following NEW packages will be installed:
  cpp-4.9 gcc-4.9 gcc-4.9-base libasan1 libcloog-isl4 libgcc-4.9-dev libisl10 libmpfr4
  multiarch-support
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Inst multiarch-support (2.28-10 Debian:10.3/stable [amd64])
Inst gcc-4.9-base (4.9.2-10+deb8u2 Debian-Security:8/oldoldstable [amd64])
Conf multiarch-support (2.28-10 Debian:10.3/stable [amd64])
Inst libasan1 (4.9.2-10+deb8u2 Debian-Security:8/oldoldstable [amd64])
Inst libisl10 (0.12.2-2 Debian:8.11/oldoldstable [amd64])
Inst libcloog-isl4 (0.18.2-1+b2 Debian:8.11/oldoldstable [amd64])
Inst libmpfr4 (3.1.2-2 Debian:8.11/oldoldstable [amd64])
Inst cpp-4.9 (4.9.2-10+deb8u2 Debian-Security:8/oldoldstable [amd64])
Inst libgcc-4.9-dev (4.9.2-10+deb8u2 Debian-Security:8/oldoldstable [amd64])
Inst gcc-4.9 (4.9.2-10+deb8u2 Debian-Security:8/oldoldstable [amd64])
Conf gcc-4.9-base (4.9.2-10+deb8u2 Debian-Security:8/oldoldstable [amd64])
Conf libasan1 (4.9.2-10+deb8u2 Debian-Security:8/oldoldstable [amd64])
Conf libisl10 (0.12.2-2 Debian:8.11/oldoldstable [amd64])
Conf libcloog-isl4 (0.18.2-1+b2 Debian:8.11/oldoldstable [amd64])
Conf libmpfr4 (3.1.2-2 Debian:8.11/oldoldstable [amd64])
Conf cpp-4.9 (4.9.2-10+deb8u2 Debian-Security:8/oldoldstable [amd64])
Conf libgcc-4.9-dev (4.9.2-10+deb8u2 Debian-Security:8/oldoldstable [amd64])
Conf gcc-4.9 (4.9.2-10+deb8u2 Debian-Security:8/oldoldstable [amd64])
empty@E485 ~ %

I don't think it would cause any problems because the newer package versions from buster would be favoured by APT so only packages that are no longer in stable would be drawn from jessie. I'm not trying it for real though, just in case.

Another alternative to neuraleskimo's excellent Docker suggestion would be a simple jessie chroot for development purposes, use debootstrap to lay down the system (replace $user with your actual user name):
Code: Select all
$ mkdir ~/jessie_chroot
# debootstrap jessie /home/$user/jessie_chroot http://deb.debian.org/debian
# chroot /home/$user/jessie_chroot
[chroot]# apt install gcc-4.9

The systemd-machined package would allow systemd-nspawn(1) to be used to run the chroot as a fully-working system, services and all:
Code: Select all
# systemd-nspawn -bD /home/$user/jessie_chroot
Black Lives Matter

Debian buster-backports ISO image: for new hardware support
User avatar
Head_on_a_Stick
 
Posts: 12804
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: How to install gcc-4.8 or 4.9 on Debian 10?

Postby stevepusser » 2020-04-14 05:15

I'm pretty sure you'll also need g++-4.9 in order to build anything, going by my experience with newer non-default compilers.
MX Linux packager and developer
User avatar
stevepusser
 
Posts: 12139
Joined: 2009-10-06 05:53


Return to Programming

Who is online

Users browsing this forum: No registered users and 2 guests

fashionable