Hello All: I’m not exactly sure this is the correct forum… I have to build some supporting code (netcdf, openmpi, others) using gcc/gfortran, before I build my model under gcc/gfortran. These use configure/make/makeinstall setups which are pretty much automatic. The configure scripts are quite good at detecting the default gcc/g++/gfortran needed as long as only one version is installed
Here’s the rub - I see that gcc7, gcc8, and gcc9 are all listed in the LEAP 15.2 repos. I’d like to try these later versions - but I’m not sure how to replace my system gcc/gfortran with these versions. I don’t want more than one version on my system at one time so that the config scripts find them and don’t mix versions. Is there a DIY on how to do this without breaking something in LEAP 15.2? I think I’ve done that before (it broke KDE or something) when I removed some one of the default gcc7 libraries… There’s just so many versions in the default repos that my brain literally freezes.
Also, does gcc automagically build with openib/infiniband (to bypass the IP stack in openmpi) when the hardware is present and the various IB packages installed from the repo?
Hi
Easy way, just export the compiler eg export CC=/usr/bin/gcc-9, export CC=/usr/bin/gcc-7, export CXX=/usr/bin/g+±7 then run configure. Else you would need to setup update-alternatives which changes the default for use system wide all the time.
Hi Malcom - Yes, I’ve done this before on occasion - different packages (pnetcdf, netcdf, openmpi, etc.) have different criteria this way, but they always seem to find the “default” gcc/g++/gfortran.
Hmmm… it sounds like there’s really no other way to do it, though. Thanks.
Do you know if I can mix and match gcc-suites? Can I use the default gcc7-suite (withough gcc7-fortran) and install gcc8-fortran and have it play nicely (with gcc7)? Then I’d only have to worry about one piece of the puzzle… :shame:
You can set the gcc used in your compiler manifest file…
But if you want to configure your** system default** for a particular gcc,
Then you need to configure symlinks pointing your default gcc to a particular gcc binary.
And then you may want an easy way to switch between symlinks to particular binaries which is what the Alternatives system does.
If you want to also automatically switch associated other binaries at the same time, then you configure slave links, although is described in the MAN pages, there are also numerous tutorials that describe the syntax. As long as you keep the concept of layered links in mind, I don’t think it should be too difficult
Hi Malcom - I’ve done that before when needed, so I tried this with other versions of gcc I installed from the default repos, and it turns out those calls reference the compiler (only) itself; whereas, building things usually needs to know the location of the /lib, /lib64, /include, etc. subdirectories. The trouble I think I was running into was that during the build process, it found those support directories for the default gcc (gcc-7, etc.) install, but was trying to use the gfortran-8 or gfortran-9, etc., compilers. I checked /usr/bin/gcc-8 (etc.) to see if they were links to directory trees of the form:
*/package/include
*/package/lib64
*/package/bin
…which seems to be how, for packages like netcdf, openmpi, etc., ./configure susses out what/where things are located when building - that seems to be what everything I’ve built seems to do. Anyway, it gets really confusing to trouble-shoot my mistakes (since I don’t know make syntax).
(I hope all that makes sense.)
So then I tried (again) looking at using the default OpenMPI, NETCDF packages in the OS repos, but there are at least three versions, and some sub-versions, so I just get confused and seem to get the wrong things/versions installed. (Sadly, my brain just seems to be too small for that.) You even have to install two netcdf’s in order to get fortran links - this makes the make declarations guesswork on my part…