From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10066 invoked by alias); 20 Jan 2005 02:35:46 -0000 Mailing-List: contact binutils-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sources.redhat.com Received: (qmail 9060 invoked from network); 20 Jan 2005 02:34:49 -0000 Received: from unknown (205.217.158.180) by sourceware.org with QMTP; 20 Jan 2005 02:34:49 -0000 Received: (qmail 6097 invoked by uid 10); 20 Jan 2005 02:34:49 -0000 Received: (qmail 23200 invoked by uid 500); 20 Jan 2005 02:34:40 -0000 Mail-Followup-To: binutils@sources.redhat.com, fool@cs.utexas.edu To: Chris McCraw Cc: binutils@sources.redhat.com Subject: Re: ld's RPATH versus gcc's References: <20050120000928.GP22279@fidleyhutch.cs.utexas.edu> From: Ian Lance Taylor Date: Thu, 20 Jan 2005 02:35:00 -0000 In-Reply-To: <20050120000928.GP22279@fidleyhutch.cs.utexas.edu> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2005-01/txt/msg00277.txt.bz2 Chris McCraw writes: > i do my linking with gcc (well, technically, libtool does it for me, but > still uses gcc, and still with "-specs /u/fool/specs"), and out pops a > binary. unfortunately that binary has an RPATH (examined with solaris' > "ldd -s" and confirmed with a binary editor) that contains all the > directories in gcc's specs file, despite my specs file specifying not to > use them. > > so my question is, how can i prevent this from happening? editing the specs > file or building a private install of gcc that never included those dirs > in its specs file is an obvious answer but not terribly useful in my > environment--i rely on a compiler used by others which requires those > RPATH additions for normal operation, and my build is taking weeks (all > of KDE) during which it will be in use by said others. I don't know what is happening, but I do know that the linker's handling of RPATH is quite simple. The RPATH in the executable will be to the directories specified using the -R or --rpath option. If no -R or --rpath is used, then the RPATH will be set to the value of the environment variable LD_RUN_PATH. If that is not, then the RPATH will not be set. So you should check the LD_RUN_PATH environment variable, and you should check precisely how gcc is invoking the linker. To see the latter, pass -v on the link line, e.g., by putting it in LDFLAGS. Ian