From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zm-mta-out-3.u-ga.fr (zm-mta-out-3.u-ga.fr [152.77.200.56]) by sourceware.org (Postfix) with ESMTPS id 041A2385DC35 for ; Fri, 29 May 2020 09:28:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 041A2385DC35 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=legi.grenoble-inp.fr Authentication-Results: sourceware.org; spf=none smtp.mailfrom=Patrick.Begou@legi.grenoble-inp.fr Received: from zm-mta-out.u-ga.fr (zm-mta-out.u-ga.fr [152.77.200.53]) by zm-mta-out-3.u-ga.fr (Postfix) with ESMTP id 8108841003 for ; Fri, 29 May 2020 11:28:55 +0200 (CEST) Received: from smtps.univ-grenoble-alpes.fr (smtps3.u-ga.fr [195.83.24.62]) by zm-mta-out.u-ga.fr (Postfix) with ESMTP id 6EC6F80458 for ; Fri, 29 May 2020 11:28:55 +0200 (CEST) Received: from localhost.localdomain (82-64-214-7.subs.proxad.net [82.64.214.7]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: begoup@univ-grenoble-alpes.fr) by smtps.univ-grenoble-alpes.fr (Postfix) with ESMTPSA id 57F974005E for ; Fri, 29 May 2020 11:28:55 +0200 (CEST) Subject: Re: multiple installed versions of gcc -- automatically set rpath ?? To: gcc-help@gcc.gnu.org References: From: =?UTF-8?Q?Patrick_B=c3=a9gou?= Message-ID: <56beea81-438e-116e-44de-68984b5867b2@legi.grenoble-inp.fr> Date: Fri, 29 May 2020 11:28:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-US X-Greylist: Whitelist-UGA SMTP Authentifie (begoup@univ-grenoble-alpes.fr) via submission-587 ACL (100) X-Spam-Status: No, score=2.0 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, KAM_SHORT, RCVD_IN_BARRACUDACENTRAL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: ** X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 May 2020 09:29:00 -0000 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 > 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++? >>