multiple installed versions of gcc -- automatically set rpath ??

Patrick Bégou Patrick.Begou@legi.grenoble-inp.fr
Fri May 29 09:28:54 GMT 2020


May be you can rely on the tool module-environment with linux. It allow
you to set environments to use different versions of a same application.
It is used on the french HPC centers and I use it to manage several
paraview version and... several gcc/gfortran versions (4, 7, 9) on my
servers and on the cluster. It is available in all linux distribution.

Just load your tailored module (setting PATH, LD_LIBRARY_PATH....) to
activate the gcc version needed and compile/execute

On redhat 7 based OS look at environment-modules-3.2.10-10.el7.x86_64

Patrick

Le 29/05/2020 à 05:07, Dan Kegel a écrit :
> https://stackoverflow.com/questions/13334300/how-to-build-and-install-gcc-with-built-in-rpath
> is a bit dated, but might be helpful.  It says in part:
>> Using --with-boot-ldflags="-Wl,-rpath,/some/path" on the configure
> step seems to work for me on gcc 4.8.3. The docs discuss this a bit
> https://gcc.gnu.org/install/configure.html
>
>
> - Dan
>
> On Thu, May 28, 2020 at 7:55 PM Patrick Herbst via Gcc-help
> <gcc-help@gcc.gnu.org> wrote:
>> I have the base gcc that came with my distro and i'd like to have the
>> option of using a newer version without replacing the older one.
>>
>> I'd like to install the newer version in a different path, like /opt.
>>
>> I run into a problem though when compiling with the newer version in
>> /opt, it links against the libstdc++ in /opt, but at runtime the
>> executable tries to link with the systems version in /usr/lib.
>>
>> Is there a way to have the gcc in /opt automatically set the rpath
>> when linking so that executables can run against the /opt libstdc++?
>>



More information about the Gcc-help mailing list