0

I am trying to set-up an environment to compile an out-of-date project using some old gcc version, e.g., 4.8.2 inside a Docker container virtualizing Alpine Linux.

When I dive into the container i.e., docker run -it alpine:latest I try to apk list packages but of course I only see the latest versions of gcc/g++.

I thought I could at first install some dependencies, including the latest versions of the compilers and then remove them but when I run apk build-base I cannot apk del gcc g++ due to

World updated, but the following packages are not removed due to: gcc: g++ build-base

So I guess I have to install manually the gcc/g++ I want. Does anyone have any suggestion on how to do that? I do not wish to change to Ubuntu for instance and solve it there [1], instead I would like to give Alpine Linux a go thus I am sticking with it.

ex1led
  • 427
  • 5
  • 21
  • `Does anyone have any suggestion on how to do that?` Install manually the gcc/g++ you want. Just use an older alpine. – KamilCuk Dec 08 '20 at 11:27
  • @KamilCuk after looking at the releases of Alpine here : http://dl-cdn.alpinelinux.org/alpine/ I see that the older older one dating back at 2018. I need ```GCC 4.8.2``` or previous, which I am not sure that will be there. – ex1led Dec 08 '20 at 11:47

2 Answers2

1

If you wish to use an older version of GCC, you can download the source from GCC 4.8.0 and then build gcc from source.

You can give all the commands as part of your Dockerfile and then build the alpine image with the required GCC. If you don't want to create image, you can simply follow the steps mentioned to build gcc in alpine container.

ashu
  • 158
  • 6
0

Apart from building from source, you could grab a prebuilt GCC 4.9.4 for Alpine (musl) on the musl-cross-make Github repository by just-containers:
https://github.com/just-containers/musl-cross-make/releases/download/v9/gcc-4.9.4-x86_64-linux-musl.tar.xz

Additionally available GCC musl builds: 5.5.0, 6.4.0, 7.3.0, 9.2.0.

valiano
  • 16,433
  • 7
  • 64
  • 79