installing gcc4 on Debian 12.6

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
LMHmedchem
Posts: 20
Joined: 2024-07-05 18:36

installing gcc4 on Debian 12.6

#1 Post by LMHmedchem »

Hello,

I am building an older application on Debian 12.6 and am having some issues with gcc-12. The last time I built this on linux was using gcc 4.8. There are a great many issues that need to be resolved to get this to compile and link with gcc11+ so I would like to go back to an older version that will work out of the box, at least for now.

I have looked on the Debian ftp site here,

http://ftp.us.debian.org/debian/pool/main/g/

but there is no entry for gcc4. There is a gcc3 entry that looks like src and then the next version is gcc7.

Is there anywhere I can get a .deb install package for the final version of gcc4/g++4/gfortran4? Would the gcc7 version likely work the same as 4? I don't know what changes were made along the way other than that gcc11 was a big jump.

Thanks,

LMHmedchem

Aki
Global Moderator
Global Moderator
Posts: 4311
Joined: 2014-07-20 18:12
Location: Europe
Has thanked: 126 times
Been thanked: 579 times

Re: installing gcc4 on Debian 12.6

#2 Post by Aki »

Hello,
LMHmedchem wrote: 2024-09-12 23:23 I am building an older application on Debian 12.6 and am having some issues with gcc-12. The last time I built this on linux was using gcc 4.8.
Is your "older application" available as public source code ?
LMHmedchem wrote: 2024-09-12 23:23 There are a great many issues that need to be resolved to get this to compile and link with gcc11+ so I would like to go back to an older version that will work out of the box, at least for now. I have looked on the Debian ftp site but there is no entry for gcc4. There is a gcc3 entry that looks like src and then the next version is gcc7.
These are the versions currently available in Debian maintained releases:

Code: Select all

$ rmadison gcc --arch amd64
gcc        | 4:8.3.0-1     | oldoldstable | amd64
gcc        | 4:10.2.1-1    | oldstable    | amd64
gcc        | 4:12.2.0-3    | stable       | amd64
gcc        | 4:14.1.0-2    | testing      | amd64
gcc        | 4:14.1.0-2    | unstable     | amd64
LMHmedchem wrote: 2024-09-12 23:23 Is there anywhere I can get a .deb install package for the final version of gcc4/g++4/gfortran4?
You can search here:
LMHmedchem wrote: 2024-09-12 23:23 Would the gcc7 version likely work the same as 4?
It probably depends on the target source code.
LMHmedchem wrote: 2024-09-12 23:23 I don't know what changes were made along the way other than that gcc11 was a big jump.
Each Debian package has a changelog; furthermore, you can see here:
⢀⣴⠾⠻⢶⣦⠀
⣾⠁⢠⠒⠀⣿⡁ Debian - The universal operating system
⢿⡄⠘⠷⠚⠋⠀ https://www.debian.org
⠈⠳⣄⠀

User avatar
blackbird
Posts: 105
Joined: 2023-08-17 04:42
Has thanked: 4 times
Been thanked: 25 times

Re: installing gcc4 on Debian 12.6

#3 Post by blackbird »

Would using Docker be an option? There is e.g. a docker image from gcc - https://hub.docker.com/_/gcc/

Valter
Posts: 5
Joined: 2022-09-11 10:37
Location: Europe
Has thanked: 2 times

Re: installing gcc4 on Debian 12.6

#4 Post by Valter »

You could try to set the dialect with the -std" option. In your makefile if exists

Code: Select all

CC = gcc -std=89
And the same for g++. See the man page for details.

PeterB
Posts: 125
Joined: 2010-10-03 16:53
Has thanked: 1 time
Been thanked: 2 times

Re: installing gcc4 on Debian 12.6

#5 Post by PeterB »

Its on snapshot,
https://snapshot.debian.org/binary/?cat=g

just below ....14

Cheers,
Peter

User avatar
marky611
Posts: 70
Joined: 2011-08-05 18:17
Location: New England
Been thanked: 1 time

Re: installing gcc4 on Debian 12.6

#6 Post by marky611 »

As this thread is a few months old now, I'll add to the discussion with a potential solution that might help others:

You could use Debian Etch (Debian 4.0) which shipped with gcc 4.1. Here's how:

1. Download the Debian Etch netinstall ISO: https://cdimage.debian.org/mirror/cdima ... etinst.iso

2. After basic installation, set up your /etc/apt/sources.list with:

Code: Select all

deb http://archive.debian.org/debian/ etch main
deb-src http://archive.debian.org/debian/ etch main

3. Run the next commands going forward as root:

Code: Select all

apt-get update
apt-get install gcc-4.1

If you need a GUI environment, you can also install xorg and gnome:

Code: Select all

apt-get install xorg gnome-core

Important notes:
- This is only recommended for isolated development/testing environments
- I've done this exact setup for researching mid 2000s Linux using QEMU with user mode networking (-net user). This configuration is quite safe as QEMU's user networking creates an isolated virtual network environment. Your VM gets its own internal VLAN with no direct external network access, essentially acting as a NAT with its own DHCP server.
Attachments
Screenshot 2025-01-30 131230.png
Screenshot 2025-01-30 131230.png (137.61 KiB) Viewed 2756 times
Software Engineer

AKA: markmental/mentalnet98

Debian User since 6.0 Squeeze

My Technical Blog: http://mentalnet.xyz/mentalnet98-netblog/

User avatar
stevepusser
Posts: 13137
Joined: 2009-10-06 05:53
Has thanked: 56 times
Been thanked: 105 times

Re: installing gcc4 on Debian 12.6

#7 Post by stevepusser »

Debian 8 had gcc-4.9 by default, but Debian 9, which had a gcc-6 as default, still might have had it available in the repos, just like bookworm has gcc-11 still available
MX Linux packager and developer

Post Reply