package/libssh: fix build failure
PATCH 1/1 package/libssh: fix build failure
When compiling libssh without a C++ cross-compiler the build will fail.
This patch remove the CMake C++ dependency to build libssh. That dependency is only used for the code coverage tool and is not required to build the library.
Fixes:
- http://autobuild.buildroot.org/results/927/92794da6346b856ad74f14f87cc51415871cb5d2/
- http://autobuild.buildroot.org/results/89d/89dcd4982e4061732de635f9e7669db1f257330c/
- http://autobuild.buildroot.org/results/b3f/b3feff5c21defb53c65a3d5d06b13230cfed3317/
- http://autobuild.buildroot.org/results/bc8/bc8338d2c61eaa7c98c99140de5c491b7528c4f3/
- ...
--- ...enable-CXX-when-running-the-coverage.patch | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 package/libssh/0001-cmake-Only-enable-CXX-when-running-the-coverage.patch
package/libssh/0001-cmake-Only-enable-CXX-when-running-the-coverage.patch new file +57 -0
@@ -0,0 +1,57 @@ +From 35982f76cdc2b51ac1ac875052cd4351c6ef5211 Mon Sep 17 00:00:00 2001 +From: Thomas Perale <[email protected]> +Date: Sat, 14 Sep 2024 21:07:30 +0200 +Subject: [PATCH] cmake: Only enable CXX when running the coverage + +Commit 25a678190c42b24076fdd805a8d7a722a8a9c798 introduced code coverage +collection. That also introduced a dependency to CXX language. + +When cross-compiling libssh in an environment that doesn't have a C++ compiler +the following error is raised: "No CMAKE_CXX_COMPILER could be found.". + +Since the C++ part is only needed for the coverage part, this commit only enable +that language dependency when actually needing it. + +Signed-off-by: Thomas Perale <[email protected]> +Upstream: https://gitlab.com/libssh/libssh-mirror/-/merge_requests/537 +--- + CMakeLists.txt | 3 ++- + cmake/Modules/AddCMockaTest.cmake | 1 + + 2 files changed, 3 insertions(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a366ed4b..d484bdfa 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,7 +9,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules") + include(DefineCMakeDefaults) + include(DefineCompilerFlags) + +-project(libssh VERSION 0.11.00 LANGUAGES C CXX) ++project(libssh VERSION 0.11.00 LANGUAGES C) + + # global needed variable + set(APPLICATION_NAME ${PROJECT_NAME}) +@@ -190,6 +190,7 @@ endif (WITH_SYMBOL_VERSIONING AND ABIMAP_FOUND) + + # Coverage + if (WITH_COVERAGE) ++ ENABLE_LANGUAGE(CXX) + include(CodeCoverage) + setup_target_for_coverage_lcov( + NAME "coverage" +diff --git a/cmake/Modules/AddCMockaTest.cmake b/cmake/Modules/AddCMockaTest.cmake +index 79178183..f49961ba 100644 +--- a/cmake/Modules/AddCMockaTest.cmake ++++ b/cmake/Modules/AddCMockaTest.cmake +@@ -117,6 +117,7 @@ function(ADD_CMOCKA_TEST _TARGET_NAME) + ${TARGET_SYSTEM_EMULATOR} ${_TARGET_NAME} + ) + if (WITH_COVERAGE) ++ ENABLE_LANGUAGE(CXX) + include(CodeCoverage) + append_coverage_compiler_flags_to_target(${_TARGET_NAME}) + endif (WITH_COVERAGE) +-- +2.46.0 +
Signature · 6 lines
2.46.0 _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot
Quoted 13 lines · On Sun, 15 Sep 2024 11:30:48 +0200 Thomas Perale via buildroot…
When compiling libssh without a C++ cross-compiler the build will fail.
This patch remove the CMake C++ dependency to build libssh. That dependency is only used for the code coverage tool and is not required to build the library.
Fixes:
- http://autobuild.buildroot.org/results/927/92794da6346b856ad74f14f87cc51415871cb5d2/
- http://autobuild.buildroot.org/results/89d/89dcd4982e4061732de635f9e7669db1f257330c/
- http://autobuild.buildroot.org/results/b3f/b3feff5c21defb53c65a3d5d06b13230cfed3317/
- http://autobuild.buildroot.org/results/bc8/bc8338d2c61eaa7c98c99140de5c491b7528c4f3/
- ...
Quoted 5 lines
Signed-off-by Thomas Perale <[email protected]>--- ...enable-CXX-when-running-the-coverage.patch | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 package/libssh/0001-cmake-Only-enable-CXX-when-running-the-coverage.patch
Thanks a lot, but once applied your patch doesn't apply to the libssh code base:
Quoted 1 line
Quoted 1 line
Quoted 1 line
libssh 0.11.1 Patching
Applying 0001-cmake-Only-enable-CXX-when-running-the-coverage.patch using patch:
patching file CMakeLists.txt
Hunk #1 FAILED at 9.
1 out of 2 hunks FAILED -- saving rejects to file CMakeLists.txt.rej
patching file cmake/Modules/AddCMockaTest.cmake
make: *** [package/pkg-generic.mk:247: /home/thomas/projets/buildroot/output/build/libssh-0.11.1/.stamp_patched] Error 1
Maybe you did your patch against libssh master, and forgot to rebase it on top of 0.11.1 before adding it in Buildroot?
Thomas
Signature · 7 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com _______________________________________________ buildroot mailing list [email protected] https://lists.buildroot.org/mailman/listinfo/buildroot