Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] Build host-cmake with OpenSSL?
@ 2026-10-05 15:27 Michael Ratzel
  2026-10-06 14:34 ` Thomas Petazzoni via buildroot
  2026-10-13 20:59 ` Thomas Perale via buildroot
  0 siblings, 2 replies; 3+ messages in thread
From: Michael Ratzel @ 2026-10-05 15:27 UTC (permalink / raw)
  To: buildroot@buildroot.org

Hi everyone,

I recently ran into an issue where I wanted to build a 3rd party library as a target-package with buildroot 2026.08. The libraries build system uses the file(DOWNLOAD ...) CMake command with a https URL. But the host-cmake is built with OpenSSL support explicitly deactivated since 2017 (commit f87138339b17bc2b1d84c59ea176abb941413550). Therefore, the downloading fails. Fun fact: with buildroot 2025.02 and its older CMake version, the download still works.

Now I am not quite sure how to proceed.
- My first approach was to plainly revert the 2017 commit. This solves my download problem, but I do not think this is a good way, as there was a valid reason OpenSSL was deactivated in the first place.
- Patching the build system of the library. Afaik this is not a simple patch and has to be redone for every package. Simple and hacky things, like trying to tell CMake to ignore the encryption, by passing TLS_VERIFY OFF to the file() call, or by altering the download URL from https to https, did not work for me. Me next step in this direction would be to replace the file(DOWNLOAD ...) with a script, that downloads and decompresses the files with tools like wget and xz.
- Adding some sort of configuration option to let the user decide if they want to build host-cmake with or without OpenSSL. I looked for a few hours on how to do that properly. I add a patch with a suggestion to this mail, but I do not think this will be the final solution. Maybe it would be even better to add some sort of host-openssl as a dependency of host-cmake?

I personally believe it will be beneficial to allow host-cmake to download from https sources in some way. What do you think is the correct way forward? I am willing to invest time into implementing a solution for this, but I will require some guidance, or even better an example of a similar solution, to be able to help efficiently.

Best regards

Michael Ratzel

diff --git a/package/cmake/Config.in.host b/package/cmake/Config.in.host
index b8221a7d22..b2900ee6e3 100644
--- a/package/cmake/Config.in.host
+++ b/package/cmake/Config.in.host
@@ -10,6 +10,14 @@ config BR2_PACKAGE_HOST_CMAKE
 
          http://www.cmake.org/
 
+if BR2_PACKAGE_HOST_CMAKE
+config BR2_PACKAGE_HOST_CMAKE_USE_OPENSSL
+       bool "use openssl
+       help
+         Host CMake will be build with OpenSSL support active. To allow downloading from https sources.
+
+endif
+
 # The minimum system cmake version we expect if 3.18 as provided by
 # Debian bullseye, that we use in our reference build docker image.
 config BR2_HOST_CMAKE_AT_LEAST_3_19
diff --git a/package/cmake/cmake.mk b/package/cmake/cmake.mk
index 007a1efa0b..3f769782c4 100644
--- a/package/cmake/cmake.mk
+++ b/package/cmake/cmake.mk
@@ -50,6 +50,12 @@ HOST_CMAKE_CONFIGURE_OPTS = \
        GCC="$(HOSTCC_NOCCACHE)" \
        CXX="$(HOSTCXX_NOCCACHE)"
 
+ifeq ($(BR2_PACKAGE_HOST_CMAKE_USE_OPENSSL),y)
+HOST_CMAKE_USE_OPENSSL = ON
+else
+HOST_CMAKE_USE_OPENSSL = OFF
+endif
+
 define HOST_CMAKE_CONFIGURE_CMDS
        (cd $(@D); \
                $(HOST_CMAKE_CONFIGURE_OPTS) \
@@ -59,7 +65,7 @@ define HOST_CMAKE_CONFIGURE_CMDS
                        -DCMAKE_C_FLAGS="$(HOST_CMAKE_CFLAGS)" \
                        -DCMAKE_CXX_FLAGS="$(HOST_CMAKE_CXXFLAGS)" \
                        -DCMAKE_EXE_LINKER_FLAGS="$(HOST_LDFLAGS)" \
-                       -DCMAKE_USE_OPENSSL:BOOL=OFF \
+                       -DCMAKE_USE_OPENSSL:BOOL=$(HOST_CMAKE_USE_OPENSSL) \
                        -DBUILD_CursesDialog=OFF \
        )
 endef
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-13 20:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-05 15:27 [Buildroot] Build host-cmake with OpenSSL? Michael Ratzel
2026-10-06 14:34 ` Thomas Petazzoni via buildroot
2026-10-13 20:59 ` Thomas Perale via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox