summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorKhem Raj <raj.khem@gmail.com>2020-10-31 22:21:40 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-11-02 11:35:10 +0000
commit4f9ef652c44a19f3575901f120402c8e88c57d13 (patch)
treee26049a33c94acf6b2f6e81e0e0402e2776690f8 /meta
parent3e56ca6d0aef4b5798bc94ca5d2dbc5d85ce8931 (diff)
downloadpoky-4f9ef652c44a19f3575901f120402c8e88c57d13.tar.gz
rpm: Fix error.h handing properly on musl
Ignoring configure fragments when error.h does not exist on system leaves eflutils half configured, which is seen when gold linker is enabled because librpm does not have proper dependencies added, therefore add error.h for non-glibc case and include it when glibc is not used. (From OE-Core rev: 0b45dc1d611a7c96b528a5c62a2f18a00651d121) Signed-off-by: Khem Raj <raj.khem@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/rpm/files/0001-Fix-build-with-musl-C-library.patch26
-rw-r--r--meta/recipes-devtools/rpm/files/0001-tools-Add-error.h-for-non-glibc-case.patch118
-rw-r--r--meta/recipes-devtools/rpm/rpm_4.16.0.bb1
3 files changed, 119 insertions, 26 deletions
diff --git a/meta/recipes-devtools/rpm/files/0001-Fix-build-with-musl-C-library.patch b/meta/recipes-devtools/rpm/files/0001-Fix-build-with-musl-C-library.patch
index 0b1d6298a9..b960da6c31 100644
--- a/meta/recipes-devtools/rpm/files/0001-Fix-build-with-musl-C-library.patch
+++ b/meta/recipes-devtools/rpm/files/0001-Fix-build-with-musl-C-library.patch
@@ -11,29 +11,6 @@ Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
11 rpmio/digest_nss.c | 1 + 11 rpmio/digest_nss.c | 1 +
12 2 files changed, 3 insertions(+), 1 deletion(-) 12 2 files changed, 3 insertions(+), 1 deletion(-)
13 13
14diff --git a/configure.ac b/configure.ac
15index c04a2e8d1..c9d9ac16d 100644
16--- a/configure.ac
17+++ b/configure.ac
18@@ -255,6 +255,7 @@ AC_SEARCH_LIBS(dlopen, [dl])
19 # Check for libelf library. Prefer external, otherwise none.
20 WITH_LIBELF_LIB=
21 AC_CHECK_HEADER([libelf.h])
22+AC_CHECK_HEADERS([error.h], [WITH_ERROR_H=yes])
23 AC_CHECK_HEADERS([gelf.h], [
24 AC_CHECK_LIB(elf, gelf_getvernaux, [
25 AC_DEFINE(HAVE_LIBELF, 1, [Define to 1 if you have the 'elf' library (-lelf).])
26@@ -263,7 +264,7 @@ AC_CHECK_HEADERS([gelf.h], [
27 ])
28 ])
29 AC_SUBST(WITH_LIBELF_LIB)
30-AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes])
31+AM_CONDITIONAL(LIBELF,[test "$WITH_LIBELF" = yes && test "$WITH_ERROR_H" = yes])
32
33 AC_CHECK_HEADERS([dwarf.h], [
34 WITH_LIBDWARF=yes
35diff --git a/rpmio/digest_nss.c b/rpmio/digest_nss.c
36index 992d9acf6..e11920e3e 100644
37--- a/rpmio/digest_nss.c 14--- a/rpmio/digest_nss.c
38+++ b/rpmio/digest_nss.c 15+++ b/rpmio/digest_nss.c
39@@ -1,5 +1,6 @@ 16@@ -1,5 +1,6 @@
@@ -43,6 +20,3 @@ index 992d9acf6..e11920e3e 100644
43 #include <pthread.h> 20 #include <pthread.h>
44 #include <nss.h> 21 #include <nss.h>
45 #include <sechash.h> 22 #include <sechash.h>
46--
472.14.2
48
diff --git a/meta/recipes-devtools/rpm/files/0001-tools-Add-error.h-for-non-glibc-case.patch b/meta/recipes-devtools/rpm/files/0001-tools-Add-error.h-for-non-glibc-case.patch
new file mode 100644
index 0000000000..e78514b814
--- /dev/null
+++ b/meta/recipes-devtools/rpm/files/0001-tools-Add-error.h-for-non-glibc-case.patch
@@ -0,0 +1,118 @@
1From b3952bd5e28f2a4d86c7377de239db8fa7237e14 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 31 Oct 2020 22:14:05 -0700
4Subject: [PATCH] tools: Add error.h for non-glibc case
5
6error is glibc specific API, so this patch will mostly not accepted
7upstream given that elfutils has been closely tied to glibc
8
9Upstream-Status: Inappropriate [workaround for musl]
10
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 tools/debugedit.c | 6 +++++-
14 tools/elfdeps.c | 6 +++++-
15 tools/error.h | 27 +++++++++++++++++++++++++++
16 tools/sepdebugcrcfix.c | 6 +++++-
17 4 files changed, 42 insertions(+), 3 deletions(-)
18 create mode 100644 tools/error.h
19
20diff --git a/tools/debugedit.c b/tools/debugedit.c
21index 9f8dcd0fb..852f46073 100644
22--- a/tools/debugedit.c
23+++ b/tools/debugedit.c
24@@ -26,7 +26,6 @@
25 #include <byteswap.h>
26 #include <endian.h>
27 #include <errno.h>
28-#include <error.h>
29 #include <limits.h>
30 #include <string.h>
31 #include <stdlib.h>
32@@ -40,6 +39,11 @@
33
34 #include <gelf.h>
35 #include <dwarf.h>
36+#ifdef __GLIBC__
37+#include <error.h>
38+#else
39+#include "error.h"
40+#endif
41
42
43 /* Unfortunately strtab manipulation functions were only officially added
44diff --git a/tools/elfdeps.c b/tools/elfdeps.c
45index 6d9094874..f69e60997 100644
46--- a/tools/elfdeps.c
47+++ b/tools/elfdeps.c
48@@ -5,10 +5,14 @@
49 #include <unistd.h>
50 #include <stdlib.h>
51 #include <fcntl.h>
52-#include <error.h>
53 #include <errno.h>
54 #include <popt.h>
55 #include <gelf.h>
56+#ifdef __GLIBC__
57+#include <error.h>
58+#else
59+#include "error.h"
60+#endif
61
62 #include <rpm/rpmstring.h>
63 #include <rpm/argv.h>
64diff --git a/tools/error.h b/tools/error.h
65new file mode 100644
66index 000000000..ef06827a0
67--- /dev/null
68+++ b/tools/error.h
69@@ -0,0 +1,27 @@
70+#ifndef _ERROR_H_
71+#define _ERROR_H_
72+
73+#include <stdarg.h>
74+#include <stdio.h>
75+#include <stdlib.h>
76+#include <string.h>
77+#include <errno.h>
78+
79+static unsigned int error_message_count = 0;
80+
81+static inline void error(int status, int errnum, const char* format, ...)
82+{
83+ va_list ap;
84+ fprintf(stderr, "%s: ", program_invocation_name);
85+ va_start(ap, format);
86+ vfprintf(stderr, format, ap);
87+ va_end(ap);
88+ if (errnum)
89+ fprintf(stderr, ": %s", strerror(errnum));
90+ fprintf(stderr, "\n");
91+ error_message_count++;
92+ if (status)
93+ exit(status);
94+}
95+
96+#endif /* _ERROR_H_ */
97diff --git a/tools/sepdebugcrcfix.c b/tools/sepdebugcrcfix.c
98index fba460014..2be9c1fd8 100644
99--- a/tools/sepdebugcrcfix.c
100+++ b/tools/sepdebugcrcfix.c
101@@ -29,9 +29,13 @@
102 #include <endian.h>
103 #include <stdio.h>
104 #include <stdlib.h>
105-#include <error.h>
106 #include <libelf.h>
107 #include <gelf.h>
108+#ifdef __GLIBC__
109+#include <error.h>
110+#else
111+#include "error.h"
112+#endif
113
114 #ifndef _
115 #define _(x) x
116--
1172.29.2
118
diff --git a/meta/recipes-devtools/rpm/rpm_4.16.0.bb b/meta/recipes-devtools/rpm/rpm_4.16.0.bb
index f01874fe38..a578cf3cbd 100644
--- a/meta/recipes-devtools/rpm/rpm_4.16.0.bb
+++ b/meta/recipes-devtools/rpm/rpm_4.16.0.bb
@@ -40,6 +40,7 @@ SRC_URI = "git://github.com/rpm-software-management/rpm;branch=rpm-4.16.x \
40 file://0016-rpmscript.c-change-logging-level-around-scriptlets-t.patch \ 40 file://0016-rpmscript.c-change-logging-level-around-scriptlets-t.patch \
41 file://0001-lib-transaction.c-fix-file-conflicts-for-MIPS64-N32.patch \ 41 file://0001-lib-transaction.c-fix-file-conflicts-for-MIPS64-N32.patch \
42 file://0001-rpmdb.c-add-a-missing-include.patch \ 42 file://0001-rpmdb.c-add-a-missing-include.patch \
43 file://0001-tools-Add-error.h-for-non-glibc-case.patch \
43 " 44 "
44 45
45PE = "1" 46PE = "1"