From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.efficios.com (mail.efficios.com [167.114.26.124]) by sourceware.org (Postfix) with ESMTPS id C18FE385DC1F for ; Tue, 29 Mar 2022 20:04:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C18FE385DC1F Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 0D651403C67; Tue, 29 Mar 2022 16:04:56 -0400 (EDT) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id XbAhAW_7oSO7; Tue, 29 Mar 2022 16:04:52 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 374F8403C66; Tue, 29 Mar 2022 16:04:52 -0400 (EDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 374F8403C66 X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id d6Ht2FVnub-C; Tue, 29 Mar 2022 16:04:52 -0400 (EDT) Received: from [10.0.0.11] (192-222-157-6.qc.cable.ebox.net [192.222.157.6]) by mail.efficios.com (Postfix) with ESMTPSA id 1286E40410A; Tue, 29 Mar 2022 16:04:52 -0400 (EDT) Message-ID: <66b85398-d9ab-3ba5-a7bf-353d39fa9cc9@efficios.com> Date: Tue, 29 Mar 2022 16:04:51 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.1 Subject: Re: [PATCH] Pass PKG_CONFIG_PATH down from top-level Makefile Content-Language: en-US To: Simon Marchi , binutils@sourceware.org, gdb-patches@sourceware.org, gcc-patches@gcc.gnu.org References: <20220315212635.3732428-1-simon.marchi@polymtl.ca> From: Simon Marchi In-Reply-To: <20220315212635.3732428-1-simon.marchi@polymtl.ca> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3039.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Mar 2022 20:05:01 -0000 Ping! On 2022-03-15 17:26, Simon Marchi wrote: > From: Simon Marchi > > [Sending to binutils, gdb-patches and gcc-patches, since it touches the > top-level Makefile/configure] > > I have my debuginfod library installed in a non-standard location > (/opt/debuginfod), which requires me to set > PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config. If I just set it during > configure: > > $ PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config ./configure --with-debuginfod > $ make > > or > > $ ./configure --with-debuginfod PKG_CONFIG_PATH=/opt/debuginfod/lib/pkg-config > $ make > > Then PKG_CONFIG_PATH is only present (and ignored) during the top-level > configure. When running make (which runs gdb's and binutils' > configure), PKG_CONFIG_PATH is not set, which results in their configure > script not finding the library: > > checking for libdebuginfod >= 0.179... no > configure: error: "--with-debuginfod was given, but libdebuginfod is missing or unusable." > > Change the top-level configure/Makefile system to capture the value > passed when configuring the top-level and pass it down to > subdirectories (similar to CFLAGS, LDFLAGS, etc). > > I don't know much about the top-level build system, so I really don't > know if I did this correctly. The changes are: > > - Use AC_SUBST(PKG_CONFIG_PATH) in configure.ac, so that > @PKG_CONFIG_PATH@ gets replaced with the actual PKG_CONFIG_PATH value > in config files (i.e. Makefile) > - Add a PKG_CONFIG_PATH Makefile variable in Makefile.tpl, initialized > to @PKG_CONFIG_PATH@ > - Add PKG_CONFIG_PATH to HOST_EXPORTS in Makefile.tpl, which are the > variables set when running the sub-configures > > I initially added PKG_CONFIG_PATH to flags_to_pass, in Makefile.def, but > I don't think it's needed. AFAIU, this defines the flags to pass down > when calling "make" in subdirectories. We only need PKG_CONFIG_PATH to > be passed down during configure. After that, it's captured in > gdb/config.status, so even if a "make" causes a re-configure later > (because gdb/configure has changed, for example), the PKG_CONFIG_PATH > value will be remembered. > > ChangeLog: > > * configure.ac: Add AC_SUBST(PKG_CONFIG_PATH). > * configure: Re-generate. > * Makefile.tpl (HOST_EXPORTS): Pass PKG_CONFIG_PATH. > (PKG_CONFIG_PATH): New. > * Makefile.in: Re-generate. > > Change-Id: I91138dfca41c43b05e53e445f62e4b27882536bf > --- > Makefile.in | 3 +++ > Makefile.tpl | 3 +++ > configure | 2 ++ > configure.ac | 1 + > 4 files changed, 9 insertions(+) > > diff --git a/Makefile.in b/Makefile.in > index 3aacd2daac9c..cb39e4790d69 100644 > --- a/Makefile.in > +++ b/Makefile.in > @@ -218,6 +218,7 @@ HOST_EXPORTS = \ > OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ > OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ > OTOOL="$(OTOOL)"; export OTOOL; \ > + PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \ > READELF="$(READELF)"; export READELF; \ > AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \ > AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \ > @@ -444,6 +445,8 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates > GOCFLAGS = $(CFLAGS) > GDCFLAGS = $(CFLAGS) > > +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ > + > # Pass additional PGO and LTO compiler options to the PGO build. > BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS) > override CFLAGS += $(BUILD_CFLAGS) > diff --git a/Makefile.tpl b/Makefile.tpl > index 9df77788345a..88db8f44d53f 100644 > --- a/Makefile.tpl > +++ b/Makefile.tpl > @@ -221,6 +221,7 @@ HOST_EXPORTS = \ > OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \ > OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \ > OTOOL="$(OTOOL)"; export OTOOL; \ > + PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \ > READELF="$(READELF)"; export READELF; \ > AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \ > AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \ > @@ -447,6 +448,8 @@ LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates > GOCFLAGS = $(CFLAGS) > GDCFLAGS = $(CFLAGS) > > +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ > + > # Pass additional PGO and LTO compiler options to the PGO build. > BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS) > override CFLAGS += $(BUILD_CFLAGS) > diff --git a/configure b/configure > index 26935ebda249..1badcb314f8f 100755 > --- a/configure > +++ b/configure > @@ -618,6 +618,7 @@ CXX_FOR_TARGET > CC_FOR_TARGET > RANLIB_PLUGIN_OPTION > AR_PLUGIN_OPTION > +PKG_CONFIG_PATH > READELF > OBJDUMP > OBJCOPY > @@ -10310,6 +10311,7 @@ fi > > > > + > { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -plugin option" >&5 > $as_echo_n "checking for -plugin option... " >&6; } > > diff --git a/configure.ac b/configure.ac > index da4e41d72479..5b6e20485143 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -3465,6 +3465,7 @@ AC_SUBST(CC) > AC_SUBST(CXX) > AC_SUBST(CFLAGS) > AC_SUBST(CXXFLAGS) > +AC_SUBST(PKG_CONFIG_PATH) > > GCC_PLUGIN_OPTION(PLUGIN_OPTION) > AR_PLUGIN_OPTION= > > base-commit: 6aa03e9c1769c8d925f4d23d72af93483bfd31f3