2

I've been asked to recreate a build of GCC 4.5.1 on both Red Hat 6 and Solaris 10. There are existing Red Hat 6 machines with 4.5.1 installed. The last Solaris 10 machine recently ate itself; hence, my inherited joy.

No one around knows what dependencies GCC was built with. We can easily get the configure options with gcc -v, but which versions of GMP, MPC, and MPFR were used is a mystery. I've tried:

  • ldd
  • strings
  • gcc -dM -E
  • find $GCC_DIR -name *gmp*
  • find $GCC_DIR -name *.h | xargs grep -i gmp $1

Thanks in advance for your assistance.

Mike H
  • 31
  • 5

2 Answers2

2

It is not officially recommended to try to download/compile gmp, mpfr and mpc from source. You should attempt to download it from your package manager first:

yum install gmp-devel mpfr-devel libmpc-devel

Failing that, the doc/install.texi that comes with GCC 4.5.0 recommends versions GMP 4.3.2 or later, MPFR 2.4.2 or later and MPC 0.8.1 or later.

GCC also supports doing source tree compilation with the dependencies. Newer versions of GCC has contrib/download_prerequisites, which doesn't exist in older versions. However, the earliest incarnation of the script simply downloads the tarballs and untars it in the GCC source directory (with stripped components). GCC detects it and will build it automatically.

The configure flags --with-mpfr, et al. are only if you already have the dependencies built elsewhere. This is the most painful option and should be done as a last resort.

  • I appreciate the response, sadly that's doesn't helpf in determine what was. Also to clarify what is "**not recommended**, is to download the sources [...] and install each of them in non-standard locations, then configure GCC with --with-gmp=/some/silly/path/gmp [...]". Had that been the case the configure options would shed some light on what was used. We have requirements outside the scope of the question to maintain configuration management (which weren't met in this case) and to use software versions that meet various requirements. – Mike H Mar 10 '19 at 15:57
1

Compile a source file with gcc -S -fverbose-asm. The versions of GMP and MFPR will be written as comments to the resulting .s assembly listing file:

# GNU C11 (Ubuntu 7.3.0-27ubuntu1~18.04) version 7.3.0 (x86_64-linux-gnu)
#       compiled by GNU C version 7.3.0, GMP version 6.1.2, MPFR version 4.0.1, MPC version 1.1.0, isl version isl-0.19-GMP

On my system,. those version strings also appear in the output of

strings /usr/lib/gcc/x86_64-linux-gnu/7/cc1

However, I have access to a gcc 4.1.2 compiler, and it doesn't include this information:

# GNU C version 4.1.2 20080704 (Red Hat 4.1.2-55) (x86_64-redhat-linux)
#       compiled by GNU C version 4.1.2 20080704 (Red Hat 4.1.2-55).
Keith Thompson
  • 254,901
  • 44
  • 429
  • 631