From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/11076 Path: news.gmane.org!.POSTED!not-for-mail From: Mathias Krause Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] musl-gcc.spec: honour $LIBRARY_PATH / $LPATH Date: Wed, 22 Feb 2017 22:54:24 +0100 Message-ID: <20170222215424.GA1153@jig.fritz.box> References: <1487797025-32177-1-git-send-email-minipli@googlemail.com> <20170222211158.GU1520@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1487800491 32671 195.159.176.226 (22 Feb 2017 21:54:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 22 Feb 2017 21:54:51 +0000 (UTC) User-Agent: Mutt/1.5.21 (2010-09-15) To: musl@lists.openwall.com Original-X-From: musl-return-11091-gllmg-musl=m.gmane.org@lists.openwall.com Wed Feb 22 22:54:47 2017 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by blaine.gmane.org with smtp (Exim 4.84_2) (envelope-from ) id 1cgerw-0007j0-MN for gllmg-musl@m.gmane.org; Wed, 22 Feb 2017 22:54:40 +0100 Original-Received: (qmail 26501 invoked by uid 550); 22 Feb 2017 21:54:44 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 26481 invoked from network); 22 Feb 2017 21:54:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=date:from:to:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=vRhtGKNxQJho/37ipI+k7O18X0X5kk1iGWeRanr+KVU=; b=CJ76mV23P6nMfm4PcxbMs3G4cAH4PQDVT/50ngYThdW0wgBj4tbUo3UTQ7NAzvRGFA zwHdNvVqR7ZQgtOLibB19A2DY9+N2i7Zyq60xTz32h/ixYovhwo/P7o2l/GJ1dS7piuV pep8Y+cl5x8QNmHKr2oA7uM8KEU4Z0IdEIPB8A7eUadsgZbzBdKnshPOc0QL0u/jDBKk M89urBpIZ+YnW9csIZdGUqfdFoRQI0aGkMudCctcL4Cbbf8bUAMw6ri6a/mI6t1da6lB GRKdArkc2q1NHBI2g/gEoytOGoSJzrRxgvYsU9i0r0XP2cRah3dNiMkxVIhMLtGsVnYg q2hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=vRhtGKNxQJho/37ipI+k7O18X0X5kk1iGWeRanr+KVU=; b=h09byD9LN1hSKRnyoMtdrRaeaL6SO3UB9Snj+bmD4fQpRhJYtzUUtB0npo0uEE+46j RC6VOgSdhJe2uw1wudhd2D9BFGCR+9ukIb3MtOJSdvYPQh5sbpvSEmgBBxHT83ix9g4M MPod4hOdKgC1hOzC91nIdq+jzHgmXccn78apnRNA5oN92lJmlMcXoJ11QWwRCyjICV4Z H4ZUMHY7AOjM+Jhzm6rak4H3MJnwPy6o/aKJoVPYIbkPtdVRoa2QdM0FXRhwKoVysFEt 1XFsVq/pRGFAIR4GrU6VaJjBEpLx33QSRs9tnZCVNQCmqqbApbvoL5kkufJez4YbVGsV 2L4Q== X-Gm-Message-State: AMke39lznIGgKx2e9khdiPwLNZBqTvYWswaZ2YKzuEr3F82lmhIsfIVIPk7SdE1HV/nogw== X-Received: by 10.28.129.147 with SMTP id c141mr550687wmd.12.1487800472526; Wed, 22 Feb 2017 13:54:32 -0800 (PST) Content-Disposition: inline In-Reply-To: <20170222211158.GU1520@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:11076 Archived-At: On Wed, Feb 22, 2017 at 04:11:58PM -0500, Rich Felker wrote: > On Wed, Feb 22, 2017 at 09:57:05PM +0100, Mathias Krause wrote: > > To support additional library search paths via $LIBRARY_PATH / $LPATH > > extend the link_libgcc variable instead of replacing it. The original > > one will contain the required "%D" to support this. > > > > musl's library path is still the first in the list, so its object files > > will be found before other paths are taken into account. > > > > Signed-off-by: Mathias Krause > > --- > > tools/musl-gcc.specs.sh | 4 +++- > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > diff --git a/tools/musl-gcc.specs.sh b/tools/musl-gcc.specs.sh > > index 294e24f75503..819799a6d5a7 100644 > > --- a/tools/musl-gcc.specs.sh > > +++ b/tools/musl-gcc.specs.sh > > @@ -10,8 +10,10 @@ cat < > *cc1: > > %(cc1_cpu) -nostdinc -isystem $incdir -isystem include%s > > > > +%rename link_libgcc old_link_libgcc > > + > > *link_libgcc: > > --L$libdir -L .%s > > +-L$libdir %(old_link_libgcc) > > I'm pretty sure this is wrong. What are you trying to achieve? I'm trying to make musl-gcc not break gcc's ability to search for additional library paths via the LIBRARY_PATH environment variable. Let me past the relevant section of gcc's manpage: LIBRARY_PATH The value of LIBRARY_PATH is a colon-separated list of directories, much like PATH. When configured as a native compiler, GCC tries the directories thus specified when searching for special linker files, if it can't find them using GCC_EXEC_PREFIX. Linking using GCC also uses these directories when searching for ordinary libraries for the -l option (but directories specified with -L come first). I'm trying to make use of the "…when searching for ordinary libraries for the -l option" part. > The whole point of musl-gcc is to _remove_ any existing library paths > since, if present, they will cause configure scripts to detect and > link to incompatible libraries (linked against glibc). Can you elaborate on this? How would including $LIBRARY_PATH provided paths break configure scripts? In fact, the way the specs file is now breaks my use case but I don't want to break yours. :/ > The only library path we want to preserve is the one to libgcc. Well, the current spec file doesn't achieve this when LIBRARY_PATH is set in the environment: $ LIBRARY_PATH=/tmp /tmp/musl/bin/musl-gcc -x c -o /dev/null - <<<'int main(void) { }' -lgcc /usr/bin/ld: cannot find -lgcc collect2: error: ld returned 1 exit status $ While with my patch applied it does: $ LIBRARY_PATH=/tmp /tmp/musl/bin/musl-gcc -x c -o /dev/null - <<<'int main(void) { }' -lgcc $ Cheers, Mathias