Skip to contentSkip to conversation

tools build: Link static libs for libopenssl feature

PATCH Superseded Leo Yan 2 participants 3 messages Mar 17

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Leo Yan

author
#0 lore raw

PATCH v2 1/1 tools build: Link static libs for libopenssl feature

The perf static build reports that the BPF skeleton is disabled due to the missing libopenssl feature.

Explicitly linking the libraries fixes the static build failure.

Fixes 7678523109d1 ("tools/build: Add a feature test for libopenssl")
---
 tools/build/feature/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/feature/Makefile +1 -1
index 1fbcb3ce74d2173072748a417fc63bd9a5b13888..18a9abf6bfc43e86ecf58b96e0374a0e3c613bb0 100644
@@ -384,7 +384,7 @@ $(OUTPUT)test-libpfm4.bin:
 	$(BUILD) -lpfm
 
 $(OUTPUT)test-libopenssl.bin:
-	$(BUILD) -lssl
+	$(BUILD) -lssl -lcrypto -lz -lzstd
 
 $(OUTPUT)test-bpftool-skeletons.bin:
 	$(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \

---
base-commit: bb551508e78c886e6d3bcca6c744d3bc3fd8ad59
change-id: 20260317-tools_fix_build_libopenssl-8290bfebda3c

Best regards,

Signature · 1 line
Leo Yan <[email protected]>
#1 lore raw
Quoted 17 lines · Leo Yan

The perf static build reports that the BPF skeleton is disabled due to the missing libopenssl feature.

Explicitly linking the libraries fixes the static build failure.

Fixes 7678523109d1 ("tools/build: Add a feature test for libopenssl")
---
 tools/build/feature/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/feature/Makefile +0 -0
index 1fbcb3ce74d2173072748a417fc63bd9a5b13888..18a9abf6bfc43e86ecf58b96e0374a0e3c613bb0 100644

tools/build/feature/Makefile $(OUTPUT)test-libpfm4.bin: · line 387

Quoted 5 lines
tools/build/feature/Makefile +1 -1
@@ -384,7 +384,7 @@ $(OUTPUT)test-libpfm4.bin:
        $(BUILD) -lpfm
 
 $(OUTPUT)test-libopenssl.bin:
-       $(BUILD) -lssl
+       $(BUILD) -lssl -lcrypto -lz -lzstd

I wonder it would be better to do something like test-gtk2.bin so that if openssl wasn't compiled with libz and libzstd things don't fail:

```
$(OUTPUT)test-gtk2.bin:
       $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0
2>/dev/null) -Wno-deprecated-declarations
```
so:
```
$(OUTPUT)test-openssl.bin:
       $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags openssl 2>/dev/null)
```

Since "-lssl" is a dependency of BUILD_ALL, that will probably also need updating.

Thanks,
Ian

Quoted 12 lines
tools/build/feature/Makefile +0 -1
 $(OUTPUT)test-bpftool-skeletons.bin:
        $(SYSTEM_BPFTOOL) version | grep '^features:.*skeletons' \
 
---

base-commit: bb551508e78c886e6d3bcca6c744d3bc3fd8ad59
change-id: 20260317-tools_fix_build_libopenssl-8290bfebda3c

Best regards,
--
Leo Yan <[email protected]>

author
#2 lore raw
Quoted 36 lines · Ian Rogers
Quoted 17 lines · Leo Yan

The perf static build reports that the BPF skeleton is disabled due to the missing libopenssl feature.

Explicitly linking the libraries fixes the static build failure.

Fixes 7678523109d1 ("tools/build: Add a feature test for libopenssl")
---
 tools/build/feature/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/build/feature/Makefile +0 -0
index 1fbcb3ce74d2173072748a417fc63bd9a5b13888..18a9abf6bfc43e86ecf58b96e0374a0e3c613bb0 100644

tools/build/feature/Makefile $(OUTPUT)test-libpfm4.bin: · line 387

Quoted 5 lines
tools/build/feature/Makefile +1 -1
@@ -384,7 +384,7 @@ $(OUTPUT)test-libpfm4.bin:
        $(BUILD) -lpfm
 
 $(OUTPUT)test-libopenssl.bin:
-       $(BUILD) -lssl
+       $(BUILD) -lssl -lcrypto -lz -lzstd

I wonder it would be better to do something like test-gtk2.bin so that if openssl wasn't compiled with libz and libzstd things don't fail:

```
$(OUTPUT)test-gtk2.bin:
       $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags gtk+-2.0
2>/dev/null) -Wno-deprecated-declarations
```
so:
```
$(OUTPUT)test-openssl.bin:
       $(BUILD) $(shell $(PKG_CONFIG) --libs --cflags openssl 2>/dev/null)
```
Quoted 2 lines

Since "-lssl" is a dependency of BUILD_ALL, that will probably also need updating.

Thanks for suggestion, I have sent out v3.

Just record for another issue:

I was not able to build test-all.bin successfully with static linking until explicitly added -lexpat. Seems some Python extension libraries depends on libexpat, but python3-config doesn't include this dependency.

This would be a wider issue - as this is not limited to feature build,
we also need to fix perf's build as well? I might look into details
when have free time.

Thanks,
Leo