From 40205fa62b4fa578b9158810c0681f665142fb2f Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Mon, 6 May 2024 09:00:49 +0200 Subject: [PATCH] package/oprofile: fix static build with binutils >= 2.40 sframe library was added by binutils 2.40 and https://github.com/bminor/binutils-gdb/commit/19e559f1c91bfaedbd2f91d85ee161f3f03fda3c resulting in the following static build failure: /home/buildroot/autobuild/run/instance-1/output-1/build/binutils-2.41/bfd/elf-sframe.c:220: undefined reference to `sframe_decode' [...] configure: error: bfd library not found Fixes: - http://autobuild.buildroot.org/results/a9f3e09e6543b3773440c011e93bd41e357691e4 Signed-off-by: Fabrice Fontaine Signed-off-by: Thomas Petazzoni (cherry picked from commit 5272c6bea1247e87a32947bd960757a19fdf8b90) Signed-off-by: Peter Korsgaard --- ...-fix-static-build-with-binutils-2.40.patch | 62 +++++++++++++++++++ package/oprofile/oprofile.mk | 7 +++ 2 files changed, 69 insertions(+) create mode 100644 package/oprofile/0002-fix-static-build-with-binutils-2.40.patch diff --git a/package/oprofile/0002-fix-static-build-with-binutils-2.40.patch b/package/oprofile/0002-fix-static-build-with-binutils-2.40.patch new file mode 100644 index 0000000000..3134363abc --- /dev/null +++ b/package/oprofile/0002-fix-static-build-with-binutils-2.40.patch @@ -0,0 +1,62 @@ +From 1e4cd78bca2bd6e0d17b6cb9caf1b172d7bac564 Mon Sep 17 00:00:00 2001 +From: Fabrice Fontaine +Date: Mon, 6 May 2024 08:41:49 +0200 +Subject: [PATCH] fix static build with binutils >= 2.40 + +sframe library was added by binutils 2.40 and +https://github.com/bminor/binutils-gdb/commit/19e559f1c91bfaedbd2f91d85ee161f3f03fda3c +resulting in the following static build failure: + +/home/buildroot/autobuild/run/instance-1/output-1/build/binutils-2.41/bfd/elf-sframe.c:220: undefined reference to `sframe_decode' + +[...] + +configure: error: bfd library not found + +Fixes: + - http://autobuild.buildroot.org/results/a9f3e09e6543b3773440c011e93bd41e357691e4 + +Signed-off-by: Fabrice Fontaine +Upstream: https://sourceforge.net/p/oprofile/bugs/295 +--- + configure.ac | 2 +- + m4/binutils.m4 | 7 +++++-- + 2 files changed, 6 insertions(+), 3 deletions(-) + +diff --git a/configure.ac b/configure.ac +index dc447f89..72ef0a21 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -334,7 +334,7 @@ AX_CHECK_DOCBOOK + dnl finally restore the original libs setting + LIBS="$ORIG_SAVE_LIBS" + LIBERTY_LIBS="-liberty $DL_LIB $INTL_LIB" +-BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB $Z_LIB" ++BFD_LIBS="-lbfd -liberty $DL_LIB $INTL_LIB $SFRAME_LIB $Z_LIB" + POPT_LIBS="-lpopt" + AC_SUBST(LIBERTY_LIBS) + AC_SUBST(BFD_LIBS) +diff --git a/m4/binutils.m4 b/m4/binutils.m4 +index c50e2f3c..e1ccd8e7 100644 +--- a/m4/binutils.m4 ++++ b/m4/binutils.m4 +@@ -10,11 +10,14 @@ AC_CHECK_FUNCS(xmemdup) + AC_CHECK_LIB(dl, dlopen, LIBS="$LIBS -ldl"; DL_LIB="-ldl", DL_LIB="") + AC_CHECK_LIB(intl, main, LIBS="$LIBS -lintl"; INTL_LIB="-lintl", INTL_LIB="") + +-AC_CHECK_LIB(bfd, bfd_openr, LIBS="-lbfd $LIBS"; Z_LIB="", ++AC_CHECK_LIB(bfd, bfd_openr, LIBS="-lbfd $LIBS"; SFRAME_LIB=""; Z_LIB="", + [AC_CHECK_LIB(z, compress, + dnl Use a different bfd function here so as not to use cached result from above + [AC_CHECK_LIB(bfd, bfd_fdopenr, LIBS="-lbfd -lz $LIBS"; Z_LIB="-lz", +- [AC_MSG_ERROR([bfd library not found])], -lz) ++dnl Use a different bfd function here so as not to use cached result from above ++ [AC_CHECK_LIB(bfd, bfd_close, LIBS="-lbfd -lsframe -lz $LIBS"; SFRAME_LIB="-lsframe"; Z_LIB="-lz", ++ [AC_MSG_ERROR([bfd library not found])], -lsframe -lz) ++ ], -lz) + ], + [AC_MSG_ERROR([libz library not found; required by libbfd])]) + ] +-- +2.43.0 + diff --git a/package/oprofile/oprofile.mk b/package/oprofile/oprofile.mk index 512fbf9ea1..590e63b4ac 100644 --- a/package/oprofile/oprofile.mk +++ b/package/oprofile/oprofile.mk @@ -12,6 +12,13 @@ OPROFILE_CPE_ID_VENDOR = maynard_johnson OPROFILE_CONF_OPTS = \ --disable-account-check \ --with-kernel=$(STAGING_DIR)/usr +# 0002-fix-static-build-with-binutils-2.40.patch +OPROFILE_AUTORECONF = YES + +define OPROFILE_CREATE_MISSING_FILES + touch $(@D)/NEWS $(@D)/AUTHORS $(@D)/ChangeLog +endef +OPROFILE_POST_EXTRACT_HOOKS += OPROFILE_CREATE_MISSING_FILES OPROFILE_DEPENDENCIES = popt binutils host-pkgconf