[{"id":37461,"web_url":"https://patchwork.libcamera.org/comment/37461/","msgid":"<20260105102109.GC11611@pendragon.ideasonboard.com>","date":"2026-01-05T10:21:09","subject":"Re: [PATCH v2] meson: Do not force libc++ when using clang","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Jan 05, 2026 at 10:31:19AM +0100, Barnabás Pőcze wrote:\n> From: Khem Raj <raj.khem@gmail.com>\n> \n> Currently the meson scripts force the use of libc++ when using clang\n> as the compiler. This behaviour cannot be overridden by the user, and\n> it is suboptimal as it means that a clang build cannot reliably use\n> system qt, gtest, etc since those might use libstdc++.\n> \n> To fix that, simply do not force the use of any particular standard\n> library, and detect the currently used one based on predefined macros.\n> This is exactly what meson does internally, although the result is\n> not readily available for meson scripts[0][1]; so the test needs\n> to be largely replicated.\n> \n> [0]: https://github.com/mesonbuild/meson/commit/675b47b0692131fae974298829ba807d730ab098\n> [1]: https://stackoverflow.com/a/31658120\n> \n> Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/226\n> Signed-off-by: Khem Raj <raj.khem@gmail.com>\n> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> ---\n> changes in v2:\n>   * use `has_header_symbol()`\n>   * do not set `-stdlib=` when using clang\n>   * reword commit message\n> \n> v1: https://patchwork.libcamera.org/patch/24811/\n> ---\n>  meson.build | 20 ++++++++++----------\n>  1 file changed, 10 insertions(+), 10 deletions(-)\n> \n> diff --git a/meson.build b/meson.build\n> index fa6487f65..4aa7ecc96 100644\n> --- a/meson.build\n> +++ b/meson.build\n> @@ -118,7 +118,16 @@ cpp_arguments = [\n>      '-Wnon-virtual-dtor',\n>  ]\n> \n> -cxx_stdlib = 'libstdc++'\n> +cxx_stdlib = ''\n> +\n> +# \\todo Switch to `version` when moving to C++20 as `ciso646` has been removed in C++20.\n> +if cxx.has_header_symbol('ciso646', '_LIBCPP_VERSION')\n> +    cxx_stdlib = 'libc++'\n> +elif cxx.has_header_symbol('ciso646', '__GLIBCXX__')\n> +    cxx_stdlib = 'libstdc++'\n\nelse\n  error(...)\n\nwould be a nice addition. With that,\n\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> @@ -139,15 +148,6 @@ if cc.get_id() == 'clang'\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\ncxx_stdlib is used in test/py/meson.build only. Should the above be\nmoved there ?\n\n> -    endif\n> -\n>      cpp_arguments += [\n>          '-Wextra-semi',\n>          '-Wthread-safety',","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 312F7BDCC0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Jan 2026 10:21:31 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 634E161F9F;\n\tMon,  5 Jan 2026 11:21:30 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4FE2461F84\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Jan 2026 11:21:28 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-152.bb.dnainternet.fi\n\t[81.175.209.152])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id BF2CA22A;\n\tMon,  5 Jan 2026 11:21:07 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"TJLNMdyv\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1767608468;\n\tbh=+lJW2MP2xklTAfmdY1ap0kC7O/x08xa2Dg9e1KbEUuw=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=TJLNMdyvpzxxG79z+Is83j12BY4C0tIZoX/Wb3R71dNDGuK6IjRygXQLktZgni5fK\n\tNqLplKJt08e+BkmWwUq/oHh65qtd9RlmmNqK/NuMdHS/EInFsfMvOYCftan0gylmXM\n\tpgeL5YkENLpOiFyMsnVUl5hIWPZqRwQ1c1q9RPPU=","Date":"Mon, 5 Jan 2026 12:21:09 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, Khem Raj <raj.khem@gmail.com>","Subject":"Re: [PATCH v2] meson: Do not force libc++ when using clang","Message-ID":"<20260105102109.GC11611@pendragon.ideasonboard.com>","References":"<20260105093119.1176922-1-barnabas.pocze@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<20260105093119.1176922-1-barnabas.pocze@ideasonboard.com>","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>"}},{"id":37464,"web_url":"https://patchwork.libcamera.org/comment/37464/","msgid":"<291b8cb3-6baa-40cb-9cb6-b779a236d942@ideasonboard.com>","date":"2026-01-05T10:28:30","subject":"Re: [PATCH v2] meson: Do not force libc++ when using clang","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2026. 01. 05. 11:21 keltezéssel, Laurent Pinchart írta:\n> On Mon, Jan 05, 2026 at 10:31:19AM +0100, Barnabás Pőcze wrote:\n>> From: Khem Raj <raj.khem@gmail.com>\n>>\n>> Currently the meson scripts force the use of libc++ when using clang\n>> as the compiler. This behaviour cannot be overridden by the user, and\n>> it is suboptimal as it means that a clang build cannot reliably use\n>> system qt, gtest, etc since those might use libstdc++.\n>>\n>> To fix that, simply do not force the use of any particular standard\n>> library, and detect the currently used one based on predefined macros.\n>> This is exactly what meson does internally, although the result is\n>> not readily available for meson scripts[0][1]; so the test needs\n>> to be largely replicated.\n>>\n>> [0]: https://github.com/mesonbuild/meson/commit/675b47b0692131fae974298829ba807d730ab098\n>> [1]: https://stackoverflow.com/a/31658120\n>>\n>> Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/226\n>> Signed-off-by: Khem Raj <raj.khem@gmail.com>\n>> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n>> ---\n>> changes in v2:\n>>    * use `has_header_symbol()`\n>>    * do not set `-stdlib=` when using clang\n>>    * reword commit message\n>>\n>> v1: https://patchwork.libcamera.org/patch/24811/\n>> ---\n>>   meson.build | 20 ++++++++++----------\n>>   1 file changed, 10 insertions(+), 10 deletions(-)\n>>\n>> diff --git a/meson.build b/meson.build\n>> index fa6487f65..4aa7ecc96 100644\n>> --- a/meson.build\n>> +++ b/meson.build\n>> @@ -118,7 +118,16 @@ cpp_arguments = [\n>>       '-Wnon-virtual-dtor',\n>>   ]\n>>\n>> -cxx_stdlib = 'libstdc++'\n>> +cxx_stdlib = ''\n>> +\n>> +# \\todo Switch to `version` when moving to C++20 as `ciso646` has been removed in C++20.\n>> +if cxx.has_header_symbol('ciso646', '_LIBCPP_VERSION')\n>> +    cxx_stdlib = 'libc++'\n>> +elif cxx.has_header_symbol('ciso646', '__GLIBCXX__')\n>> +    cxx_stdlib = 'libstdc++'\n> \n> else\n>    error(...)\n\nOkay.\n\n\n> \n> would be a nice addition. With that,\n> \n\nI have to assume something is missing here?\n\n\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>> @@ -139,15 +148,6 @@ if cc.get_id() == 'clang'\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> \n> cxx_stdlib is used in test/py/meson.build only. Should the above be\n> moved there ?\n\nI would keep it here.\n\n\n> \n>> -    endif\n>> -\n>>       cpp_arguments += [\n>>           '-Wextra-semi',\n>>           '-Wthread-safety',\n>","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 2A2EFBDCBF\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Jan 2026 10:28:35 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 30D6461FC0;\n\tMon,  5 Jan 2026 11:28:34 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6A1EE61F84\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Jan 2026 11:28:33 +0100 (CET)","from [192.168.33.33] (185.221.143.114.nat.pool.zt.hu\n\t[185.221.143.114])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 25C8422A;\n\tMon,  5 Jan 2026 11:28:13 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"UfverJRH\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1767608893;\n\tbh=krQypt2hLJayEybjC7gDTG4P7u0S3V+GyVALinPhgX4=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=UfverJRH3dZQH2Np+zaCrVWM9O9am4hreCucbvIR6ZuZPBa1z6av28axQSySFFRsw\n\tB+Fhw688CMXjplvdhnzgsvv6jbDKNYtVZyE0vGoUdeZrdxNMOm0lz8vLlN9UKfO8yh\n\tqoD6IH4Uo7D9DNdiCLWxhscv7fidw5xM6oUeqcVU=","Message-ID":"<291b8cb3-6baa-40cb-9cb6-b779a236d942@ideasonboard.com>","Date":"Mon, 5 Jan 2026 11:28:30 +0100","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v2] meson: Do not force libc++ when using clang","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, Khem Raj <raj.khem@gmail.com>","References":"<20260105093119.1176922-1-barnabas.pocze@ideasonboard.com>\n\t<20260105102109.GC11611@pendragon.ideasonboard.com>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<20260105102109.GC11611@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","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>"}},{"id":37486,"web_url":"https://patchwork.libcamera.org/comment/37486/","msgid":"<20260105180440.GF10026@pendragon.ideasonboard.com>","date":"2026-01-05T18:04:40","subject":"Re: [PATCH v2] meson: Do not force libc++ when using clang","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Jan 05, 2026 at 11:28:30AM +0100, Barnabás Pőcze wrote:\n> 2026. 01. 05. 11:21 keltezéssel, Laurent Pinchart írta:\n> > On Mon, Jan 05, 2026 at 10:31:19AM +0100, Barnabás Pőcze wrote:\n> >> From: Khem Raj <raj.khem@gmail.com>\n> >>\n> >> Currently the meson scripts force the use of libc++ when using clang\n> >> as the compiler. This behaviour cannot be overridden by the user, and\n> >> it is suboptimal as it means that a clang build cannot reliably use\n> >> system qt, gtest, etc since those might use libstdc++.\n> >>\n> >> To fix that, simply do not force the use of any particular standard\n> >> library, and detect the currently used one based on predefined macros.\n> >> This is exactly what meson does internally, although the result is\n> >> not readily available for meson scripts[0][1]; so the test needs\n> >> to be largely replicated.\n> >>\n> >> [0]: https://github.com/mesonbuild/meson/commit/675b47b0692131fae974298829ba807d730ab098\n> >> [1]: https://stackoverflow.com/a/31658120\n> >>\n> >> Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/226\n> >> Signed-off-by: Khem Raj <raj.khem@gmail.com>\n> >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> >> ---\n> >> changes in v2:\n> >>    * use `has_header_symbol()`\n> >>    * do not set `-stdlib=` when using clang\n> >>    * reword commit message\n> >>\n> >> v1: https://patchwork.libcamera.org/patch/24811/\n> >> ---\n> >>   meson.build | 20 ++++++++++----------\n> >>   1 file changed, 10 insertions(+), 10 deletions(-)\n> >>\n> >> diff --git a/meson.build b/meson.build\n> >> index fa6487f65..4aa7ecc96 100644\n> >> --- a/meson.build\n> >> +++ b/meson.build\n> >> @@ -118,7 +118,16 @@ cpp_arguments = [\n> >>       '-Wnon-virtual-dtor',\n> >>   ]\n> >>\n> >> -cxx_stdlib = 'libstdc++'\n> >> +cxx_stdlib = ''\n> >> +\n> >> +# \\todo Switch to `version` when moving to C++20 as `ciso646` has been removed in C++20.\n> >> +if cxx.has_header_symbol('ciso646', '_LIBCPP_VERSION')\n> >> +    cxx_stdlib = 'libc++'\n> >> +elif cxx.has_header_symbol('ciso646', '__GLIBCXX__')\n> >> +    cxx_stdlib = 'libstdc++'\n> > \n> > else\n> >    error(...)\n> \n> Okay.\n> \n> > would be a nice addition. With that,\n> \n> I have to assume something is missing here?\n\nIgnore the \"With that,\" :-)\n\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> >> @@ -139,15 +148,6 @@ if cc.get_id() == 'clang'\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> > \n> > cxx_stdlib is used in test/py/meson.build only. Should the above be\n> > moved there ?\n> \n> I would keep it here.\n\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n\n> >> -    endif\n> >> -\n> >>       cpp_arguments += [\n> >>           '-Wextra-semi',\n> >>           '-Wthread-safety',","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 ABFB2BDCC0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  5 Jan 2026 18:05:02 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6E8FB61F9F;\n\tMon,  5 Jan 2026 19:05:01 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 5E5CE61F35\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  5 Jan 2026 19:04:59 +0100 (CET)","from pendragon.ideasonboard.com (81-175-209-152.bb.dnainternet.fi\n\t[81.175.209.152])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id CEF8B18D7; \n\tMon,  5 Jan 2026 19:04:38 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"SPStcSDA\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1767636279;\n\tbh=BTO/taZd0zDn2T6TvFNuRrT5fITU6Q474DmlwxW9VM0=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=SPStcSDAMZyAud3bao4SduZLBRvagAzdoGuLs1yJtr2mCOp4KCbe5bTTZooadM1vp\n\tgnv4bGsLQO8iie/4Q+UA/nnvNKBiTDw0ISFm1yXsIDVbNA8C/FueOXsGLexwLY0rzq\n\tkyITVi+1S5x6YAauV/f+Uq4824Ui6pdAj76Ss1rQ=","Date":"Mon, 5 Jan 2026 20:04:40 +0200","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, Khem Raj <raj.khem@gmail.com>","Subject":"Re: [PATCH v2] meson: Do not force libc++ when using clang","Message-ID":"<20260105180440.GF10026@pendragon.ideasonboard.com>","References":"<20260105093119.1176922-1-barnabas.pocze@ideasonboard.com>\n\t<20260105102109.GC11611@pendragon.ideasonboard.com>\n\t<291b8cb3-6baa-40cb-9cb6-b779a236d942@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","Content-Transfer-Encoding":"8bit","In-Reply-To":"<291b8cb3-6baa-40cb-9cb6-b779a236d942@ideasonboard.com>","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>"}},{"id":37496,"web_url":"https://patchwork.libcamera.org/comment/37496/","msgid":"<176769851337.3486172.14749910545257010624@ping.linuxembedded.co.uk>","date":"2026-01-06T11:21:53","subject":"Re: [PATCH v2] meson: Do not force libc++ when using clang","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Laurent Pinchart (2026-01-05 18:04:40)\n> On Mon, Jan 05, 2026 at 11:28:30AM +0100, Barnabás Pőcze wrote:\n> > 2026. 01. 05. 11:21 keltezéssel, Laurent Pinchart írta:\n> > > On Mon, Jan 05, 2026 at 10:31:19AM +0100, Barnabás Pőcze wrote:\n> > >> From: Khem Raj <raj.khem@gmail.com>\n> > >>\n> > >> Currently the meson scripts force the use of libc++ when using clang\n> > >> as the compiler. This behaviour cannot be overridden by the user, and\n> > >> it is suboptimal as it means that a clang build cannot reliably use\n> > >> system qt, gtest, etc since those might use libstdc++.\n> > >>\n> > >> To fix that, simply do not force the use of any particular standard\n> > >> library, and detect the currently used one based on predefined macros.\n> > >> This is exactly what meson does internally, although the result is\n> > >> not readily available for meson scripts[0][1]; so the test needs\n> > >> to be largely replicated.\n> > >>\n> > >> [0]: https://github.com/mesonbuild/meson/commit/675b47b0692131fae974298829ba807d730ab098\n> > >> [1]: https://stackoverflow.com/a/31658120\n> > >>\n> > >> Closes: https://gitlab.freedesktop.org/camera/libcamera/-/issues/226\n> > >> Signed-off-by: Khem Raj <raj.khem@gmail.com>\n> > >> Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com>\n> > >> ---\n> > >> changes in v2:\n> > >>    * use `has_header_symbol()`\n> > >>    * do not set `-stdlib=` when using clang\n> > >>    * reword commit message\n> > >>\n> > >> v1: https://patchwork.libcamera.org/patch/24811/\n> > >> ---\n> > >>   meson.build | 20 ++++++++++----------\n> > >>   1 file changed, 10 insertions(+), 10 deletions(-)\n> > >>\n> > >> diff --git a/meson.build b/meson.build\n> > >> index fa6487f65..4aa7ecc96 100644\n> > >> --- a/meson.build\n> > >> +++ b/meson.build\n> > >> @@ -118,7 +118,16 @@ cpp_arguments = [\n> > >>       '-Wnon-virtual-dtor',\n> > >>   ]\n> > >>\n> > >> -cxx_stdlib = 'libstdc++'\n> > >> +cxx_stdlib = ''\n> > >> +\n> > >> +# \\todo Switch to `version` when moving to C++20 as `ciso646` has been removed in C++20.\n> > >> +if cxx.has_header_symbol('ciso646', '_LIBCPP_VERSION')\n> > >> +    cxx_stdlib = 'libc++'\n> > >> +elif cxx.has_header_symbol('ciso646', '__GLIBCXX__')\n> > >> +    cxx_stdlib = 'libstdc++'\n> > > \n> > > else\n> > >    error(...)\n> > \n> > Okay.\n> > \n> > > would be a nice addition. With that,\n> > \n> > I have to assume something is missing here?\n> \n> Ignore the \"With that,\" :-)\n> \n> > >> +endif\n> > >> +\n> > >> +message('Detected C++ standard library: ' + cxx_stdlib)\n\nAny value in adding this to the summary? But a message is probably fine\nenough on it's own too.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> > >>\n> > >>   if cc.get_id() == 'clang'\n> > >>       if cc.version().version_compare('<9')\n> > >> @@ -139,15 +148,6 @@ if cc.get_id() == 'clang'\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> > > \n> > > cxx_stdlib is used in test/py/meson.build only. Should the above be\n> > > moved there ?\n> > \n> > I would keep it here.\n> \n> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n> \n> > >> -    endif\n> > >> -\n> > >>       cpp_arguments += [\n> > >>           '-Wextra-semi',\n> > >>           '-Wthread-safety',\n> \n> -- \n> Regards,\n> \n> Laurent Pinchart","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 71CC5BDCC0\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue,  6 Jan 2026 11:21:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 83D1561FBB;\n\tTue,  6 Jan 2026 12:21:58 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B78FE61F9F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue,  6 Jan 2026 12:21:56 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 609BA78E;\n\tTue,  6 Jan 2026 12:21:35 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Jsqsc4da\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1767698495;\n\tbh=fWAIMuPqXrYA3tsahUAoJMZSPoWXSWvIeE5Srk6R1Vc=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=Jsqsc4dapNMAw5uzVWmwehDiG8UWpUd/zXS76sET4JzaO8ril0H+R5Z2/QjbY1xox\n\tfEtHF41gNuXtuPtV0kKNHRyYDxlEtuHwfJpnFxRz4eJZAvA30SXNBE565a+cQBP2yM\n\tAxG7gjcjH2hqpYv5UEfGKaG6uIx3LwgycMy2T2cA=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260105180440.GF10026@pendragon.ideasonboard.com>","References":"<20260105093119.1176922-1-barnabas.pocze@ideasonboard.com>\n\t<20260105102109.GC11611@pendragon.ideasonboard.com>\n\t<291b8cb3-6baa-40cb-9cb6-b779a236d942@ideasonboard.com>\n\t<20260105180440.GF10026@pendragon.ideasonboard.com>","Subject":"Re: [PATCH v2] meson: Do not force libc++ when using clang","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org, Khem Raj <raj.khem@gmail.com>","To":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>,\n\tLaurent Pinchart <laurent.pinchart@ideasonboard.com>","Date":"Tue, 06 Jan 2026 11:21:53 +0000","Message-ID":"<176769851337.3486172.14749910545257010624@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}}]