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 @@ +From 82e9d391d312d65e7a62252e9e153b93c06ad37b Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Fri, 24 Oct 2025 11:10:59 -0700 +Subject: [PATCH] libcamera: Do not assume libc++ with clang + +Clang on linux can be defaulting to use libstdc++, it +should be using default platform C++ runtime library which the +toolchain should be configured to do the right thing + +Add logic in meson file to detect C++ runtime used by toolchain +and defile -stdlib= parameter accordingly + +Upstream-Status: Submitted [https://lists.libcamera.org/pipermail/libcamera-devel/2025-October/054151.html] +Signed-off-by: Khem Raj +--- + meson.build | 32 +++++++++++++++++++++----------- + 1 file changed, 21 insertions(+), 11 deletions(-) + +diff --git a/meson.build b/meson.build +index fd508fd7..5707f850 100644 +--- a/meson.build ++++ b/meson.build +@@ -118,7 +118,24 @@ cpp_arguments = [ + '-Wnon-virtual-dtor', + ] + +-cxx_stdlib = 'libstdc++' ++# Try to detect libc++ ++libcxx_ver = cxx.get_define('_LIBCPP_VERSION', ++ prefix: '#include \n') ++ ++# Try to detect libstdc++ ++glibcxx_ver = cxx.get_define('__GLIBCXX__', ++ prefix: '#include \n') ++ ++stdlib_msg = 'unknown' ++ ++if libcxx_ver != '' ++ cxx_stdlib = 'libc++' ++elif glibcxx_ver != '' ++ # __GLIBCXX__ is usually a yyyymmdd date code ++ cxx_stdlib = 'libstdc++' ++endif ++ ++message('Detected C++ standard library: ' + cxx_stdlib) + + if cc.get_id() == 'clang' + if cc.version().version_compare('<9') +@@ -138,16 +155,9 @@ if cc.get_id() == 'clang' + ] + endif + endif +- +- # Use libc++ by default if available instead of libstdc++ when compiling +- # with clang. +- if cc.find_library('c++', required : false).found() +- cpp_arguments += [ +- '-stdlib=libc++', +- ] +- cxx_stdlib = 'libc++' +- endif +- ++ cpp_arguments += [ ++ '-stdlib=' + cxx_stdlib, ++ ] + cpp_arguments += [ + '-Wextra-semi', + '-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 = "\ SRC_URI = " \ git://git.libcamera.org/libcamera/libcamera.git;protocol=https;branch=master;tag=v${PV} \ + file://0001-libcamera-Do-not-assume-libc-with-clang.patch \ " SRCREV = "096c50ca881f72d858aca19757a5e73b4775a7cc"