summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-libcamera-Do-not-assume-libc-with-clang.patch68
-rw-r--r--meta-multimedia/recipes-multimedia/libcamera/libcamera_0.5.2.bb1
2 files changed, 69 insertions, 0 deletions
diff --git a/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-libcamera-Do-not-assume-libc-with-clang.patch b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-libcamera-Do-not-assume-libc-with-clang.patch
new file mode 100644
index 0000000000..7495205041
--- /dev/null
+++ b/meta-multimedia/recipes-multimedia/libcamera/libcamera/0001-libcamera-Do-not-assume-libc-with-clang.patch
@@ -0,0 +1,68 @@
1From 82e9d391d312d65e7a62252e9e153b93c06ad37b Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com>
3Date: Fri, 24 Oct 2025 11:10:59 -0700
4Subject: [PATCH] libcamera: Do not assume libc++ with clang
5
6Clang on linux can be defaulting to use libstdc++, it
7should be using default platform C++ runtime library which the
8toolchain should be configured to do the right thing
9
10Add logic in meson file to detect C++ runtime used by toolchain
11and defile -stdlib= parameter accordingly
12
13Upstream-Status: Submitted [https://lists.libcamera.org/pipermail/libcamera-devel/2025-October/054151.html]
14Signed-off-by: Khem Raj <raj.khem@gmail.com>
15---
16 meson.build | 32 +++++++++++++++++++++-----------
17 1 file changed, 21 insertions(+), 11 deletions(-)
18
19diff --git a/meson.build b/meson.build
20index fd508fd7..5707f850 100644
21--- a/meson.build
22+++ b/meson.build
23@@ -118,7 +118,24 @@ cpp_arguments = [
24 '-Wnon-virtual-dtor',
25 ]
26
27-cxx_stdlib = 'libstdc++'
28+# Try to detect libc++
29+libcxx_ver = cxx.get_define('_LIBCPP_VERSION',
30+ prefix: '#include <vector>\n')
31+
32+# Try to detect libstdc++
33+glibcxx_ver = cxx.get_define('__GLIBCXX__',
34+ prefix: '#include <vector>\n')
35+
36+stdlib_msg = 'unknown'
37+
38+if libcxx_ver != ''
39+ cxx_stdlib = 'libc++'
40+elif glibcxx_ver != ''
41+ # __GLIBCXX__ is usually a yyyymmdd date code
42+ cxx_stdlib = 'libstdc++'
43+endif
44+
45+message('Detected C++ standard library: ' + cxx_stdlib)
46
47 if cc.get_id() == 'clang'
48 if cc.version().version_compare('<9')
49@@ -138,16 +155,9 @@ if cc.get_id() == 'clang'
50 ]
51 endif
52 endif
53-
54- # Use libc++ by default if available instead of libstdc++ when compiling
55- # with clang.
56- if cc.find_library('c++', required : false).found()
57- cpp_arguments += [
58- '-stdlib=libc++',
59- ]
60- cxx_stdlib = 'libc++'
61- endif
62-
63+ cpp_arguments += [
64+ '-stdlib=' + cxx_stdlib,
65+ ]
66 cpp_arguments += [
67 '-Wextra-semi',
68 '-Wthread-safety',
diff --git a/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.5.2.bb b/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.5.2.bb
index 88fe9cf39c..8b8d6815c5 100644
--- a/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.5.2.bb
+++ b/meta-multimedia/recipes-multimedia/libcamera/libcamera_0.5.2.bb
@@ -10,6 +10,7 @@ LIC_FILES_CHKSUM = "\
10 10
11SRC_URI = " \ 11SRC_URI = " \
12 git://git.libcamera.org/libcamera/libcamera.git;protocol=https;branch=master;tag=v${PV} \ 12 git://git.libcamera.org/libcamera/libcamera.git;protocol=https;branch=master;tag=v${PV} \
13 file://0001-libcamera-Do-not-assume-libc-with-clang.patch \
13" 14"
14 15
15SRCREV = "096c50ca881f72d858aca19757a5e73b4775a7cc" 16SRCREV = "096c50ca881f72d858aca19757a5e73b4775a7cc"