Skip to contentSkip to conversation

extract-cert: detect and warn if libssl is missing

PATCH New Jesse Chan 1 participant 1 message Nov 20, 2017 Kbuild

lore
Share & tools
lore

Jesse Chan

author
#0 lore raw

PATCH 1/1 extract-cert: detect and warn if libssl is missing

With CONFIG_SYSTEM_TRUSTED_KEYRING enabled, if the host system doesn't have a development version of libssl installed, the build fails with errors like:

extract-cert.c: fatal error: openssl/bio.h: No such file or directory

In this case, prompt to install libssl-dev(el).

---
 scripts/Makefile | 8 ++++++++
 1 file changed, 8 insertions(+)
scripts/Makefile +8 -0
index 25ab143cbe14..6c75a32aae12 100644
@@ -35,6 +35,14 @@ PHONY += build_unifdef
 build_unifdef: $(obj)/unifdef
 	@:
 
+ifdef CONFIG_SYSTEM_TRUSTED_KEYRING
+  has_libssl := $(call try-run,\
+		echo "int main() {}" | $(HOSTCC) -xc -o /dev/null -lssl -,1,0)
+  ifneq ($(has_libssl),1)
+    $(error "Cannot use CONFIG_SYSTEM_TRUSTED_KEYRING=y, please install libssl-dev or libssl-devel")
+  endif
+endif
+
 subdir-$(CONFIG_MODVERSIONS) += genksyms
 subdir-y                     += mod
 subdir-$(CONFIG_SECURITY_SELINUX) += selinux
Signature · 1 line
2.14.1