{"id":24811,"url":"https://patchwork.libcamera.org/api/1.1/patches/24811/?format=json","web_url":"https://patchwork.libcamera.org/patch/24811/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251024184009.740860-1-raj.khem@gmail.com>","date":"2025-10-24T18:40:09","name":"libcamera: Do not assume libc++ with clang","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"0df5687dc4702703093e436c90562458ff74c6bc","submitter":{"id":62,"url":"https://patchwork.libcamera.org/api/1.1/people/62/?format=json","name":"Khem Raj","email":"raj.khem@gmail.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24811/mbox/","series":[{"id":5528,"url":"https://patchwork.libcamera.org/api/1.1/series/5528/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5528","date":"2025-10-24T18:40:09","name":"libcamera: Do not assume libc++ with clang","version":1,"mbox":"https://patchwork.libcamera.org/series/5528/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24811/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24811/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 3A3CEC3259\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 24 Oct 2025 18:40:18 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6A399609D6;\n\tFri, 24 Oct 2025 20:40:17 +0200 (CEST)","from mail-pl1-x633.google.com (mail-pl1-x633.google.com\n\t[IPv6:2607:f8b0:4864:20::633])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BBD3660990\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Oct 2025 20:40:15 +0200 (CEST)","by mail-pl1-x633.google.com with SMTP id\n\td9443c01a7336-26e68904f0eso26173675ad.0\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 24 Oct 2025 11:40:15 -0700 (PDT)","from apollo.tail3ccdd3.ts.net ([2601:646:8201:fd20::9dbe])\n\tby smtp.gmail.com with ESMTPSA id\n\td9443c01a7336-2946dfc0efasm64252465ad.76.2025.10.24.11.40.11\n\t(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n\tFri, 24 Oct 2025 11:40:12 -0700 (PDT)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (2048-bit key;\n\tunprotected) header.d=gmail.com header.i=@gmail.com\n\theader.b=\"SjsfKW71\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=gmail.com; s=20230601; t=1761331213; x=1761936013;\n\tdarn=lists.libcamera.org; \n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:from:to:cc:subject:date:message-id:reply-to;\n\tbh=ldfAsdlkZww7l/enbDOLUsSnB1Gy3NYIfZ3fgYJ1d3Q=;\n\tb=SjsfKW710N0NjNDsIBPffLLBgzhdZ/HfctEm+bkfVpfTv95Ap1h7lOqZJbQVGbDBOZ\n\t0DuIc863DOMJZghlzY2rfVwSXdk3DjgiEH5pBAlfEIrKx3CwfM/n5yKadkIWM2trG6A5\n\tFuVkjqx70dEiY+2teln0AX2jptRk50SUx5Yye3LavoKCdVniPb0AigwNTYfIsSAFUCA7\n\tA3tL8o79f6Oaw9+9E0Ib7CbhN7vVqYmYDiTcEJ6cku2lWjknyKclRPclcONDd3i9GQYr\n\t8Od7BEbgLn+Nt1ADMXY9LWaKSRKnOkh26i7XrAGdYnNXlY9PyduWxfaKdfCNphJL9hYx\n\tCV8w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20230601; t=1761331213; x=1761936013;\n\th=content-transfer-encoding:mime-version:message-id:date:subject:cc\n\t:to:from:x-gm-message-state:from:to:cc:subject:date:message-id\n\t:reply-to;\n\tbh=ldfAsdlkZww7l/enbDOLUsSnB1Gy3NYIfZ3fgYJ1d3Q=;\n\tb=mXzw+mzE4MndacRoTrA847Orf7W0AJ/jDs8fVA72rn8gIVB9MbBWHL5uTDtfSG4+AE\n\tmibc5M2zhHLwUbBu0rPuakVe5GOelK/bUzVpYQFUno9ai84/J7vu6yWDyag1itL49ka6\n\twF4Ih1gkfLU+watkZyM//zAyJf3HKc87kvz1vNvot3ZKtIV84PPfv7TW6w8OnSHDxGvv\n\tTprlbNNPTQOvFVv/LV4YdpBOf3AuNhMJukjHyuKr8GhjSbwsKNoFBxZAT+0vHGVuNoK0\n\tbCqxkeim8hxyySi41BzKHNhSaojdCnraDSii7pnRfDENeWGLhvwbvhZSamtkAoFihHT5\n\tdvAA==","X-Gm-Message-State":"AOJu0Ywfybq/yra3FKSWZ53vQNgn9I+nrrMiQJm4zajLtj33u5kCdVBQ\n\tamFm4sBOUYxe1g+GBLUr+UCzU3f47EiTDM+a4quoreo4EnzlTup8IjgqVROBqpM7","X-Gm-Gg":"ASbGncveD8ILBb7ZFFCx7mNDdCZp4URcU6CLgAe48SpYRaVSp67Fdq+V41uzRQGD2ZP\n\teII68dAMe5yELUhUedThGsC73kKeEVvNSCscetMFDQ8F37eakGn2bpiVX2Dy8reL8PX+8uz+HMx\n\t294x95Hcpuu/E+sW0vUDL1u7HnrHDfI3aHkj9BfADQSs4KQJK/Wbg6hoLu2FzUuAQWr+tZnJkAp\n\tvO+5pn3uoNLZGWecZvtC/pxTzladP05pVuhcAzPaMfcNer/f+bB06kTixHx9IBW/ahVg1+YVhGr\n\tOekb1Z537d1atP1GMY50+JdKkpKEVOJMt1i7FTR7zyv9TmCfcXIq3wYHv74NuHL0GIPiO/ZevmP\n\tQMS02K9mZM8EhrbfsVTGVnM+YSroZhUoOG7jv+U2pFoXFNBn5ZRHGACu6mwXDK/9Fe/FgrP/4+/\n\tzetkdorS+IWdHk0w0pcxI4bge7H+tftgAwe6fRKSKdDQak/AP9dIt7c6j6aacMDA==","X-Google-Smtp-Source":"AGHT+IH2Y6sSGGPWTF+Q96o2uAV5+mxqekyxnKzo1AdCmLiWZDSCw5IothkW+wfOhNg+FUNO0S0iSA==","X-Received":"by 2002:a17:903:2309:b0:262:79a:93fb with SMTP id\n\td9443c01a7336-290ca121803mr393380165ad.32.1761331213241; \n\tFri, 24 Oct 2025 11:40:13 -0700 (PDT)","From":"Khem Raj <raj.khem@gmail.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Khem Raj <raj.khem@gmail.com>","Subject":"[PATCH] libcamera: Do not assume libc++ with clang","Date":"Fri, 24 Oct 2025 11:40:09 -0700","Message-ID":"<20251024184009.740860-1-raj.khem@gmail.com>","X-Mailer":"git-send-email 2.51.1","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"Clang on linux can be defaulting to use libstdc++, it\nshould be using default platform C++ runtime library which the\ntoolchain should be configured to do the right thing\n\nAdd logic in meson file to detect C++ runtime used by toolchain\nand defile -stdlib= parameter accordingly\n\nSigned-off-by: Khem Raj <raj.khem@gmail.com>\n---\n meson.build | 32 +++++++++++++++++++++-----------\n 1 file changed, 21 insertions(+), 11 deletions(-)","diff":"diff --git a/meson.build b/meson.build\nindex fd508fd7..5707f850 100644\n--- a/meson.build\n+++ b/meson.build\n@@ -118,7 +118,24 @@ cpp_arguments = [\n     '-Wnon-virtual-dtor',\n ]\n \n-cxx_stdlib = 'libstdc++'\n+# Try to detect libc++\n+libcxx_ver = cxx.get_define('_LIBCPP_VERSION',\n+  prefix: '#include <vector>\\n')\n+\n+# Try to detect libstdc++\n+glibcxx_ver = cxx.get_define('__GLIBCXX__',\n+  prefix: '#include <vector>\\n')\n+\n+stdlib_msg = 'unknown'\n+\n+if libcxx_ver != ''\n+  cxx_stdlib = 'libc++'\n+elif glibcxx_ver != ''\n+  # __GLIBCXX__ is usually a yyyymmdd date code\n+  cxx_stdlib = 'libstdc++'\n+endif\n+\n+message('Detected C++ standard library: ' + cxx_stdlib)\n \n if cc.get_id() == 'clang'\n     if cc.version().version_compare('<9')\n@@ -138,16 +155,9 @@ if cc.get_id() == 'clang'\n             ]\n         endif\n     endif\n-\n-    # Use libc++ by default if available instead of libstdc++ when compiling\n-    # with clang.\n-    if cc.find_library('c++', required : false).found()\n-        cpp_arguments += [\n-            '-stdlib=libc++',\n-        ]\n-        cxx_stdlib = 'libc++'\n-    endif\n-\n+    cpp_arguments += [\n+        '-stdlib=' + cxx_stdlib,\n+    ]\n     cpp_arguments += [\n         '-Wextra-semi',\n         '-Wthread-safety',\n","prefixes":[]}