From owner-freebsd-hackers Sun Jun 4 20:25:12 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.whack.org (apogee.whack.org [216.186.243.163]) by hub.freebsd.org (Postfix) with ESMTP id 2A96037B617 for ; Sun, 4 Jun 2000 20:25:08 -0700 (PDT) (envelope-from andrew@whack.org) Received: from andrew by mx1.whack.org with local (Exim 3.14 #1) id 12ynVi-0003uw-00 for freebsd-hackers@freebsd.org; Sun, 04 Jun 2000 20:25:06 -0700 Date: Sun, 4 Jun 2000 20:25:01 -0700 From: Andrew Perkins To: freebsd-hackers@freebsd.org Subject: circumventing ld default -L paths Message-ID: <20000604202451.A12837@violet.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Hello all, I would like to link some applications against some local libraries which have conflicting names with those in /usr/lib. Unfortunately, I cannot find a way to disable ld from using: -L/usr/libexec/elf -L/usr/libexec -L/usr/lib before my -L definitions at compile time. I have tried -nostdlib, which is intuitively what should work, however, as many of you probably know, only removes: /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o ...... /usr/lib/libgcc.a -lc /usr/lib/libgcc.a /usr/lib/crtend.o /usr/lib/crtn.o Additionally, I have tried the following environment vars to no avail: LD_LIBRARY_PATH, LD_PRELOAD, LD_NOSTD_PATH Note on: LD_PRELOAD This library is an archive, not a shared object, which /usr/libexec/ld-elf.so.1 obviously complains about when listed in LD_PRELOAD. And finally, NO, I do not want to move the system library in /usr/lib OR rename the library I am using (a modified form of the same lib). I cheerfully assume that this is easy and I am just missing something. ######## some sample output for clarification ######## $ gcc -v -Wall -O2 -march=pentiumpro -pipe empty.c -o empty Using builtin specs. gcc version 2.95.2 19991024 (release) /usr/libexec/cpp -lang-c -v -D__GNUC__=2 -D__GNUC_MINOR__=95 -Di386 -Dunix -D__FreeBSD__=4 -D__FreeBSD_cc_version=400004 -D__i386__ -D__unix__ -D__FreeBSD__=4 -D__FreeBSD_cc_version=400004 -D__i386 -D__unix -Acpu(i386) -Amachine(i386) -Asystem(unix) -Asystem(FreeBSD) -D__OPTIMIZE__ -Wall -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -D__ELF__ empty.c | /usr/libexec/cc1 -quiet -dumpbase empty.c -march=pentiumpro -O2 -Wall -version -o - | /usr/libexec/elf/as -v -o /home/andrew/tmp/ccr65832.o - GNU C version 2.95.2 19991024 (release) (i386-unknown-freebsd) compiled by GNU C version 2.95.2 19991024 (release). GNU assembler version 2.9.1 (i386-unknown-freebsdelf), using BFD version 2.9.1 GNU CPP version 2.95.2 19991024 (release) (i386 FreeBSD/ELF) #include "..." search starts here: #include <...> search starts here: /usr/include /usr/include End of search list. The following default directories have been omitted from the search path: /usr/include/g++ End of omitted list. /usr/libexec/elf/ld -m elf_i386 -dynamic-linker /usr/libexec/ld-elf.so.1 -o empty /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/libexec/elf -L/usr/libexec -L/usr/lib /home/andrew/tmp/ccr65832.o /usr/lib/libgcc.a -lc /usr/lib/libgcc.a /usr/lib/crtend.o /usr/lib/crtn.o Cordially, _____________________________________________ Andrew Perkins andrew@violet.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message