How to install clearlinux gcc in ubuntu?

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

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
  • Download the current gcc.x86_64.rpm package from Clear Linux -> current -> x86_64 -> os -> Packages like so:
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.

Tags:

20.04