You are not logged in.
Pages: 1
Is there a possibility to install multiple versions of the gcc toolchain, and "enable" them via a script, much like the gcc-config script of Gentoo Linux?
I am of course aware that one could manually install different versions of gcc under a separate directory (say, /opt) and export the various variables CXX, etc... But I am looking for an easier solution, like the gcc-config that simply "enables" a given compiler version.
Offline
gcc10 is in the repos, older versions in the AUR.
You should™ be able to install them all in parallel.
Then you configure or export the desired binary to the build system (eg $CC and $CXX should™ do)
https://www.gnu.org/software/make/manua … ables.html
That approach also doesn't root permissions to juggle around files on your disk.
Edit: I assume this is an xy-problem, what's the cause of your inquiry?
Last edited by seth (2021-06-07 06:54:38)
Offline
Thanks.
Regarding exporting variables: as I mentioned in the post, I am aware that one can export CC, CXX etc to point to the desired compiler version. This can require some effort, especially in conjunction with other programs of the toolchain; e.g., when compiling a library with -flto, ar may need full path of the lto plugin-in. Or when using an MPI wrapper, etc.
It would be much easier to have a script that takes care of the whole job, such that one could simply "switch" to the desired version, then invoke gcc without additional requirements.
Offline
"AR=/usr/bin/gcc-ar-10" ?
I've not tested, but would expect eg. openmpi to respect those variables?
If you do this a lot, it of course makes sense to use a script or shell include that exports those variables.
Offline
"AR=/usr/bin/gcc-ar-10" ?
Ops, you are right. I was not exporting AR, and so using a version of ar not matching that of gcc; hence the need for an additional --plugin option.
I've not tested, but would expect eg. openmpi to respect those variables?
Not really. At least with openMPI, you need to additionally export OMPI_MPICC and OMPI_MPICXX for instance.
If you do this a lot, it of course makes sense to use a script or shell include that exports those variables.
I was sort-of hoping that somebody had already programmed that...
Offline
Pages: 1