From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11667 invoked by alias); 20 Dec 2012 02:26:43 -0000 Received: (qmail 11649 invoked by uid 22791); 20 Dec 2012 02:26:41 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_VIA_APNIC,TW_NB X-Spam-Check-By: sourceware.org Received: from comm.purplecow.org (HELO comm.purplecow.org) (210.87.62.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 20 Dec 2012 02:26:06 +0000 MIME-version: 1.0 Content-transfer-encoding: 7BIT Content-disposition: inline Content-type: text/plain; charset=us-ascii Received: from comm.purplecow.org ([127.0.0.1]) by comm.purplecow.org (Sun Java(tm) System Messaging Server 6.3-6.03 (built Mar 14 2008; 32bit)) with ESMTP id <0MFB00J945FG7R20@comm.purplecow.org> for gcc-help@gcc.gnu.org; Thu, 20 Dec 2012 13:26:04 +1100 (EST) Received: from comm.purplecow.org ([127.0.0.1] helo=comm.purplecow.org) with IPv4:25 by ASSP.nospam; Thu, 20 Dec 2012 13:26:04 +1100 Received: from [66.103.52.207] by comm.purplecow.org (mshttpd); Wed, 19 Dec 2012 21:26:04 -0500 From: Dennis Clarke To: Jonathan Wakely Cc: Jim Rice , gcc-help@gcc.gnu.org Message-id: Date: Thu, 20 Dec 2012 02:26:00 -0000 Subject: Re: A question about RPATH In-reply-to: References: <1355959256.52229.YahooMailClassic@web160504.mail.bf1.yahoo.com> X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-12/txt/msg00105.txt.bz2 > On 20 December 2012 00:15, Dennis Clarke wrote: > > > >> > I am a firm believer that LD_LIBRARY_PATH is evil, certainly > >> > at least dangerous and the > >> > output binary from any compile should have an RPATH set to > >> > ensure that the correct > >> > libs are found that the developer wanted. > >> > > >> > Having said all that, is there a magic > >> > LD_OPTIONS_INCANTATION=-Wl,-rpath=/usr/local/lib type thing > >> > to set to ensure I get my RPATH ? I should point out > >> > this is trivial to do in the Solaris world and perhaps I am > >> > missing something really obvious here. > > GCC does not tell the linker to set RPATH unless explicitly requested, > see http://gcc.gnu.org/faq.html#rpath Well thanbks to the suggestion to use gmake with the -j X for some X>1 as well as the env var LD_RUN_PATH I get a gcc 4.7.2 bootstrapped much faster and with the correct RPATH in it thus : sedna $ greadelf -hd ./gcc/xgcc ELF Header: Magic: 7f 45 4c 46 02 01 01 00 00 00 00 00 00 00 00 00 Class: ELF64 Data: 2's complement, little endian Version: 1 (current) OS/ABI: UNIX - System V ABI Version: 0 Type: EXEC (Executable file) Machine: Advanced Micro Devices X86-64 Version: 0x1 Entry point address: 0x405aa8 Start of program headers: 64 (bytes into file) Start of section headers: 2349040 (bytes into file) Flags: 0x0 Size of this header: 64 (bytes) Size of program headers: 56 (bytes) Number of program headers: 8 Size of section headers: 64 (bytes) Number of section headers: 37 Section header string table index: 34 Dynamic section at offset 0x8b388 contains 24 entries: Tag Type Name/Value 0x0000000000000001 (NEEDED) Shared library: [libintl.so.8] 0x0000000000000001 (NEEDED) Shared library: [libiconv.so.2] 0x0000000000000001 (NEEDED) Shared library: [libm.so.6] 0x0000000000000001 (NEEDED) Shared library: [libc.so.6] 0x000000000000000f (RPATH) Library rpath: [/usr/local/lib:/usr/local/gcc4/lib64] 0x000000000000000c (INIT) 0x402360 0x000000000000000d (FINI) 0x43e988 0x0000000000000004 (HASH) 0x400240 0x0000000000000005 (STRTAB) 0x401208 0x0000000000000006 (SYMTAB) 0x4005d8 0x000000000000000a (STRSZ) 1211 (bytes) 0x000000000000000b (SYMENT) 24 (bytes) 0x0000000000000015 (DEBUG) 0x0 0x0000000000000003 (PLTGOT) 0x68b568 0x0000000000000002 (PLTRELSZ) 2784 (bytes) 0x0000000000000014 (PLTREL) RELA 0x0000000000000017 (JMPREL) 0x401880 0x0000000000000007 (RELA) 0x401808 0x0000000000000008 (RELASZ) 120 (bytes) 0x0000000000000009 (RELAENT) 24 (bytes) 0x000000006ffffffe (VERNEED) 0x4017c8 0x000000006fffffff (VERNEEDNUM) 1 0x000000006ffffff0 (VERSYM) 0x4016c4 0x0000000000000000 (NULL) 0x0 sedna $ That looks perfect and thus LD_LIBRARY_PATH is not required for this binary to indicate to the runtime linker where the correct libs are. sedna $ ldd ./gcc/xgcc linux-vdso.so.1 => (0x00007fff61dff000) libintl.so.8 => /usr/local/lib/libintl.so.8 (0x00007f9387432000) libiconv.so.2 => /usr/local/lib/libiconv.so.2 (0x00007f9387142000) libm.so.6 => /lib64/libm.so.6 (0x00000039fa400000) libc.so.6 => /lib64/libc.so.6 (0x00000039fa000000) /lib64/ld-linux-x86-64.so.2 (0x00000039f9c00000) Thanks to the usage of gmake -j 16 ( yes 16 cores ) I was able to get a result in about 73 minutes : real 4398.04 user 10247.06 sys 1378.21 I will run the testsuite now and hope for a better result than before however I have no quantifiable reason to hope for such a thing. :-) Dennis