4

I want to install the package which is missing in jessie from wheezy. It is like backport the other way. I need gcc-4.7, but jessie provides only gcc-4.9. Unstable provides gcc-4.7 only for arm architecture. I plan to add wheezy repo into my surces and install it with command

apt install gcc-4.7/wheezy

Is it relatively safe to do it? Do I risk dependency problems doing this?

Mihalko
  • 141
  • 3
  • Why? This makes no sense! Why do you want to install the _older_ compiler? – Michael Hampton Feb 16 '16 at 17:10
  • 1
    @MichaelHampton because target systems use older version of stdc++, same problem as here http://stackoverflow.com/questions/2085427/link-with-an-older-version-of-libstdc . Does it make sense now? – Mihalko Feb 19 '16 at 07:04

2 Answers2

1

Most likely it is not going to work flawlessly. Usually paths and binaries from older versions conflict with the new ones. Sometimes somebody backports it and when they do, it usually involves changing paths to get all working under non-standard directories. This makes the package work but no other package will find their dependencies.

One thing that you might want to try is to make the affected executable run in a docker container. You can create a container of a previous Debian version, install there the minimal software needed to run your executable and then create an image of the container. All the dependencies will be inside the container and you can simply run it with docker run <image> <command>. This can save the day for some command line software, even for server software but coud be a mess if the affected executable needs Xserver or administrative privileges.

theist
  • 1,199
  • 2
  • 9
  • 24
1

You could try recompiling the source deb package you get from wheezy, on your jessie instance. Please note that I'm assuming gcc-4.7 can be compiled without errors using gcc-4.9, which is not a sure bet.

However the general procedure should be:

  1. Add wheezy binaries as source to your /etc/apt/sources.list file, such as deb http://ftp.us.debian.org/debian/ wheezy main contrib
  2. Add wheezy sources as source to your /etc/apt/sources.list file, such as deb-src http://ftp.us.debian.org/debian/ wheezy main contrib
  3. run apt-get update
  4. download the gcc-4.7 source package: apt-get source gcc-4.7
  5. install gcc-4.7 build-dependencies by running apt-get build-dep gcc-4.7 (this can be quite hard actually, because there might be a number of conflicts with your currently installed packages and you need to sort them out manually)
  6. enter the directory where apt-get downloaded gcc-4.7 source package in step 4, e.g. cd gcc-4.7 or whatever it is called
  7. build gcc-4.7: dpkg-buildpackage -us -uc
  8. assuming it builds without errors, install the generated packages you'll find in the parent directory

I've written this procedure going by memory, so please take it with a grain of salt and adjust commands where needed. In particular I'm not sure dpkg-buildpackage -us and -ucoptions existed in jessie, if they didn't just don't use them.

Lucio Crusca
  • 330
  • 2
  • 10
  • 31