* [PATCH] bpftool: Fix build with OpenSSL versions older than 3.0
@ 2025-12-05 14:55 Leo Yan
2025-12-05 15:06 ` Quentin Monnet
0 siblings, 1 reply; 3+ messages in thread
From: Leo Yan @ 2025-12-05 14:55 UTC (permalink / raw)
To: Quentin Monnet, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, bpf, linux-perf-users, linux-kernel
Cc: Leo Yan
ERR_get_error_all() exists only in OpenSSL 3.0 and later. Older versions
lack this API, causing build failure:
sign.c: In function 'display_openssl_errors':
sign.c:40:21: warning: implicit declaration of function 'ERR_get_error_all'; did you mean 'ERR_get_error_line'? [-Wimplicit-function-declaration]
40 | while ((e = ERR_get_error_all(&file, &line, NULL, &data, &flags))) {
| ^~~~~~~~~~~~~~~~~
| ERR_get_error_line
LINK /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/bpftool
/usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/sign.o: in function `display_openssl_errors.constprop.0':
sign.c:(.text+0x59): undefined reference to `ERR_get_error_all'
collect2: error: ld returned 1 exit status
Use the deprecated ERR_get_error_line_data() for OpenSSL < 3.0, and keep
using ERR_get_error_all() when available.
Fixes: 40863f4d6ef2 ("bpftool: Add support for signing BPF programs")
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
tools/bpf/bpftool/sign.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/tools/bpf/bpftool/sign.c b/tools/bpf/bpftool/sign.c
index b34f74d210e9..c98edd6d1dde 100644
--- a/tools/bpf/bpftool/sign.c
+++ b/tools/bpf/bpftool/sign.c
@@ -37,7 +37,11 @@ static void display_openssl_errors(int l)
int flags;
int line;
+#if OPENSSL_VERSION_MAJOR >= 3
while ((e = ERR_get_error_all(&file, &line, NULL, &data, &flags))) {
+#else
+ while ((e = ERR_get_error_line_data(&file, &line, &data, &flags))) {
+#endif
ERR_error_string_n(e, buf, sizeof(buf));
if (data && (flags & ERR_TXT_STRING)) {
p_err("OpenSSL %s: %s:%d: %s", buf, file, line, data);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] bpftool: Fix build with OpenSSL versions older than 3.0
2025-12-05 14:55 [PATCH] bpftool: Fix build with OpenSSL versions older than 3.0 Leo Yan
@ 2025-12-05 15:06 ` Quentin Monnet
2025-12-05 15:32 ` Leo Yan
0 siblings, 1 reply; 3+ messages in thread
From: Quentin Monnet @ 2025-12-05 15:06 UTC (permalink / raw)
To: Leo Yan, Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
bpf, linux-perf-users, linux-kernel, Alan Maguire
On 05/12/2025 14:55, Leo Yan wrote:
> ERR_get_error_all() exists only in OpenSSL 3.0 and later. Older versions
> lack this API, causing build failure:
>
> sign.c: In function 'display_openssl_errors':
> sign.c:40:21: warning: implicit declaration of function 'ERR_get_error_all'; did you mean 'ERR_get_error_line'? [-Wimplicit-function-declaration]
> 40 | while ((e = ERR_get_error_all(&file, &line, NULL, &data, &flags))) {
> | ^~~~~~~~~~~~~~~~~
> | ERR_get_error_line
> LINK /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/bpftool
> /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/sign.o: in function `display_openssl_errors.constprop.0':
> sign.c:(.text+0x59): undefined reference to `ERR_get_error_all'
> collect2: error: ld returned 1 exit status
>
> Use the deprecated ERR_get_error_line_data() for OpenSSL < 3.0, and keep
> using ERR_get_error_all() when available.
>
> Fixes: 40863f4d6ef2 ("bpftool: Add support for signing BPF programs")
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
> tools/bpf/bpftool/sign.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/bpf/bpftool/sign.c b/tools/bpf/bpftool/sign.c
> index b34f74d210e9..c98edd6d1dde 100644
> --- a/tools/bpf/bpftool/sign.c
> +++ b/tools/bpf/bpftool/sign.c
> @@ -37,7 +37,11 @@ static void display_openssl_errors(int l)
> int flags;
> int line;
>
> +#if OPENSSL_VERSION_MAJOR >= 3
> while ((e = ERR_get_error_all(&file, &line, NULL, &data, &flags))) {
> +#else
> + while ((e = ERR_get_error_line_data(&file, &line, &data, &flags))) {
> +#endif
> ERR_error_string_n(e, buf, sizeof(buf));
> if (data && (flags & ERR_TXT_STRING)) {
> p_err("OpenSSL %s: %s:%d: %s", buf, file, line, data);
Thanks, but this should be addressed in bpf-next already, see commit
90ae54b4c7ec ("bpftool: Allow bpftool to build with openssl < 3")
Quentin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] bpftool: Fix build with OpenSSL versions older than 3.0
2025-12-05 15:06 ` Quentin Monnet
@ 2025-12-05 15:32 ` Leo Yan
0 siblings, 0 replies; 3+ messages in thread
From: Leo Yan @ 2025-12-05 15:32 UTC (permalink / raw)
To: Quentin Monnet
Cc: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
Martin KaFai Lau, Eduard Zingerman, Song Liu, Yonghong Song,
John Fastabend, KP Singh, Stanislav Fomichev, Hao Luo, Jiri Olsa,
bpf, linux-perf-users, linux-kernel, Alan Maguire
On Fri, Dec 05, 2025 at 03:06:33PM +0000, Quentin Monnet wrote:
> On 05/12/2025 14:55, Leo Yan wrote:
> > ERR_get_error_all() exists only in OpenSSL 3.0 and later. Older versions
> > lack this API, causing build failure:
> >
> > sign.c: In function 'display_openssl_errors':
> > sign.c:40:21: warning: implicit declaration of function 'ERR_get_error_all'; did you mean 'ERR_get_error_line'? [-Wimplicit-function-declaration]
> > 40 | while ((e = ERR_get_error_all(&file, &line, NULL, &data, &flags))) {
> > | ^~~~~~~~~~~~~~~~~
> > | ERR_get_error_line
> > LINK /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/bpftool
> > /usr/lib/gcc/x86_64-alpine-linux-musl/11.2.1/../../../../x86_64-alpine-linux-musl/bin/ld: /tmp/build/perf/util/bpf_skel/.tmp/bootstrap/sign.o: in function `display_openssl_errors.constprop.0':
> > sign.c:(.text+0x59): undefined reference to `ERR_get_error_all'
> > collect2: error: ld returned 1 exit status
> >
> > Use the deprecated ERR_get_error_line_data() for OpenSSL < 3.0, and keep
> > using ERR_get_error_all() when available.
> >
> > Fixes: 40863f4d6ef2 ("bpftool: Add support for signing BPF programs")
> > Signed-off-by: Leo Yan <leo.yan@arm.com>
> > ---
> > tools/bpf/bpftool/sign.c | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > diff --git a/tools/bpf/bpftool/sign.c b/tools/bpf/bpftool/sign.c
> > index b34f74d210e9..c98edd6d1dde 100644
> > --- a/tools/bpf/bpftool/sign.c
> > +++ b/tools/bpf/bpftool/sign.c
> > @@ -37,7 +37,11 @@ static void display_openssl_errors(int l)
> > int flags;
> > int line;
> >
> > +#if OPENSSL_VERSION_MAJOR >= 3
> > while ((e = ERR_get_error_all(&file, &line, NULL, &data, &flags))) {
> > +#else
> > + while ((e = ERR_get_error_line_data(&file, &line, &data, &flags))) {
> > +#endif
> > ERR_error_string_n(e, buf, sizeof(buf));
> > if (data && (flags & ERR_TXT_STRING)) {
> > p_err("OpenSSL %s: %s:%d: %s", buf, file, line, data);
>
>
> Thanks, but this should be addressed in bpf-next already, see commit
> 90ae54b4c7ec ("bpftool: Allow bpftool to build with openssl < 3")
Thanks for the info. I suspect someone has fixed it so I did not find
it on the perf mailing list (I should search bpf ML). Please ignore
this one.
Leo
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-05 15:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-05 14:55 [PATCH] bpftool: Fix build with OpenSSL versions older than 3.0 Leo Yan
2025-12-05 15:06 ` Quentin Monnet
2025-12-05 15:32 ` Leo Yan
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 NNTP newsgroup(s).