Dockerized GCC? Has anyone done this yet?

Notice: Page may contain affiliate links for which we may earn a small commission through services like Amazon Affiliates or Skimlinks.

Patrick

Administrator
Staff member
Dec 21, 2010
12,513
5,804
113
I want to do a piece similar to what we did with Cavium ThunderX regarding how compiler choice helps/ hinders AMD Ryzen.

If you have built GCC, you will know it takes a relatively long time. Since this is something I will likely do in the future, I found that GNU GCC has docker images with different compiler versions: https://hub.docker.com/_/gcc/

Has anyone tried this yet? Am I in for a rough day even thinking about doing this?
 

sean

Member
Sep 26, 2013
67
33
18
CT
You can have multiple GCC versions installed together. We ship it for customers and use modules to make it easy to use any of the versions. I don't exactly recommend using modules to do this, but it is handy.

Using Docker seems kind of crazy, but the alternative is to package it and maintain that. The options provided are limited, with only the latest 4.9, 5.0, or 6.0 releases. It may be worthwhile to have a custom Docker image with more versions within one image. You then don't have to worry about CentOS vs Ubuntu packaging.
 
  • Like
Reactions: Patrick

Patrick

Administrator
Staff member
Dec 21, 2010
12,513
5,804
113
I have done multiple gcc (and icc) versions on a single machine. What I need is the ability to do, for example, a 20x3 matrix. 20 machines 3 different compiler versions and launch quickly.
 

eva2000

Active Member
Apr 15, 2013
244
49
28
Brisbane, Australia
centminmod.com
I am by no means a Ubuntu expert but started building my own cpuminer docker image on Ubuntu Zesty 17 with GCC 7.0 via toolchains at PPA for Ubuntu Toolchain Uploads (restricted) in Launchpad

Code:
update-alternatives --config gcc
There are 3 choices for the alternative gcc (providing /usr/bin/gcc).

  Selection    Path            Priority   Status
------------------------------------------------------------
  0            /usr/bin/gcc-7   70        auto mode
  1            /usr/bin/gcc-5   50        manual mode
* 2            /usr/bin/gcc-6   60        manual mode
  3            /usr/bin/gcc-7   70        manual mode

Press <enter> to keep the current choice[*], or type selection number:
Code:
gcc --version
gcc (Ubuntu 5.4.1-8ubuntu1) 5.4.1 20170304
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Code:
gcc --version
gcc (Ubuntu 6.3.0-8ubuntu1) 6.3.0 20170221
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Code:
gcc --version
gcc (Ubuntu 7-20170303-0ubuntu2) 7.0.1 20170303 (experimental) [trunk revision 245860]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
still testing and tweaking right now so no idea if it all works together yet
 
Last edited:

Patrick

Administrator
Staff member
Dec 21, 2010
12,513
5,804
113
I tried using centminmod yesterday on CentOS 7.3 using the curl installer. It did not work :-/ Maybe I need 3 compilers!
 

eva2000

Active Member
Apr 15, 2013
244
49
28
Brisbane, Australia
centminmod.com
I tried using centminmod yesterday on CentOS 7.3 using the curl installer. It did not work :-/ Maybe I need 3 compilers!
you mean with initial install not working ? I fixed a few bugs NGINX Issue BetaInstaller-Latest so might want to try again :)

install command on fresh CentOS 7.3
Code:
yum -y update; curl -O https://centminmod.com/betainstaller.sh && chmod 0700 betainstaller.sh && bash betainstaller.sh
or you mean GCC compilers not available ?
 

eva2000

Active Member
Apr 15, 2013
244
49
28
Brisbane, Australia
centminmod.com
Hey @Patrick thought this might help you with ideas, been doing alot of GCC 7 and 8 custom builds lately and scripted it for CentOS 7/Centmin Mod at least GitHub - centminmod/centminmod-gcc: GCC 7.x & 8.x compiler & Binutils build scripts which can compile GCC from source and optionally install it or build CentOS 7 rpm or install it from the built RPM.

How to build Centmin Mod Nginx with GCC 4.8, 5.3, 6.3, 7.2, & 8 and Clang 3.4 and 4 branches Nginx - Guide To GCC & Clang Compiler Selection For Nginx Installs

On my OVH i7 4790K dedicated server takes around 6700-7300 seconds to compile + build 6x RPMs for binutils 2.29.1 + gold linker and gcc 7.2.1 and gcc 8.0 with PGO and one set without PGO (profile guided optimizations). Probably, be much faster on the cpus you have access to !

Code:
ls -lah /svr-setup | egrep 'gcc[7,8]-all|binutils-gcc' | grep rpm
-rw-r--r--   1 root  root  5.2M Jan 20 13:24 binutils-gcc7-2.29.1-1.el7.x86_64.rpm
-rw-r--r--   1 root  root  5.2M Jan 20 12:17 binutils-gcc8-2.29.1-1.el7.x86_64.rpm
-rw-r--r--   1 root  root   33M Jan 20 16:41 gcc7-7.2.1-1.el7.x86_64.rpm
-rw-r--r--   1 root  root   37M Jan 20 17:09 gcc7-pgo-7.2.1-1.el7.x86_64.rpm
-rw-r--r--   1 root  root   36M Jan 20 16:09 gcc8-8.0-1.el7.x86_64.rpm
-rw-r--r--   1 root  root   41M Jan 20 17:46 gcc8-pgo-8.0-1.el7.x86_64.rpm
still perfecting and optimising the routines for script :D
 
  • Like
Reactions: Patrick