* [Buildroot] [PATCH 1/1 v2] package/libssh: fix build failure
@ 2024-09-15 10:36 Thomas Perale via buildroot
2024-09-15 10:54 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Thomas Perale via buildroot @ 2024-09-15 10:36 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Perale
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/
- ...
Signed-off-by: Thomas Perale <thomas.perale@mind.be>
---
...enable-CXX-when-running-the-coverage.patch | 56 +++++++++++++++++++
1 file changed, 56 insertions(+)
create mode 100644 package/libssh/0001-cmake-Only-enable-CXX-when-running-the-coverage.patch
diff --git a/package/libssh/0001-cmake-Only-enable-CXX-when-running-the-coverage.patch b/package/libssh/0001-cmake-Only-enable-CXX-when-running-the-coverage.patch
new file mode 100644
index 0000000000..e70c0fa44e
--- /dev/null
+++ b/package/libssh/0001-cmake-Only-enable-CXX-when-running-the-coverage.patch
@@ -0,0 +1,56 @@
+From 328ae3d2306c9f65b5e85a2be98a368c07287a05 Mon Sep 17 00:00:00 2001
+From: Thomas Perale <thomas.perale@mind.be>
+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 <thomas.perale@mind.be>
+---
+ CMakeLists.txt | 3 ++-
+ cmake/Modules/AddCMockaTest.cmake | 1 +
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 13330ea3..5595a47a 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.1 LANGUAGES C CXX)
++project(libssh VERSION 0.11.1 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
+
--
2.46.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH 1/1 v2] package/libssh: fix build failure
2024-09-15 10:36 [Buildroot] [PATCH 1/1 v2] package/libssh: fix build failure Thomas Perale via buildroot
@ 2024-09-15 10:54 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-09-15 10:54 UTC (permalink / raw)
To: Thomas Perale via buildroot; +Cc: Thomas Perale
On Sun, 15 Sep 2024 12:36:29 +0200
Thomas Perale via buildroot <buildroot@buildroot.org> wrote:
> diff --git a/package/libssh/0001-cmake-Only-enable-CXX-when-running-the-coverage.patch b/package/libssh/0001-cmake-Only-enable-CXX-when-running-the-coverage.patch
> new file mode 100644
> index 0000000000..e70c0fa44e
> --- /dev/null
> +++ b/package/libssh/0001-cmake-Only-enable-CXX-when-running-the-coverage.patch
> @@ -0,0 +1,56 @@
> +From 328ae3d2306c9f65b5e85a2be98a368c07287a05 Mon Sep 17 00:00:00 2001
> +From: Thomas Perale <thomas.perale@mind.be>
> +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 <thomas.perale@mind.be>
Then it was missing the Upstream: tag this time around, causing a
"check-package" issue. I fixed that up, and applied. You may want to
add https://paste.ack.tf/f908e5 as your .git/hooks/post-commit to get
nice check-package checking integrated in your Git workflow.
Thanks a lot for providing this fix!
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-09-15 10:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-15 10:36 [Buildroot] [PATCH 1/1 v2] package/libssh: fix build failure Thomas Perale via buildroot
2024-09-15 10:54 ` Thomas Petazzoni via buildroot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.