From: "H.J. Lu" <hjl.tools@gmail.com>
To: Aaron Merey <amerey@redhat.com>
Cc: Tom Tromey <tom@tromey.com>, Simon Marchi <simark@simark.ca>,
GCC Patches <gcc-patches@gcc.gnu.org>,
Aaron Merey via Binutils <binutils@sourceware.org>,
GDB <gdb-patches@sourceware.org>
Subject: V2 [PATCH] PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS works
Date: Mon, 27 Jul 2020 12:32:04 -0700 [thread overview]
Message-ID: <CAMe9rOrJvowubNX6Yq627zmWt6hfx1LpEAuB97_RsfC59omYjQ@mail.gmail.com> (raw)
In-Reply-To: <CAMe9rOrD_c2wJOXR9RPREVZ+1Oe9=4u4XXWC5GjuGg5oVpmfNA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1712 bytes --]
On Mon, Jul 27, 2020 at 12:14 PM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> On Mon, Jul 27, 2020 at 9:11 AM Aaron Merey <amerey@redhat.com> wrote:
> >
> > On Mon, Jul 27, 2020 at 11:32 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > >
> > > On Sat, Jul 25, 2020 at 9:01 AM H.J. Lu <hjl.tools@gmail.com> wrote:
> > > > This caused:
> > > >
> > > > https://sourceware.org/bugzilla/show_bug.cgi?id=26301
> > > >
> > >
> > > It is quite normal to have debuginfod headers without libdebuginfod on
> > > multilib OSes. Restore AC_CHECK_LIB to check if libdebuginfod exists.
> > > And always define HAVE_LIBDEBUGINFOD to 0 or 1 for
> > >
> > > binutils/dwarf.c:#if HAVE_LIBDEBUGINFOD
> > > binutils/dwarf.c:#if HAVE_LIBDEBUGINFOD
> > > binutils/dwarf.c:#if HAVE_LIBDEBUGINFOD
> > > binutils/dwarf.h:#if HAVE_LIBDEBUGINFOD
> > > binutils/objdump.c:#if HAVE_LIBDEBUGINFOD
> > > binutils/objdump.c:#endif /* HAVE_LIBDEBUGINFOD */
> > > binutils/readelf.c:#if HAVE_LIBDEBUGINFOD
> > > binutils/readelf.c:#endif /* HAVE_LIBDEBUGINFOD */
> > > gdb/top.c:#if HAVE_LIBDEBUGINFOD
> > >
> > > OK for master?
> >
> > Thanks for spotting this. Normally PKG_CHECH_MODULES would correctly
> > detect whether the .so and header are installed and build accordingly,
> > but when cross compiling the AC_CHECK_LIB may be needed.
>
> I am not cross compiling. I am simply using "gcc -m32". The problem
> is PKG_CHECK_MODULES which doesn't check if $pkg_cv_[]$1[]_LIBS
> actually works. Here is the updated patch to fix PKG_CHECK_MODULES.
> Any comments or objections?
>
>
HAVE_LIBDEBUGINFOD is a separate issue. Here is the updated patch
which only adds AC_TRY_LINK to PKG_CHECK_MODULES to check if
$pkg_cv_[]$1[]_LIBS works.
--
H.J.
[-- Attachment #2: 0001-PKG_CHECK_MODULES-Check-if-pkg_cv_-1-_LIBS-works.patch --]
[-- Type: text/x-patch, Size: 2673 bytes --]
From 44682ce298a8ce2b795303d4054ec532847bfcae Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Mon, 27 Jul 2020 08:24:15 -0700
Subject: [PATCH] PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS works
It is quite normal to have headers without library on multilib OSes.
Add AC_TRY_LINK to PKG_CHECK_MODULES to check if $pkg_cv_[]$1[]_LIBS
works.
config/
PR binutils/26301
* pkg.m4 (PKG_CHECK_MODULES): Add AC_TRY_LINK to check if
$pkg_cv_[]$1[]_LIBS works.
binutils/
PR binutils/26301
* configure: Regenerated.
gdb/
PR binutils/26301
* configure: Regenerated.
---
binutils/configure | 22 ++++++++++++++++++++++
config/pkg.m4 | 6 ++++++
gdb/configure | 22 ++++++++++++++++++++++
3 files changed, 50 insertions(+)
diff --git a/binutils/configure b/binutils/configure
index c9fc5108e0..4620a6b105 100755
--- a/binutils/configure
+++ b/binutils/configure
@@ -12439,6 +12439,28 @@ fi
pkg_failed=untried
fi
+pkg_save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ pkg_failed=no
+else
+ pkg_failed=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LDFLAGS=$pkg_save_LDFLAGS
+
if test $pkg_failed = yes; then
diff --git a/config/pkg.m4 b/config/pkg.m4
index 13a8890178..45587e97c8 100644
--- a/config/pkg.m4
+++ b/config/pkg.m4
@@ -147,6 +147,12 @@ AC_MSG_CHECKING([for $2])
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
+dnl Check whether $pkg_cv_[]$1[]_LIBS works.
+pkg_save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $pkg_cv_[]$1[]_LIBS"
+AC_TRY_LINK([],[return 0;], [pkg_failed=no], [pkg_failed=yes])
+LDFLAGS=$pkg_save_LDFLAGS
+
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
diff --git a/gdb/configure b/gdb/configure
index adcfa49c63..eb38aaacfc 100755
--- a/gdb/configure
+++ b/gdb/configure
@@ -7037,6 +7037,28 @@ fi
pkg_failed=untried
fi
+pkg_save_LDFLAGS="$LDFLAGS"
+LDFLAGS="$LDFLAGS $pkg_cv_DEBUGINFOD_LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ pkg_failed=no
+else
+ pkg_failed=yes
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LDFLAGS=$pkg_save_LDFLAGS
+
if test $pkg_failed = yes; then
--
2.26.2
next prev parent reply other threads:[~2020-07-27 19:32 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20200502022903.175852-1-amerey@redhat.com>
[not found] ` <3d9da16939fa6b503188033b56d30531e03d5d2a.camel@redhat.com>
2020-05-05 21:23 ` [PATCH] config/debuginfod.m4: Use PKG_CHECK_MODULES Aaron Merey
2020-05-08 20:56 ` Tom Tromey
2020-07-16 22:17 ` Aaron Merey
2020-07-16 22:37 ` Aaron Merey
2020-07-19 15:43 ` Simon Marchi
2020-07-21 15:20 ` Tom Tromey
2020-07-21 18:11 ` Aaron Merey
2020-07-24 20:03 ` Aaron Merey
2020-07-25 16:01 ` H.J. Lu
2020-07-27 15:31 ` [PATCH] config/debuginfod.m4: Restore AC_CHECK_LIB check H.J. Lu
2020-07-27 16:11 ` Aaron Merey
2020-07-27 19:14 ` [PATCH] PKG_CHECK_MODULES: Check if $pkg_cv_[]$1[]_LIBS works H.J. Lu
2020-07-27 19:32 ` H.J. Lu [this message]
2020-07-28 10:45 ` V2 " H.J. Lu
2020-07-28 12:46 ` Simon Marchi
2020-07-28 13:33 ` H.J. Lu
2020-07-28 13:51 ` Andreas Schwab
2020-07-28 13:56 ` H.J. Lu
2020-07-28 14:01 ` Simon Marchi
2020-07-28 14:11 ` H.J. Lu
2020-07-28 14:34 ` Simon Marchi
2020-07-28 15:05 ` H.J. Lu
2020-07-28 15:13 ` Simon Marchi
2020-07-28 16:07 ` H.J. Lu
2020-07-28 16:28 ` Simon Marchi
2020-07-28 17:26 ` H.J. Lu
2020-07-28 17:43 ` Simon Marchi
2020-07-28 18:31 ` H.J. Lu
2020-07-28 18:47 ` Simon Marchi
2020-07-28 18:57 ` H.J. Lu
2020-07-28 14:54 ` Andreas Schwab
2020-07-28 13:53 ` H.J. Lu
2020-07-28 13:54 ` Simon Marchi
2020-07-28 12:54 ` Mark Wielaard
2020-07-28 13:27 ` [PATCH] PKG_CHECK_MODULES: Properly check " H.J. Lu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAMe9rOrJvowubNX6Yq627zmWt6hfx1LpEAuB97_RsfC59omYjQ@mail.gmail.com \
--to=hjl.tools@gmail.com \
--cc=amerey@redhat.com \
--cc=binutils@sourceware.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=simark@simark.ca \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox