[Buildroot] [git commit] package/libgpiod2: fix build failure on missing C++ compiler

Julien Olivain via buildroot <[email protected]>
Newsgroups net.busybox.buildroot
Message-ID <[email protected]>
commit: https://gitlab.com/buildroot.org/buildroot/-/commit/c3f3705a2fd27206cf2e79fd802b681e77be2cfe
branch: https://gitlab.com/buildroot.org/buildroot/-/tree/master

The meson build configuration of libgpiod2 unconditionally requires a
C++ compiler, although it is only useful if building the C++ bindings.
This is causing autobuild failures with an obscure error message:
"ERROR: Unable to get gcc pre-processor defines".

Fix the failures by only requiring a C++ compiler when we want the C++
bindings.

Fixes:
 - https://autobuild.buildroot.org/results/d1c19ffa0c599bd2ba9be965a98fc8f778d6e366
 - https://autobuild.buildroot.org/results/c6b3c9311d628bdb4ea103431767493fab9a3668
 - https://autobuild.buildroot.org/results/8e799050c5779c680ff5e5136571f57d29239f2f
 - https://autobuild.buildroot.org/results/d6d8833acfe00559579defbbf3ca34c0edbe7869

Signed-off-by: Edgar Bonet <[email protected]>
Signed-off-by: Julien Olivain <[email protected]>
---
 ...t-require-a-C-compiler-if-it-is-not-neede.patch | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/package/libgpiod2/0001-build-do-not-require-a-C-compiler-if-it-is-not-neede.patch b/package/libgpiod2/0001-build-do-not-require-a-C-compiler-if-it-is-not-neede.patch
new file mode 100644
index 0000000000..ccc4430a8c
--- /dev/null
+++ b/package/libgpiod2/0001-build-do-not-require-a-C-compiler-if-it-is-not-neede.patch
@@ -0,0 +1,46 @@
+From fce6b611e2530602c44fd914222529028173c509 Mon Sep 17 00:00:00 2001
+From: Edgar Bonet <[email protected]>
+Date: Wed, 19 Aug 2026 18:15:25 +0200
+Subject: [PATCH] build: do not require a C++ compiler if it is not needed
+
+Languages specified in the meson project() function are considered hard
+dependencies. When trying to build libgpiod in an environment lacking a
+C++ compiler, the build fails with an obscure error message ("ERROR:
+Unable to get gcc pre-processor defines").
+
+As the C++ compiler is only needed for building the C++ bindings, do not
+require it unless the option bindings-cxx is enabled.
+
+Signed-off-by: Edgar Bonet <[email protected]>
+Upstream: https://lore.kernel.org/linux-gpio/[email protected]/
+---
+ meson.build | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index c030b50..fed612f 100644
+--- a/meson.build
++++ b/meson.build
+@@ -1,7 +1,7 @@
+ # SPDX-License-Identifier: GPL-2.0-or-later
+ # SPDX-FileCopyrightText: 2026 Qualcomm Technologies, Inc. and/or its subsidiaries
+ 
+-project('libgpiod', ['c', 'cpp'],
++project('libgpiod', 'c',
+   version: '2.3.1',
+   license: 'LGPL-2.1-or-later',
+   default_options: [
+@@ -56,6 +56,10 @@ opt_dbus                = get_option('dbus')
+ opt_introspection       = get_option('introspection')
+ opt_systemd             = get_option('systemd')
+ 
++if opt_bindings_cxx.allowed()
++  add_languages('cpp')
++endif
++
+ if get_option('profiling')
+   profiling_c_args    = ['-fprofile-arcs', '-ftest-coverage']
+   profiling_link_args = ['-lgcov']
+-- 
+2.43.0
+
_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.