11

I tried install on my Debian strench g++-4.9 and I didn't find package via

apt-cache search g++-4.9

Oldest version I found only g++-5

Where can I get g++-4.9?

1
  • You could try rebuilding the jessie sources for 4.9 on stretch. Since 4.9 is the default for jessie, this should be possible. If you want to flesh this out as an answer, or want further information, let me know. You definitely want to test this in a VM or similar. Not on an actual working system. Jan 4, 2017 at 21:47

3 Answers 3

8

This works for debian10.3 without any package conflicts.

It downloads packages directly from the Debian FTP server and then installs them through dpkg.

#!/bin/bash
set -xe

BASE_URL=http://ftp.us.debian.org/debian/pool/main/
PACKAGES=$(cat <<-END
g/gcc-4.9/cpp-4.9_4.9.2-10%2Bdeb8u1_amd64.deb
g/gcc-4.9/g%2B%2B-4.9_4.9.2-10%2Bdeb8u1_amd64.deb
g/gcc-4.9/gcc-4.9-base_4.9.2-10%2Bdeb8u1_amd64.deb
g/gcc-4.9/gcc-4.9_4.9.2-10%2Bdeb8u1_amd64.deb
g/gcc-4.9/libgcc-4.9-dev_4.9.2-10%2Bdeb8u1_amd64.deb
g/gcc-4.9/libasan1_4.9.2-10%2Bdeb8u1_amd64.deb
g/gcc-4.9/libubsan0_4.9.2-10%2Bdeb8u1_amd64.deb
g/gcc-4.9/libcilkrts5_4.9.2-10%2Bdeb8u1_amd64.deb
g/gcc-4.9/libstdc%2B%2B-4.9-dev_4.9.2-10%2Bdeb8u1_amd64.deb
m/mpfr4/libmpfr4_3.1.5-1_amd64.deb
c/cloog/libcloog-isl4_0.18.4-1+b1_amd64.deb
i/isl/libisl10_0.12.2-2_amd64.deb
i/isl/libisl15_0.18-1_amd64.deb
END
)

mkdir -p ./downloads/gcc4.9
cd ./downloads/gcc4.9

while IFS= read -r package; do
    wget -c $BASE_URL$package
done <<< "$PACKAGES"

sudo apt-get install multiarch-support
sudo dpkg -i ./*.deb
4

I got it working (very unsoundly) by adding jessie repo and then installing from it. Include in /etc/apt/sources.list:

deb http://ftp.us.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.us.debian.org/debian/ jessie main contrib non-free

Do apt-get update && apt-get install g++-4.9

After installation comment out jessie lines so that it doesn't conflict later with stretch. It would have been much better if Debian had included other g++ versions. Strangely enough, we have many versions of gcc bundled but only one version of g++ (6.0).

2
  • This worked for me after I uninstalled the stretch version of gcc-4.9 with apt purge gcc-4.9 gcc-4.9-base
    – nathan
    Mar 22, 2018 at 23:03
  • 1
    You really should not be doing something like this. It will break debian. Read wiki.debian.org/DontBreakDebian May 27, 2019 at 20:37
2

http://ftp.us.debian.org/debian/pool/main/g/gcc-4.9/

Note the following useful answer: https://askubuntu.com/a/428199/456089

Instead, simply download all these:

binutils_2.25-5_amd64.deb
cpp_4.9.2-2_amd64.deb
g++_4.9.2-2_amd64.deb
gcc_4.9.2-2_amd64.deb
gcc-4.9-base_4.9.2-10_amd64.deb
libasan1_4.9.2-10_amd64.deb
libatomic1_4.9.2-10_amd64.deb
libcilkrts5_4.9.2-10_amd64.deb
libgcc1_4.9.2-10_amd64.deb
libgcc-4.9-dev_4.9.2-10_amd64.deb
libgomp1_4.9.2-10_amd64.deb
libitm1_4.9.2-10_amd64.deb
liblsan0_4.9.2-10_amd64.deb 
libmpfr4_3.1.2-2_amd64.deb
libquadmath0_4.9.2-10_amd64.deb
libstdc++-4.9-dev_4.9.2-10_amd64.deb
libstdc++6
libtsan0_4.9.2-10_amd64.deb
libubsan0_4.9.2-10_amd64.deb

From Debian's servers, e.g.:

http://ftp.us.debian.org/debian/pool/main/b/binutils/binutils_2.25-5_amd64.deb

Then install them, e.g.: $ for package in *.deb; do sudo dpkg --install "$package"; done

Note that you might hit some issues with dependencies, so you want to use as few of the packages in that list as you can get away with.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.