Skip to contentSkip to conversation

tools/build: Add a feature test for libopenssl

PATCH Applied Namhyung Kim 4 participants 10 messages Dec 3, 2025 – Dec 23, 2025

Subsystems (2)
lore
Share & tools
lore

Namhyung Kim

author maintainer
#0 lore raw

PATCH 1/2 tools/build: Add a feature test for libopenssl

It's used by bpftool and the kernel build. Let's add a feature test so that perf can decide what to do based on the availability.

---
 tools/build/Makefile.feature          | 6 ++++--
 tools/build/feature/Makefile          | 8 ++++++--
 tools/build/feature/test-all.c        | 5 +++++
 tools/build/feature/test-libopenssl.c | 7 +++++++
 4 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 tools/build/feature/test-libopenssl.c
tools/build/Makefile.feature +4 -2
index fc6abe369f7373c5..bc6d85bad379321b 100644
@@ -99,7 +99,8 @@ FEATURE_TESTS_BASIC :=                  \
         libzstd				\
         disassembler-four-args		\
         disassembler-init-styled	\
-        file-handle
+        file-handle			\
+        libopenssl
 
 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
 # of all feature tests
@@ -147,7 +148,8 @@ FEATURE_DISPLAY ?=              \
          lzma                   \
          bpf			\
          libaio			\
-         libzstd
+         libzstd		\
+         libopenssl
 
 #
 # Declare group members of a feature to display the logical OR of the detection
tools/build/feature/Makefile +6 -2
index 7c90e0d0157ac9b1..3fd5ad0db2109778 100644
@@ -67,12 +67,13 @@ FILES=                                          \
          test-libopencsd.bin			\
          test-clang.bin				\
          test-llvm.bin				\
-         test-llvm-perf.bin   \
+         test-llvm-perf.bin   			\
          test-libaio.bin			\
          test-libzstd.bin			\
          test-clang-bpf-co-re.bin		\
          test-file-handle.bin			\
-         test-libpfm4.bin
+         test-libpfm4.bin			\
+         test-libopenssl.bin
 
 FILES := $(addprefix $(OUTPUT),$(FILES))
 
@@ -381,6 +382,9 @@ endif
 $(OUTPUT)test-libpfm4.bin:
 	$(BUILD) -lpfm
 
+$(OUTPUT)test-libopenssl.bin:
+	$(BUILD) -lssl
+
 $(OUTPUT)test-bpftool-skeletons.bin:
 	$(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \
 		> $(@:.bin=.make.output) 2>&1
tools/build/feature/test-all.c +5 -0
index eb346160d0ba0e2f..1488bf6e607836e5 100644
@@ -142,6 +142,10 @@
 # include "test-libtraceevent.c"
 #undef main
 
+#define main main_test_libopenssl
+# include "test-libopenssl.c"
+#undef main
+
 int main(int argc, char *argv[])
 {
 	main_test_libpython();
@@ -173,6 +177,7 @@ int main(int argc, char *argv[])
 	main_test_reallocarray();
 	main_test_libzstd();
 	main_test_libtraceevent();
+	main_test_libopenssl();
 
 	return 0;
 }
tools/build/feature/test-libopenssl.c new file +7 -0
new file mode 100644
index 0000000000000000..168c45894e8be687
@@ -0,0 +1,7 @@
+#include <openssl/ssl.h>
+#include <openssl/opensslv.h>
+
+int main(void)
+{
+	return SSL_library_init();
+}
Signature · 1 line
2.52.0.177.g9f829587af-goog
author maintainer
#1 lore raw

PATCH 2/2 perf tools: Disable BPF skeleton if no libopenssl found

The libopenssl is required by bpftool which is needed to generate BPF skeleton. Disable it by setting BUILD_BPF_SKEL to 0 otherwise it'll see build errors like below:

CC /build/util/bpf_skel/.tmp/bootstrap/sign.o
sign.c:16:10: fatal error: openssl/opensslv.h: No such file or directory
16 | #include <openssl/opensslv.h>
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [Makefile:256: /build/util/bpf_skel/.tmp/bootstrap/sign.o] Error 1 make[3]: *** Waiting for unfinished jobs....
make[2]: *** [Makefile.perf:1211: /build/util/bpf_skel/.tmp/bootstrap/bpftool] Error 2 make[1]: *** [Makefile.perf:287: sub-make] Error 2
make: *** [Makefile:76: all] Error 2

Now it'll skip the build with the following message:

Makefile.config:729: Warning: Disabled BPF skeletons as libopenssl is required

---
 tools/perf/Makefile.config | 8 ++++++++
 1 file changed, 8 insertions(+)
tools/perf/Makefile.config +8 -0
index 6b62fea21a0ad1ca..fd72bfbc83b38b3c 100644
@@ -704,6 +704,11 @@ ifndef NO_LIBBPF
   endif
 endif
 
+ifeq ($(feature-libopenssl), 1)
+  $(call detected,CONFIG_LIBOPENSSL)
+  CFLAGS += -DHAVE_LIBOPENSSL_SUPPORT
+endif
+
 ifndef BUILD_BPF_SKEL
   # BPF skeletons control a large number of perf features, by default
   # they are enabled.
@@ -720,6 +725,9 @@ ifeq ($(BUILD_BPF_SKEL),1)
   else ifeq ($(filter -DHAVE_LIBBPF_SUPPORT, $(CFLAGS)),)
     $(warning Warning: Disabled BPF skeletons as libbpf is required)
     BUILD_BPF_SKEL := 0
+  else ifeq ($(filter -DHAVE_LIBOPENSSL_SUPPORT, $(CFLAGS)),)
+    $(warning Warning: Disabled BPF skeletons as libopenssl is required)
+    BUILD_BPF_SKEL := 0
   else ifeq ($(call get-executable,$(CLANG)),)
     $(warning Warning: Disabled BPF skeletons as clang ($(CLANG)) is missing)
     BUILD_BPF_SKEL := 0
Signature · 1 line
2.52.0.177.g9f829587af-goog
reviewer
#2 lore raw
In reply to Namhyung Kim
Quoted 3 lines · Namhyung Kim

It's used by bpftool and the kernel build. Let's add a feature test so that perf can decide what to do based on the availability.

It seems strange to add a feature test that bpftool is missing and then use it only in the perf build. The signing of bpf programs isn't something I think we need for skeleton support in perf. I like the feature test, could we add it and use it in bpftool? The only two functions using openssl appear to be:

__u32 register_session_key(const char *key_der_path) int bpftool_prog_sign(struct bpf_load_and_run_opts *opts)

so we can do the whole feature test then #ifdef HAVE_FEATURE... stub static inline versions of the functions game?

Perhaps we only need the bootstrap version of bpftool in perf and we can just avoid dependencies that way. Looking at bpftool's build I see that sign.o/c with those functions in is part of the bootstrap version of bpftool :-(

Thanks,
Ian

Quoted 102 lines
---
 tools/build/Makefile.feature          | 6 ++++--
 tools/build/feature/Makefile          | 8 ++++++--
 tools/build/feature/test-all.c        | 5 +++++
 tools/build/feature/test-libopenssl.c | 7 +++++++
 4 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 tools/build/feature/test-libopenssl.c
tools/build/Makefile.feature +4 -2
index fc6abe369f7373c5..bc6d85bad379321b 100644
@@ -99,7 +99,8 @@ FEATURE_TESTS_BASIC :=                  \
         libzstd                                \
         disassembler-four-args         \
         disassembler-init-styled       \
-        file-handle
+        file-handle                    \
+        libopenssl
 
 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
 # of all feature tests
@@ -147,7 +148,8 @@ FEATURE_DISPLAY ?=              \
          lzma                   \
          bpf                   \
          libaio                        \
-         libzstd
+         libzstd               \
+         libopenssl
 
 #
 # Declare group members of a feature to display the logical OR of the detection
tools/build/feature/Makefile +6 -2
index 7c90e0d0157ac9b1..3fd5ad0db2109778 100644
@@ -67,12 +67,13 @@ FILES=                                          \
          test-libopencsd.bin                   \
          test-clang.bin                                \
          test-llvm.bin                         \
-         test-llvm-perf.bin   \
+         test-llvm-perf.bin                    \
          test-libaio.bin                       \
          test-libzstd.bin                      \
          test-clang-bpf-co-re.bin              \
          test-file-handle.bin                  \
-         test-libpfm4.bin
+         test-libpfm4.bin                      \
+         test-libopenssl.bin
 
 FILES := $(addprefix $(OUTPUT),$(FILES))
 
@@ -381,6 +382,9 @@ endif
 $(OUTPUT)test-libpfm4.bin:
        $(BUILD) -lpfm
 
+$(OUTPUT)test-libopenssl.bin:
+       $(BUILD) -lssl
+
 $(OUTPUT)test-bpftool-skeletons.bin:
        $(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \
                > $(@:.bin=.make.output) 2>&1
tools/build/feature/test-all.c +5 -0
index eb346160d0ba0e2f..1488bf6e607836e5 100644
@@ -142,6 +142,10 @@
 # include "test-libtraceevent.c"
 #undef main
 
+#define main main_test_libopenssl
+# include "test-libopenssl.c"
+#undef main
+
 int main(int argc, char *argv[])
 {
        main_test_libpython();
@@ -173,6 +177,7 @@ int main(int argc, char *argv[])
        main_test_reallocarray();
        main_test_libzstd();
        main_test_libtraceevent();
+       main_test_libopenssl();
 
        return 0;
 }
tools/build/feature/test-libopenssl.c new file +7 -1
new file mode 100644
index 0000000000000000..168c45894e8be687
@@ -0,0 +1,7 @@
+#include <openssl/ssl.h>
+#include <openssl/opensslv.h>
+
+int main(void)
+{
+       return SSL_library_init();
+}
--

2.52.0.177.g9f829587af-goog

author maintainer
#3 lore raw

Hi Ian,

Quoted 14 lines · Ian Rogers
Quoted 3 lines · Namhyung Kim

It's used by bpftool and the kernel build. Let's add a feature test so that perf can decide what to do based on the availability.

It seems strange to add a feature test that bpftool is missing and then use it only in the perf build. The signing of bpf programs isn't something I think we need for skeleton support in perf. I like the feature test, could we add it and use it in bpftool? The only two functions using openssl appear to be:

__u32 register_session_key(const char *key_der_path) int bpftool_prog_sign(struct bpf_load_and_run_opts *opts)

Quoted 7 lines

so we can do the whole feature test then #ifdef HAVE_FEATURE... stub static inline versions of the functions game?

Perhaps we only need the bootstrap version of bpftool in perf and we can just avoid dependencies that way. Looking at bpftool's build I see that sign.o/c with those functions in is part of the bootstrap version of bpftool :-(

BPF folks said it's a required library and they don't want to build without it.

https://lore.kernel.org/linux-perf-users/[email protected]/

Thanks,
Namhyung

#4 lore raw
In reply to Ian Rogers
Quoted 7 lines · Ian Rogers
Quoted 3 lines · Namhyung Kim

It's used by bpftool and the kernel build. Let's add a feature test so that perf can decide what to do based on the availability.

It seems strange to add a feature test that bpftool is missing and then use it only in the perf build. The signing of bpf programs isn't

It is strange indeed, I agree that since we don't use BPF signing at this point in the perf BPf skels, then we could just bootstrap a bpftool without such feature and continue building the existing features.

Adding the bpftool maintainer to the CC list, Quentin?

- Arnaldo

Quoted 120 lines

something I think we need for skeleton support in perf. I like the feature test, could we add it and use it in bpftool? The only two functions using openssl appear to be:

__u32 register_session_key(const char *key_der_path) int bpftool_prog_sign(struct bpf_load_and_run_opts *opts)

so we can do the whole feature test then #ifdef HAVE_FEATURE... stub static inline versions of the functions game?

Perhaps we only need the bootstrap version of bpftool in perf and we can just avoid dependencies that way. Looking at bpftool's build I see that sign.o/c with those functions in is part of the bootstrap version of bpftool :-(

Thanks,
Ian

Quoted 102 lines
---
 tools/build/Makefile.feature          | 6 ++++--
 tools/build/feature/Makefile          | 8 ++++++--
 tools/build/feature/test-all.c        | 5 +++++
 tools/build/feature/test-libopenssl.c | 7 +++++++
 4 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 tools/build/feature/test-libopenssl.c
tools/build/Makefile.feature +4 -2
index fc6abe369f7373c5..bc6d85bad379321b 100644
@@ -99,7 +99,8 @@ FEATURE_TESTS_BASIC :=                  \
         libzstd                                \
         disassembler-four-args         \
         disassembler-init-styled       \
-        file-handle
+        file-handle                    \
+        libopenssl
 
 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
 # of all feature tests
@@ -147,7 +148,8 @@ FEATURE_DISPLAY ?=              \
          lzma                   \
          bpf                   \
          libaio                        \
-         libzstd
+         libzstd               \
+         libopenssl
 
 #
 # Declare group members of a feature to display the logical OR of the detection
tools/build/feature/Makefile +6 -2
index 7c90e0d0157ac9b1..3fd5ad0db2109778 100644
@@ -67,12 +67,13 @@ FILES=                                          \
          test-libopencsd.bin                   \
          test-clang.bin                                \
          test-llvm.bin                         \
-         test-llvm-perf.bin   \
+         test-llvm-perf.bin                    \
          test-libaio.bin                       \
          test-libzstd.bin                      \
          test-clang-bpf-co-re.bin              \
          test-file-handle.bin                  \
-         test-libpfm4.bin
+         test-libpfm4.bin                      \
+         test-libopenssl.bin
 
 FILES := $(addprefix $(OUTPUT),$(FILES))
 
@@ -381,6 +382,9 @@ endif
 $(OUTPUT)test-libpfm4.bin:
        $(BUILD) -lpfm
 
+$(OUTPUT)test-libopenssl.bin:
+       $(BUILD) -lssl
+
 $(OUTPUT)test-bpftool-skeletons.bin:
        $(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \
                > $(@:.bin=.make.output) 2>&1
tools/build/feature/test-all.c +5 -0
index eb346160d0ba0e2f..1488bf6e607836e5 100644
@@ -142,6 +142,10 @@
 # include "test-libtraceevent.c"
 #undef main
 
+#define main main_test_libopenssl
+# include "test-libopenssl.c"
+#undef main
+
 int main(int argc, char *argv[])
 {
        main_test_libpython();
@@ -173,6 +177,7 @@ int main(int argc, char *argv[])
        main_test_reallocarray();
        main_test_libzstd();
        main_test_libtraceevent();
+       main_test_libopenssl();
 
        return 0;
 }
tools/build/feature/test-libopenssl.c new file +7 -1
new file mode 100644
index 0000000000000000..168c45894e8be687
@@ -0,0 +1,7 @@
+#include <openssl/ssl.h>
+#include <openssl/opensslv.h>
+
+int main(void)
+{
+       return SSL_library_init();
+}
--

2.52.0.177.g9f829587af-goog

author maintainer
#5 lore raw
Quoted 6 lines · Arnaldo Carvalho de Melo
Quoted 5 lines · Ian Rogers
Quoted 3 lines · Namhyung Kim

It's used by bpftool and the kernel build. Let's add a feature test so that perf can decide what to do based on the availability.

Quoted 8 lines
Quoted 2 lines

It seems strange to add a feature test that bpftool is missing and then use it only in the perf build. The signing of bpf programs isn't

It is strange indeed, I agree that since we don't use BPF signing at this point in the perf BPf skels, then we could just bootstrap a bpftool without such feature and continue building the existing features.

Adding the bpftool maintainer to the CC list, Quentin?

I've already talked to Quentin and they want libopenssl as a requirement.

https://lore.kernel.org/linux-perf-users/[email protected]/

Thanks,
Namhyung

Quoted 120 lines
Quoted 120 lines

something I think we need for skeleton support in perf. I like the feature test, could we add it and use it in bpftool? The only two functions using openssl appear to be:

__u32 register_session_key(const char *key_der_path) int bpftool_prog_sign(struct bpf_load_and_run_opts *opts)

so we can do the whole feature test then #ifdef HAVE_FEATURE... stub static inline versions of the functions game?

Perhaps we only need the bootstrap version of bpftool in perf and we can just avoid dependencies that way. Looking at bpftool's build I see that sign.o/c with those functions in is part of the bootstrap version of bpftool :-(

Thanks,
Ian

Quoted 102 lines
---
 tools/build/Makefile.feature          | 6 ++++--
 tools/build/feature/Makefile          | 8 ++++++--
 tools/build/feature/test-all.c        | 5 +++++
 tools/build/feature/test-libopenssl.c | 7 +++++++
 4 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 tools/build/feature/test-libopenssl.c
tools/build/Makefile.feature +4 -2
index fc6abe369f7373c5..bc6d85bad379321b 100644
@@ -99,7 +99,8 @@ FEATURE_TESTS_BASIC :=                  \
         libzstd                                \
         disassembler-four-args         \
         disassembler-init-styled       \
-        file-handle
+        file-handle                    \
+        libopenssl
 
 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
 # of all feature tests
@@ -147,7 +148,8 @@ FEATURE_DISPLAY ?=              \
          lzma                   \
          bpf                   \
          libaio                        \
-         libzstd
+         libzstd               \
+         libopenssl
 
 #
 # Declare group members of a feature to display the logical OR of the detection
tools/build/feature/Makefile +6 -2
index 7c90e0d0157ac9b1..3fd5ad0db2109778 100644
@@ -67,12 +67,13 @@ FILES=                                          \
          test-libopencsd.bin                   \
          test-clang.bin                                \
          test-llvm.bin                         \
-         test-llvm-perf.bin   \
+         test-llvm-perf.bin                    \
          test-libaio.bin                       \
          test-libzstd.bin                      \
          test-clang-bpf-co-re.bin              \
          test-file-handle.bin                  \
-         test-libpfm4.bin
+         test-libpfm4.bin                      \
+         test-libopenssl.bin
 
 FILES := $(addprefix $(OUTPUT),$(FILES))
 
@@ -381,6 +382,9 @@ endif
 $(OUTPUT)test-libpfm4.bin:
        $(BUILD) -lpfm
 
+$(OUTPUT)test-libopenssl.bin:
+       $(BUILD) -lssl
+
 $(OUTPUT)test-bpftool-skeletons.bin:
        $(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \
                > $(@:.bin=.make.output) 2>&1
tools/build/feature/test-all.c +5 -0
index eb346160d0ba0e2f..1488bf6e607836e5 100644
@@ -142,6 +142,10 @@
 # include "test-libtraceevent.c"
 #undef main
 
+#define main main_test_libopenssl
+# include "test-libopenssl.c"
+#undef main
+
 int main(int argc, char *argv[])
 {
        main_test_libpython();
@@ -173,6 +177,7 @@ int main(int argc, char *argv[])
        main_test_reallocarray();
        main_test_libzstd();
        main_test_libtraceevent();
+       main_test_libopenssl();
 
        return 0;
 }
tools/build/feature/test-libopenssl.c new file +7 -1
new file mode 100644
index 0000000000000000..168c45894e8be687
@@ -0,0 +1,7 @@
+#include <openssl/ssl.h>
+#include <openssl/opensslv.h>
+
+int main(void)
+{
+       return SSL_library_init();
+}
--

2.52.0.177.g9f829587af-goog

reviewer
#6 lore raw
Quoted 15 lines · Namhyung Kim
Quoted 13 lines · Arnaldo Carvalho de Melo
Quoted 7 lines · Ian Rogers
Quoted 3 lines · Namhyung Kim

It's used by bpftool and the kernel build. Let's add a feature test so that perf can decide what to do based on the availability.

It seems strange to add a feature test that bpftool is missing and then use it only in the perf build. The signing of bpf programs isn't

It is strange indeed, I agree that since we don't use BPF signing at this point in the perf BPf skels, then we could just bootstrap a bpftool without such feature and continue building the existing features.

Quoted 6 lines
Quoted 1 line

Adding the bpftool maintainer to the CC list, Quentin?

I've already talked to Quentin and they want libopenssl as a requirement.

https://lore.kernel.org/linux-perf-users/[email protected]/

You can have libopenssl as a requirement and have a bootstrap bpftool that doesn't require it, as the bootstrap version only provides minimal features typically to just build bpftool. You can also have libopenssl as a requirement and have a feature test that fails in the bpftool build saying you are missing a requirement. Having the perf build detect that a feature for the bpftool dependency is missing is fine as we can then recommend installing bpftool or the missing dependency, but doing this without bpftool also doing something just seems inconsistent.

Thanks,
Ian

Quoted 124 lines

Thanks,
Namhyung

Quoted 120 lines
Quoted 120 lines

something I think we need for skeleton support in perf. I like the feature test, could we add it and use it in bpftool? The only two functions using openssl appear to be:

__u32 register_session_key(const char *key_der_path) int bpftool_prog_sign(struct bpf_load_and_run_opts *opts)

so we can do the whole feature test then #ifdef HAVE_FEATURE... stub static inline versions of the functions game?

Perhaps we only need the bootstrap version of bpftool in perf and we can just avoid dependencies that way. Looking at bpftool's build I see that sign.o/c with those functions in is part of the bootstrap version of bpftool :-(

Thanks,
Ian

Quoted 102 lines
---
 tools/build/Makefile.feature          | 6 ++++--
 tools/build/feature/Makefile          | 8 ++++++--
 tools/build/feature/test-all.c        | 5 +++++
 tools/build/feature/test-libopenssl.c | 7 +++++++
 4 files changed, 22 insertions(+), 4 deletions(-)
 create mode 100644 tools/build/feature/test-libopenssl.c
tools/build/Makefile.feature +4 -2
index fc6abe369f7373c5..bc6d85bad379321b 100644
@@ -99,7 +99,8 @@ FEATURE_TESTS_BASIC :=                  \
         libzstd                                \
         disassembler-four-args         \
         disassembler-init-styled       \
-        file-handle
+        file-handle                    \
+        libopenssl
 
 # FEATURE_TESTS_BASIC + FEATURE_TESTS_EXTRA is the complete list
 # of all feature tests
@@ -147,7 +148,8 @@ FEATURE_DISPLAY ?=              \
          lzma                   \
          bpf                   \
          libaio                        \
-         libzstd
+         libzstd               \
+         libopenssl
 
 #
 # Declare group members of a feature to display the logical OR of the detection
tools/build/feature/Makefile +6 -2
index 7c90e0d0157ac9b1..3fd5ad0db2109778 100644
@@ -67,12 +67,13 @@ FILES=                                          \
          test-libopencsd.bin                   \
          test-clang.bin                                \
          test-llvm.bin                         \
-         test-llvm-perf.bin   \
+         test-llvm-perf.bin                    \
          test-libaio.bin                       \
          test-libzstd.bin                      \
          test-clang-bpf-co-re.bin              \
          test-file-handle.bin                  \
-         test-libpfm4.bin
+         test-libpfm4.bin                      \
+         test-libopenssl.bin
 
 FILES := $(addprefix $(OUTPUT),$(FILES))
 
@@ -381,6 +382,9 @@ endif
 $(OUTPUT)test-libpfm4.bin:
        $(BUILD) -lpfm
 
+$(OUTPUT)test-libopenssl.bin:
+       $(BUILD) -lssl
+
 $(OUTPUT)test-bpftool-skeletons.bin:
        $(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \
                > $(@:.bin=.make.output) 2>&1
tools/build/feature/test-all.c +5 -0
index eb346160d0ba0e2f..1488bf6e607836e5 100644
@@ -142,6 +142,10 @@
 # include "test-libtraceevent.c"
 #undef main
 
+#define main main_test_libopenssl
+# include "test-libopenssl.c"
+#undef main
+
 int main(int argc, char *argv[])
 {
        main_test_libpython();
@@ -173,6 +177,7 @@ int main(int argc, char *argv[])
        main_test_reallocarray();
        main_test_libzstd();
        main_test_libtraceevent();
+       main_test_libopenssl();
 
        return 0;
 }
tools/build/feature/test-libopenssl.c new file +7 -1
new file mode 100644
index 0000000000000000..168c45894e8be687
@@ -0,0 +1,7 @@
+#include <openssl/ssl.h>
+#include <openssl/opensslv.h>
+
+int main(void)
+{
+       return SSL_library_init();
+}
--

2.52.0.177.g9f829587af-goog

#7 lore raw

2025-12-04 22:27 UTC-0800 ~ Ian Rogers <[email protected]>

Quoted 33 lines · Namhyung Kim
Quoted 15 lines · Arnaldo Carvalho de Melo
Quoted 13 lines · Ian Rogers
Quoted 7 lines · Namhyung Kim
Quoted 3 lines

It's used by bpftool and the kernel build. Let's add a feature test so that perf can decide what to do based on the availability.

It seems strange to add a feature test that bpftool is missing and then use it only in the perf build. The signing of bpf programs isn't

It is strange indeed, I agree that since we don't use BPF signing at this point in the perf BPf skels, then we could just bootstrap a bpftool without such feature and continue building the existing features.

Quoted 6 lines
Quoted 1 line

Adding the bpftool maintainer to the CC list, Quentin?

I've already talked to Quentin and they want libopenssl as a requirement.

https://lore.kernel.org/linux-perf-users/[email protected]/

You can have libopenssl as a requirement and have a bootstrap bpftool that doesn't require it, as the bootstrap version only provides minimal features typically to just build bpftool. You can also have libopenssl as a requirement and have a feature test that fails in the bpftool build saying you are missing a requirement. Having the perf build detect that a feature for the bpftool dependency is missing is fine as we can then recommend installing bpftool or the missing dependency, but doing this without bpftool also doing something just seems inconsistent.

Quoted 2 lines

Thanks,
Ian

From bpftool's perspective, it doesn't really make sense to skip the OpenSSL dependency for the bootstrap version, given that we want to ship the main binary with the signing feature: so you could build a bootstrap version without signing, but you won't be able to use it to build the final binary because, well, you miss a required dependency.

This being said, if it really makes it easier for you to build perf, I'd be open to adjusting the bootstrap version, as long as it doesn't affect the final bpftool build. It might lead to further headaches if someone needs to sign the BPF programs when building perf in the future though.

I'm also OK with adding a dependency check with a simple build error for bpftool, although we don't currently do it for other required dependencies in bpftool.

Quentin

author maintainer
#8 lore raw

Hello,

Quoted 44 lines · Quentin Monnet

2025-12-04 22:27 UTC-0800 ~ Ian Rogers <[email protected]>

Quoted 33 lines · Namhyung Kim
Quoted 15 lines · Arnaldo Carvalho de Melo
Quoted 13 lines · Ian Rogers
Quoted 7 lines · Namhyung Kim
Quoted 3 lines

It's used by bpftool and the kernel build. Let's add a feature test so that perf can decide what to do based on the availability.

It seems strange to add a feature test that bpftool is missing and then use it only in the perf build. The signing of bpf programs isn't

It is strange indeed, I agree that since we don't use BPF signing at this point in the perf BPf skels, then we could just bootstrap a bpftool without such feature and continue building the existing features.

Quoted 6 lines
Quoted 1 line

Adding the bpftool maintainer to the CC list, Quentin?

I've already talked to Quentin and they want libopenssl as a requirement.

https://lore.kernel.org/linux-perf-users/[email protected]/

You can have libopenssl as a requirement and have a bootstrap bpftool that doesn't require it, as the bootstrap version only provides minimal features typically to just build bpftool. You can also have libopenssl as a requirement and have a feature test that fails in the bpftool build saying you are missing a requirement. Having the perf build detect that a feature for the bpftool dependency is missing is fine as we can then recommend installing bpftool or the missing dependency, but doing this without bpftool also doing something just seems inconsistent.

Quoted 2 lines

Thanks,
Ian

From bpftool's perspective, it doesn't really make sense to skip the OpenSSL dependency for the bootstrap version, given that we want to ship the main binary with the signing feature: so you could build a bootstrap version without signing, but you won't be able to use it to build the final binary because, well, you miss a required dependency.

Quoted 8 lines

This being said, if it really makes it easier for you to build perf, I'd be open to adjusting the bootstrap version, as long as it doesn't affect the final bpftool build. It might lead to further headaches if someone needs to sign the BPF programs when building perf in the future though.

I'm also OK with adding a dependency check with a simple build error for bpftool, although we don't currently do it for other required dependencies in bpftool.

Ok, to make a progress, I'll add this series to perf-tools tree for v6.19 first.

Thanks,
Namhyung

author maintainer Applied
#9 lore raw
In reply to Namhyung Kim
Quoted 4 lines · Namhyung Kim

It's used by bpftool and the kernel build. Let's add a feature test so that perf can decide what to do based on the availability.

Applied to perf-tools, thanks!

Best regards,
Namhyung