diff mbox series

[meta-oe] libwebsockets: use native sysroot's ssl config

Message ID 20260102063835.2614628-1-twoerner@gmail.com
State New
Headers show
Series [meta-oe] libwebsockets: use native sysroot's ssl config | expand

Commit Message

Trevor Woerner Jan. 2, 2026, 6:38 a.m. UTC
During the compile step, CMake will attempt to generate a test
certificate with openssl-native using a hard-coded path to the openssl
config:

	openssl req -config /etc/ssl/openssl.cnf ...

Thus using the build host's openssl config. If the build host's openssl
is configured with options that openssl-native does not understand or
accept, the test certificate will not be generated:

[log.do_configure on openSUSE 16.0]
	Searching for OpenSSL executable and dlls
	OpenSSL executable: .../build/tmp/work/cortexa53-crypto-oe-linux/libwebsockets/4.5.2/recipe-sysroot-native/usr/bin/openssl
	 GENCERTS = 1
	Generating SSL Certificates for the test-server...
	Error configuring OpenSSL modules
	4037413D467F0000:error:030000A9:digital envelope routines:alg_module_init:unknown option:../sources/openssl-3.5.4/crypto/evp/evp_cnf.c:61:name=rh-allow-sha1-signatures, value=yes
	4037413D467F0000:error:0700006D:configuration file routines:module_run:module initialization error:../sources/openssl-3.5.4/crypto/conf/conf_mod.c:288:module=alg_section, value=evp_properties retcode=-1
	CMake Warning at lib/tls/CMakeLists.txt:528 (message):
	  !!! Failed to generate SSL certificate for Test Server!!!:

	  OpenSSL return code = 1

and the subsequent do_install() step will fail:

	| CMake Error at test-apps/cmake_install.cmake:126 (file):
	|   file INSTALL cannot find
	|   ".../build/tmp/work/cortexa53-crypto-oe-linux/libwebsockets/4.5.2/build/libwebsockets-test-server.key.pem":
	|   No such file or directory.

	ERROR: Task (.../layers/meta-openembedded/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.5.2.bb:do_install) failed with exit code '1'

Fix the location where CMake looks for the openssl.cnf file in order
to use the one that comes with the openssl-native that will be used to
generate the certificate. Thus ensuring that they are in step in terms
of which configuration options will be acceptable.

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
---
 .../recipes-connectivity/libwebsockets/libwebsockets_4.5.2.bb | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.5.2.bb b/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.5.2.bb
index 19ac6be8eb41..35545aacee95 100644
--- a/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.5.2.bb
+++ b/meta-oe/recipes-connectivity/libwebsockets/libwebsockets_4.5.2.bb
@@ -36,6 +36,10 @@  EXTRA_OECMAKE += " \
     -DLIB_SUFFIX=${@d.getVar('baselib').replace('lib', '')} \
 "
 
+do_compile:prepend() {
+    sed -i -e 's|/etc/ssl|${RECIPE_SYSROOT_NATIVE}/etc/ssl|g' ${S}/lib/tls/CMakeLists.txt
+}
+
 do_install:append() {
     sed -i -e 's|${STAGING_LIBDIR}/libcrypto.so|crypto|g' ${D}${libdir}/cmake/libwebsockets/LibwebsocketsTargets.cmake
     sed -i -e 's|${STAGING_LIBDIR}/libssl.so|ssl|g' ${D}${libdir}/cmake/libwebsockets/LibwebsocketsTargets.cmake