7

https://github.com/clearlinux-pkgs/gcc

How to compile gcc in ubuntu 20.04 with clearlinux config and patches?

500 Reward to step by step copy/paste tutorial.

I needed this for How to replace ubuntu 20.04 kernel with clearlinux kernel?

nazar2sfive
  • 1,335

2 Answers2

4

Thanks to @Raffa and i hope @Raffa writes the answer here so i will award him the award.

wget https://cdn.download.clearlinux.org/releases/33030/clear/x86_64/os/Packages/gcc7-7.5.0-440.x86_64.rpm
sudo apt install alien git curl
sudo alien gcc7-7.5.0-440.x86_64.rpm
sudo dpkg -i gcc7_7.5.0-441_amd64.deb
gcc7 -v
nazar2sfive
  • 1,335
  • 3
    since you've written your own answer and accepted it, best to edit the question as well. I'd suggest replacing "compile" both in the question and in the description with "install" – Robert Riedl May 06 '20 at 09:09
  • Done and added extra information on the usage of alien. Thank you to you and thank you to @sancho.s ReinstateMonicaCellio – Raffa May 09 '20 at 19:42
3

Sometimes you are forced to compile packages from source because they are not readily available in Ubuntu package format, which can be really annoying as it is not always a straightforward procedure and can be a lengthy and time consuming process.

While this is the safer option, there is also a quicker alternative, which is converting existing packages from other formats into Ubuntu format with alien.

DESCRIPTION:

alien is a program that converts between Red Hat rpm, Debian deb, Stampede slp, Slackware tgz, and Solaris pkg file formats. If you want to use a package from another linux distribution than the one you have installed on your system, you can use alien to convert it to your preferred package format and install it. It also supports LSB packages.

WARNING:

alien should not be used to replace important system packages, like init, libc, or other things that are essential for the functioning of your system. Many of these packages are set up differently by the different distributions, and packages from the different distributions cannot be used interchangeably. In general, if you can't remove a package without breaking your system, don't try to replace it with an alien version.

Please, read man alien before attempting to use it to know the usage safe limits for alien.


That being said, the gcc compiler package from Clear Linux is within the usage safe limits of alien and therefore the following procedure should work for installing this package on Ubuntu:

  • Install alien like so:
sudo apt install alien
wget https://cdn.download.clearlinux.org/current/x86_64/os/Packages/gcc7-7.5.0-440.x86_64.rpm
  • Create a .deb package from the downloaded .rpm package like so:
sudo alien gcc7-7.5.0-440.x86_64.rpm
  • Install the newly created .deb package like so:
sudo dpkg -i gcc7_7.5.0-441_amd64.deb
  • Verify that the Clear Linux gcc compiler is installed like so:
gcc7 -v

which should print this in the output:

gcc version 7.5.0 (Clear Linux OS for Intel Architecture)
  • Done, the package is installed and ready to use.
Raffa
  • 32,237