public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] configure.ac: fix broken libdebuginfod library auto detection
@ 2023-12-18  5:01 Victor Kamensky
  2023-12-18  5:01 ` [PATCH 2/2] Makefile.am: fix build with --with-debuginfod=/path configure option Victor Kamensky
  2023-12-21 14:58 ` [PATCH 1/2] configure.ac: fix broken libdebuginfod library auto detection Frank Ch. Eigler
  0 siblings, 2 replies; 4+ messages in thread
From: Victor Kamensky @ 2023-12-18  5:01 UTC (permalink / raw)
  To: systemtap; +Cc: Frank Ch . Eigler, Victor Kamensky

After 2e67b053e3796ee7cf29a39f9698729b52078406 "configury: rework debuginfod searches"
commit, libdebuginfod.so library auto detection is broken. It was reported by Martin Jansa
on openembedded-core mailing list [1].

Currently configure.ac does "AC_DEFINE([HAVE_LIBDEBUGINFOD], [1] ..." as long as
no --without-debuginfod option is passed, regardless PKG_CHECK_MODULES check result.
It seems to be bad copy/paste. Address the issue by moving the AC_DEFINE back to
PKG_CHECK_MODULES action-if-found block.

To reproduce the issue on FC system, one can do the following
"sudo dnf remove elfutils-debuginfod-client-devel" and then try to build SystemTap
util.cxx will fail to compile because of missing elfutils/debuginfod.h because
config.h will have "#define HAVE_LIBDEBUGINFOD 1", while config.log and configure
output indicates that check for libdebuginfod library failed.

[1] https://lists.openembedded.org/g/openembedded-core/message/192109?p=%2C%2C%2C20%2C0%2C0%2C0%3A%3Acreated%2C0%2Csystemtap%2C20%2C2%2C0%2C102987514

Signed-off-by: Victor Kamensky <victor.kamensky7@gmail.com>
---
 configure.ac | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index d9559c5c3..18cd7f84a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -219,12 +219,11 @@ dnl take the user at his or her word
 elif test "x$with_debuginfod" != xno; then
 dnl check in the system pkgconfig
   PKG_CHECK_MODULES([debuginfod], [libdebuginfod >= 0.179],
-    [have_debuginfod=1],
+    [have_debuginfod=1
+     AC_DEFINE([HAVE_LIBDEBUGINFOD], [1], [Define to 1 if debuginfod is enabled.])],
     [if test "x$with_debuginfod" = xyes; then
        AC_MSG_ERROR(["--with-debuginfod was given, but libdebuginfod is missing or unusable."])
      fi])
-  AC_DEFINE([HAVE_LIBDEBUGINFOD], [1], [Define to 1 if debuginfod is enabled.])
-  AC_MSG_RESULT([yes])  
 else
   AC_MSG_RESULT([no])
 fi
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 2/2] Makefile.am: fix build with --with-debuginfod=/path configure option
  2023-12-18  5:01 [PATCH 1/2] configure.ac: fix broken libdebuginfod library auto detection Victor Kamensky
@ 2023-12-18  5:01 ` Victor Kamensky
  2023-12-21 15:09   ` Frank Ch. Eigler
  2023-12-21 14:58 ` [PATCH 1/2] configure.ac: fix broken libdebuginfod library auto detection Frank Ch. Eigler
  1 sibling, 1 reply; 4+ messages in thread
From: Victor Kamensky @ 2023-12-18  5:01 UTC (permalink / raw)
  To: systemtap; +Cc: Frank Ch . Eigler, Victor Kamensky

While I was testing my previous fix with libdebuginfod auto detection
failure I've noticed that configure option --with-debuginfod=/path does
not work in case if system does not have elfutils-debuginfod-client-devel.

I had external elfutils branch with debuginfod metadata change installed
at /path and when I've tried to build SystemTap with it, it was failing
in multiple places. My system is FC38.

It boils dows for couple issues applied in serveral Makefile.am files.

1. util.cxx is C++ file so debuginfod_CFLAGS should be added to _CXXFLAGS
flags, rather then just _CFLAGS

2. debuginfod_LDFLAGS should be added to _LDFLAGS, otherwise link command
does not get proper -L flag

Note this patch fixes only proper Makefile.am, someone would need to run
autoreconf and commit proper regenerated configure and Makefile.in files.

Signed-off-by: Victor Kamensky <victor.kamensky7@gmail.com>
---
 Makefile.am         | 16 ++++++++--------
 stapbpf/Makefile.am |  4 ++--
 stapdyn/Makefile.am |  8 ++++----
 staprun/Makefile.am |  4 ++--
 4 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 2ba896088..cfa693e65 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -188,9 +188,9 @@ if BUILD_TRANSLATOR
 if HAVE_NSS
 stap_sign_module_SOURCES = stap-sign-module.cxx nsscommon.cxx util.cxx
 stap_sign_module_CPPFLAGS = $(AM_CPPFLAGS)
-stap_sign_module_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
+stap_sign_module_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS) $(debuginfod_CFLAGS)
 stap_sign_module_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS) $(debuginfod_CFLAGS)
-stap_sign_module_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
+stap_sign_module_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ $(debuginfod_LDFLAGS)
 stap_sign_module_LDADD = $(nss_LIBS) $(debuginfod_LIBS)
 if HAVE_HTTP_SUPPORT
 stap_sign_module_LDADD += $(openssl_LIBS)
@@ -198,9 +198,9 @@ endif
 
 stap_authorize_cert_SOURCES = stap-authorize-cert.cxx nsscommon.cxx util.cxx
 stap_authorize_cert_CPPFLAGS = $(AM_CPPFLAGS)
-stap_authorize_cert_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
+stap_authorize_cert_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS) $(debuginfod_CFLAGS)
 stap_authorize_cert_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS) $(debuginfod_CFLAGS)
-stap_authorize_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
+stap_authorize_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ $(debuginfod_LDFLAGS)
 stap_authorize_cert_LDADD = $(nss_LIBS) $(debuginfod_LIBS)
 if HAVE_HTTP_SUPPORT
 stap_authorize_cert_LDADD += $(openssl_LIBS)
@@ -208,9 +208,9 @@ endif
 
 if BUILD_SERVER
 stap_serverd_SOURCES = stap-serverd.cxx cscommon.cxx util.cxx privilege.cxx nsscommon.cxx cmdline.cxx
-stap_serverd_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
+stap_serverd_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS) $(debuginfod_CFLAGS)
 stap_serverd_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS) $(debuginfod_CFLAGS)
-stap_serverd_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
+stap_serverd_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ $(debuginfod_LDFLAGS)
 stap_serverd_LDADD = $(nss_LIBS) -lpthread $(debuginfod_LIBS)
 if HAVE_AVAHI
 stap_serverd_CFLAGS += $(avahi_CFLAGS)
@@ -223,9 +223,9 @@ endif
 
 
 stap_gen_cert_SOURCES = stap-gen-cert.cxx util.cxx nsscommon.cxx
-stap_gen_cert_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS)
+stap_gen_cert_CXXFLAGS = $(AM_CXXFLAGS) @PIECXXFLAGS@ $(nss_CFLAGS) $(debuginfod_CFLAGS)
 stap_gen_cert_CFLAGS = $(AM_CFLAGS) @PIECFLAGS@ $(nss_CFLAGS) $(debuginfod_CFLAGS)
-stap_gen_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@
+stap_gen_cert_LDFLAGS = $(AM_LDFLAGS) @PIELDFLAGS@ $(debuginfod_LDFLAGS)
 stap_gen_cert_LDADD = $(nss_LIBS) $(debuginfod_LIBS)
 if HAVE_HTTP_SUPPORT
 stap_gen_cert_LDADD += $(openssl_LIBS)
diff --git a/stapbpf/Makefile.am b/stapbpf/Makefile.am
index 26b9a0cdf..e8c5168cf 100644
--- a/stapbpf/Makefile.am
+++ b/stapbpf/Makefile.am
@@ -22,8 +22,8 @@ stapbpf_SOURCES = stapbpf.cxx bpfinterp.cxx libbpf.c ../util.cxx \
 	../staprun/start_cmd.c
 stapbpf_CPPFLAGS = $(AM_CPPFLAGS)
 stapbpf_CFLAGS = $(AM_CFLAGS) $(debuginfod_CFLAGS)
-stapbpf_CXXFLAGS = $(AM_CXXFLAGS)
-stapbpf_LDFLAGS = $(AM_LDFLAGS)
+stapbpf_CXXFLAGS = $(AM_CXXFLAGS) $(debuginfod_CFLAGS)
+stapbpf_LDFLAGS = $(AM_LDFLAGS) $(debuginfod_LDFLAGS)
 stapbpf_LDADD = $(stapbpf_LIBS) -lpthread $(debuginfod_LIBS)
 
 BUILT_SOURCES =
diff --git a/stapdyn/Makefile.am b/stapdyn/Makefile.am
index 1b0dcf116..bd63d497b 100644
--- a/stapdyn/Makefile.am
+++ b/stapdyn/Makefile.am
@@ -30,15 +30,15 @@ man_MANS = stapdyn.8
 
 stapdyn_SOURCES = stapdyn.cxx mutator.cxx mutatee.cxx \
 				  dynprobe.cxx dynutil.cxx ../util.cxx
-stapdyn_CXXFLAGS = $(AM_CXXFLAGS) @DYNINST_CXXFLAGS@
-stapdyn_LDFLAGS = $(AM_LDFLAGS) @DYNINST_LDFLAGS@
+stapdyn_CXXFLAGS = $(AM_CXXFLAGS) @DYNINST_CXXFLAGS@ $(debuginfod_CFLAGS)
+stapdyn_LDFLAGS = $(AM_LDFLAGS) @DYNINST_LDFLAGS@ $(debuginfod_LDFLAGS)
 stapdyn_LDADD = -ldl -ldyninstAPI -lsymtabAPI -lpthread $(debuginfod_LIBS)
 stapdyn_CFLAGS = $(debuginfod_CFLAGS)
 
 dynsdt_SOURCES = dynsdt.cxx dynutil.cxx ../util.cxx
 dynsdt_CPPFLAGS = $(AM_CPPFLAGS)
-dynsdt_CXXFLAGS = $(AM_CXXFLAGS) @DYNINST_CXXFLAGS@
-dynsdt_LDFLAGS = $(AM_LDFLAGS) @DYNINST_LDFLAGS@
+dynsdt_CXXFLAGS = $(AM_CXXFLAGS) @DYNINST_CXXFLAGS@ $(debuginfod_CFLAGS)
+dynsdt_LDFLAGS = $(AM_LDFLAGS) @DYNINST_LDFLAGS@ $(debuginfod_LDFLAGS)
 dynsdt_LDADD = -ldl -lelf -ldyninstAPI -lsymtabAPI -lpthread $(debuginfod_LIBS)
 dynsdt_CFLAGS = $(debuginfod_CFLAGS)
 
diff --git a/staprun/Makefile.am b/staprun/Makefile.am
index 410d2b28f..f3694e592 100644
--- a/staprun/Makefile.am
+++ b/staprun/Makefile.am
@@ -26,10 +26,10 @@ libstrfloctime_a_CFLAGS = $(AM_CFLAGS) -Wno-format-nonliteral
 staprun_SOURCES = staprun.c staprun_funcs.c ctl.c common.c start_cmd.c \
 	../privilege.cxx ../util.cxx
 staprun_CFLAGS = $(AM_CFLAGS) -DSINGLE_THREADED $(debuginfod_CFLAGS)
-staprun_CXXFLAGS = $(AM_CXXFLAGS) -DSINGLE_THREADED
+staprun_CXXFLAGS = $(AM_CXXFLAGS) -DSINGLE_THREADED $(debuginfod_CFLAGS)
 staprun_CPPFLAGS = $(AM_CPPFLAGS)
 staprun_LDADD = libstrfloctime.a $(staprun_LIBS) $(debuginfod_LIBS)
-staprun_LDFLAGS =  $(AM_LDFLAGS) -Wl,--whole-archive,libstrfloctime.a,--no-whole-archive
+staprun_LDFLAGS =  $(AM_LDFLAGS) -Wl,--whole-archive,libstrfloctime.a,--no-whole-archive $(debuginfod_LDFLAGS)
 
 if HAVE_NSS
 staprun_SOURCES += modverify.c ../nsscommon.cxx
-- 
2.31.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] configure.ac: fix broken libdebuginfod library auto detection
  2023-12-18  5:01 [PATCH 1/2] configure.ac: fix broken libdebuginfod library auto detection Victor Kamensky
  2023-12-18  5:01 ` [PATCH 2/2] Makefile.am: fix build with --with-debuginfod=/path configure option Victor Kamensky
@ 2023-12-21 14:58 ` Frank Ch. Eigler
  1 sibling, 0 replies; 4+ messages in thread
From: Frank Ch. Eigler @ 2023-12-21 14:58 UTC (permalink / raw)
  To: Victor Kamensky; +Cc: systemtap

Victor Kamensky <victor.kamensky7@gmail.com> writes:

> After 2e67b053e3796ee7cf29a39f9698729b52078406 "configury: rework debuginfod searches"
> commit, libdebuginfod.so library auto detection is broken. It was reported by Martin Jansa
> on openembedded-core mailing list [1].
> [...]

Thanks, merged.

- FChE


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] Makefile.am: fix build with --with-debuginfod=/path configure option
  2023-12-18  5:01 ` [PATCH 2/2] Makefile.am: fix build with --with-debuginfod=/path configure option Victor Kamensky
@ 2023-12-21 15:09   ` Frank Ch. Eigler
  0 siblings, 0 replies; 4+ messages in thread
From: Frank Ch. Eigler @ 2023-12-21 15:09 UTC (permalink / raw)
  To: Victor Kamensky; +Cc: systemtap

Hi -

> While I was testing my previous fix with libdebuginfod auto detection
> failure I've noticed that configure option --with-debuginfod=/path does
> not work in case if system does not have elfutils-debuginfod-client-devel.

Thanks, merged!

- FChE


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-12-21 15:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-18  5:01 [PATCH 1/2] configure.ac: fix broken libdebuginfod library auto detection Victor Kamensky
2023-12-18  5:01 ` [PATCH 2/2] Makefile.am: fix build with --with-debuginfod=/path configure option Victor Kamensky
2023-12-21 15:09   ` Frank Ch. Eigler
2023-12-21 14:58 ` [PATCH 1/2] configure.ac: fix broken libdebuginfod library auto detection Frank Ch. Eigler

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).