From patchwork Thu Nov 20 12:19:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyorgy Sarvari X-Patchwork-Id: 75083 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B78DACF884F for ; Thu, 20 Nov 2025 12:19:55 +0000 (UTC) Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.32976.1763641190608901511 for ; Thu, 20 Nov 2025 04:19:50 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=cACRawq7; spf=pass (domain: gmail.com, ip: 209.85.128.47, mailfrom: skandigraun@gmail.com) Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-477563e28a3so5658555e9.1 for ; Thu, 20 Nov 2025 04:19:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763641189; x=1764245989; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=Xq5VExmpHxrU8dRcA7QH4P1Mk9j0wjUz1OcDFkzaN/M=; b=cACRawq794URe7i7oc5uVR+8daeYaj69G84NsExuDt1h1BNlDrNyNXKob6a3Nmbrtk 60N5HlC2duVJh550Nv/Zb2lA7udwws2r3Lo1MPVygenlKQW4MoPqdw2v3t64ySvC5x7y d6zOAuVfCIwT9s9xIsT0bc1FlAyAOhFXDOT13Ibymkxzs09yxdbQXTGanZpLZZWocrvH 2SjJC1dZROekwMZltJHLrO0DAdTFr08LzCSRiSf9WzlajncRZy2fjEYqCpEJFm84mac+ BZUuf5ogN76gHD7wPxsdnM3MikVkXcvvorYKlWcVddD0qrc6aYbyF5Ht2iPiV3OMAhRJ XkAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763641189; x=1764245989; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Xq5VExmpHxrU8dRcA7QH4P1Mk9j0wjUz1OcDFkzaN/M=; b=X9QWv8eIw9HZeCc9ba/ITB/qxp+wGYDo8lkku7PcYky1xl6mjLuWEXrg6KZgVmfcMw QBTDKLg8OKKz7p9ItSZoO+SE5MnH8KgXc+rwf4SZ0HzcCbrGKGDCtS2QoduzY0PmbrE6 +3YeR1xd73ighXt/viuNMBkYwPfAa7+dYFCTI4i/QyRkRC20bf0F/WXp0cNhOoL4+wd2 GWj95qeI2pNfcpK5iWJAypjcA/UvMNyuo9e09MEXDcZvyO0ThlCF3T09HObP/ODdGdEF WC5lL0tE+44qECCcg/PDrQkPkRD5Cw0nj3VjN+ApveUUhw/IlAEApwJMp421HfCsbVdg Ad7w== X-Gm-Message-State: AOJu0Yx3/RxmE9a0vMDVBhZoDWys32462PiifbYipiTMjE501Zp1lAmO fmW+znS+f/vQnmLPRbJ9/gBtor8Xm3BSekSQqcFKlW3wxhLjGyGgaTGOiOXvJV7Z X-Gm-Gg: ASbGncvtXo0xAB9PtH7xH+3fgnH5NtoPM2HvvXZZtC2envh6eYgC9XCFCnVqkE9kg7A L0W+6KaFvMkrp/4FNFAnDBF+P/KDuj92zc3n3GBqXLsivMkugBkrqUb2OKVThLZ/FcNaFr70JGn 34Gc3UOIN1NSZGRejXnxQqwJ/ihH7SAE9gAfZuahKrTmZdD/mC4jIIic6Qfg0dn+v3WFF5KVbn3 vy8wv06GA1txD/RUeWnsEKzMRS+t5pt+BR4VOZbQnbMsOBOCOKg+KdAs1F2qB93FBb2bQ0rSqxX co1DFhMCCy4g5YNbLuGKClEVN8HI6N7/XdPlBImubalAlNkObmUyYtjOI4bXxB2SgENvb7kQbt/ KgdcSs6awQIeMkSu4nC0TefhyA1C/Vih6giI0rqv8Ic7XiIvR/iWJEQEQ3EFxTli9zJFTexOO+C hI+8dUkfnS X-Google-Smtp-Source: AGHT+IGhQOehlrN0A2O8BRZFpmFUdpVyhYf112HUP8rIu0Q+VGwn4Z9J3D+4laGICc7dI9TSnlCYVQ== X-Received: by 2002:a05:600c:1516:b0:477:14ba:28da with SMTP id 5b1f17b1804b1-477b9ea8f78mr14377405e9.5.1763641188896; Thu, 20 Nov 2025 04:19:48 -0800 (PST) Received: from desktop ([51.154.145.205]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-477b0ffe377sm103812435e9.1.2025.11.20.04.19.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 04:19:48 -0800 (PST) From: Gyorgy Sarvari To: openembedded-core@lists.openembedded.org Subject: [PATCH 1/2] bitbake.conf, gcc toolchain: add -fcanon-prefix-map to map-prefixes Date: Thu, 20 Nov 2025 13:19:46 +0100 Message-ID: <20251120121947.3473848-2-skandigraun@gmail.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120121947.3473848-1-skandigraun@gmail.com> References: <20251120121947.3473848-1-skandigraun@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 20 Nov 2025 12:19:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/226618 This patch adds -fcanon-prefix-map to the list of compile file-prefixes list in case at least gcc 13 is used (it's a gcc-only flag). This flag used to be part of this list in the past, but was removed with [1]. Since then the source file paths are not canonicalized, which makes the system to miss some (and sometimes all) source files to include in the corresponding -src packages. As an example sqlite3 and audiofile (from meta-oe) produces empty src packages, mostly due to the pathes: they frequently use relative paths that don't match up with the absolute path specified in the file-preifx map: `pwd`/../../foo.cpp and ${S}/foo.cpp might refer to the same file, but the first one won't match the prefix-map, so it is omitted. This patch adds this option again with gcc: for class-target it is uses always, and for class-native it is used when the host gcc is at least version 13. Signed-off-by: Gyorgy Sarvari --- meta/classes/toolchain/gcc-native.bbclass | 3 +++ meta/classes/toolchain/gcc.bbclass | 2 ++ meta/conf/bitbake.conf | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/meta/classes/toolchain/gcc-native.bbclass b/meta/classes/toolchain/gcc-native.bbclass index a708bd0389..8708ad0211 100644 --- a/meta/classes/toolchain/gcc-native.bbclass +++ b/meta/classes/toolchain/gcc-native.bbclass @@ -13,3 +13,6 @@ BUILD_OBJDUMP = "${BUILD_PREFIX}objdump" BUILD_NM = "${BUILD_PREFIX}nm" BUILD_READELF = "${BUILD_PREFIX}readelf" +# gcc started to support -fcanon-prefix-map from version 13 +DEBUG_PREFIX_MAP_EXTRA:class-native = \ + "${@'-fcanon-prefix-map' if bb.utils.vercmp_string_op(oe.utils.get_host_gcc_version(d), '13.0.0', '>=') else ''}" diff --git a/meta/classes/toolchain/gcc.bbclass b/meta/classes/toolchain/gcc.bbclass index a5adb5ca37..0ed49ba892 100644 --- a/meta/classes/toolchain/gcc.bbclass +++ b/meta/classes/toolchain/gcc.bbclass @@ -30,4 +30,6 @@ PREFERRED_PROVIDER_virtual/nativesdk-cross-cc:class-cross-canadian = "gcc-crosss PREFERRED_PROVIDER_virtual/nativesdk-cross-c++:class-cross-canadian = "gcc-crosssdk-${SDK_SYS}" PREFERRED_PROVIDER_virtual/nativesdk-compilerlibs:class-cross-canadian = "nativesdk-gcc-runtime" +DEBUG_PREFIX_MAP_EXTRA = "-fcanon-prefix-map" + TCOVERRIDE = "toolchain-gcc" diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 5406e542db..600d4baffb 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -650,7 +650,7 @@ EXTRA_OEMAKE:prepend:task-install = "${PARALLEL_MAKEINST} " ################################################################## TARGET_DBGSRC_DIR ?= "/usr/src/debug/${PN}/${PV}" # Beware: applied last to first -DEBUG_PREFIX_MAP ?= "\ +DEBUG_PREFIX_MAP ?= "${DEBUG_PREFIX_MAP_EXTRA} \ -ffile-prefix-map=${S}=${TARGET_DBGSRC_DIR} \ -ffile-prefix-map=${B}=${TARGET_DBGSRC_DIR} \ -ffile-prefix-map=${STAGING_DIR_HOST}= \ From patchwork Thu Nov 20 12:19:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyorgy Sarvari X-Patchwork-Id: 75084 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B90B6CF8851 for ; Thu, 20 Nov 2025 12:19:55 +0000 (UTC) Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by mx.groups.io with SMTP id smtpd.msgproc01-g2.32977.1763641191558209553 for ; Thu, 20 Nov 2025 04:19:51 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=OirvjhFD; spf=pass (domain: gmail.com, ip: 209.85.221.44, mailfrom: skandigraun@gmail.com) Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-42b3ac40ae4so458940f8f.0 for ; Thu, 20 Nov 2025 04:19:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1763641190; x=1764245990; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=f6qmmNQy8NfLeMnAi4uwfAeS5LWO1eAQuRkxGizIvFg=; b=OirvjhFD/ltWIWpsf5Io6G3mvlfGmCDzCnrY9lLczTBuEOlMZjpr5G3MbFnMQoxdg6 4WqjKEbyQJwQx5+PV+qeZ73ZJD2/3hWUvy59VutoU+kuMTh6hWFJTqU/tHsRW2qLVRZk nHR/wE5xqI28arliZaH1yLm/u3WUmiwayX+TqOFqSk8SMCGfby6CsrijWzEFGjljYbAs EaEArF31DNcYmuRKcGEt6nRcWZo0InUwke+lTq/YFriDPUDAL9Ra7ua+acjRNLrIVjd/ mt55XImMMLmtpTp550wzy1nd5NCJCo1vIYnfXyIe1pIJrK6mRJy/RCOWMhVPPCFQ55sW wfXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763641190; x=1764245990; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=f6qmmNQy8NfLeMnAi4uwfAeS5LWO1eAQuRkxGizIvFg=; b=EXD1sHDEOA/UbSSMAROr8B9Ey5iDTRM4cWwmSuZicZT9gtH1PKibL/+LFQMlq3olUO dyF1NqqrsVQQv+PdoYslTpYpl2svPy1+UME6X/puKr8zpFNJmav2ptCm+N0yEaNHRNSr UEEJTjAHtudkLhs1wjTDVuBGlRxxT6uLAWtUwW9unxBrTMCBH4wZR7fQgYfnszMum10V ThFQWF5oZYVOPnZ9ekklEw9oHBoXxAmm4zBDeOw7TfvM57MC1QTVolAfNVDhxG/3+GM1 nVbUM05iF2oxITHFJGPzpuXp7h+yptpfv/rMJFBtyt8eQRQdvoxcTNDs2H7zBvek3Fn8 eajw== X-Gm-Message-State: AOJu0YxsU/wnrWmoR2NnRpoLgLrAOGErfKhR6ywVMwvIJg9gO/npVm4f dwFY/0bhreYy84nxd6xvHZSuTto4Tlk8MlwR9Y5OLjTSAmm+mI9wO+WEuhERm6QS X-Gm-Gg: ASbGnctZcSkBr14nVtAiH+QFmFEV0VISWVAIIk4U5my/bppQlTdbcRKInoYHPmBseF9 LVidkNuLPMMYiyuVnSeiUmqccWzKgLJlxdgJ2iyeCpZeQJ0BpkiMCLcZ/of+Ufbd5TjH7HBm+By wd2MiHEgMUrFyfcIUqD+1vbMcAtqt6P/rK9N4DFgQj3S500pwF7SOHvuBqwecRJSakOJJQViYKw Fsagp1CNIrS0ajDMXyDB6f47/Ljm502h7AVdGFW1fyx0dncpNWdMB0hdBtIXMSZlwoDyTxuj0bI 42vmyd6clzgQg1xVFZNkYQqWur4JDpD0ThVLTRxuhPCpb2uODpDvOC3zgoY5wDTS6nf06tw9FF4 lM7m7f4+gVpQgKje5IoM0l9M6H0w3zqcKPhv6pJlWqXRG/7C1TpkqpmD7bfNJ6zD7qkp4PSSMzo 0MnuUCM5xmn1S5Jm214AI= X-Google-Smtp-Source: AGHT+IF/tBr05qpQtuXPG4RhVLk9l5U2rXfljwcLlxaQtk+f+FJcPYUhGSx2+vSrSWbB/R056enS6w== X-Received: by 2002:a05:600c:3588:b0:477:a977:b8a7 with SMTP id 5b1f17b1804b1-477b8a8ef7dmr34022135e9.19.1763641189642; Thu, 20 Nov 2025 04:19:49 -0800 (PST) Received: from desktop ([51.154.145.205]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-477b0ffe377sm103812435e9.1.2025.11.20.04.19.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Nov 2025 04:19:49 -0800 (PST) From: Gyorgy Sarvari To: openembedded-core@lists.openembedded.org Subject: [PATCH 2/2] rust-common.bbclass: filter out incorrect compiler flags in wrapper Date: Thu, 20 Nov 2025 13:19:47 +0100 Message-ID: <20251120121947.3473848-3-skandigraun@gmail.com> X-Mailer: git-send-email 2.51.2 In-Reply-To: <20251120121947.3473848-1-skandigraun@gmail.com> References: <20251120121947.3473848-1-skandigraun@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Thu, 20 Nov 2025 12:19:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/226619 This patch is a workaround for https://bugzilla.yoctoproject.org/show_bug.cgi?id=15976 cc-rs crate is used by a number of projects, including rust's bootstrap also to invoke the systems c/c++ compiler. A few updates ago it has changed the way CFLAGS/CXXFLAGS are handled: it now merges them with HOST_C*FLAGS and TARGET_C*FLAGS. This is a problem when a recipe is cross compiled, but it has a build dependency which uses this crate to be built. In this case the C*FLAGS variable contains target flags, while the HOST_C*FLAGS contains host-specific flags, and when the two are mixed, the output is not what one expects. This change tries to filter out the incorrect flags: - If the wrapper is invoked as a c or c++ compiler wrapper, - then determines if it compiles for host or for target - Depending on the on above, it considers the TARGET_*FLAGS or HOST*FLAGS correct, and the C*FLAGS variable content incorrect. - It subtracts the correct set from the incorrect set, and drops the remainder from the compiler flags. (Which might be often an empty list, so the flags are frequently unchanged) Signed-off-by: Gyorgy Sarvari --- meta/classes-recipe/rust-common.bbclass | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/meta/classes-recipe/rust-common.bbclass b/meta/classes-recipe/rust-common.bbclass index 31331c7a26..c61143a56c 100644 --- a/meta/classes-recipe/rust-common.bbclass +++ b/meta/classes-recipe/rust-common.bbclass @@ -148,6 +148,29 @@ create_wrapper_rust () { binary = orig_binary.split()[0] args = orig_binary.split() + sys.argv[1:] + + # The following is trying to be a workaround for + # https://bugzilla.yoctoproject.org/show_bug.cgi?id=15976 + # cc-rs crate passes both host AND target flags at the same time + # to this script, in case a recipe is cross-compiled, but a crate + # is a build dependency, and is compiled for the host. + # This tries to filter out the inappropriate flags. + if sys.argv[0].endswith("-cc"): + script_type = "C" + elif sys.argv[0].endswith("-cxx"): + script_type = "CXX" + else: + script_type = "other" + + flags_to_remove = [] + if script_type != "other": + host_or_target = "HOST" if "build-rust-" in sys.argv[0] else "TARGET" + incorrect_flags = os.getenv("%sFLAGS" % script_type).split() + correct_flags = os.getenv("%s_%sFLAGS" % (host_or_target, script_type)).split() + flags_to_remove = set(incorrect_flags) - set(correct_flags) + + args = list(filter(lambda flag: flag not in flags_to_remove, args)) + if extras: args.append(extras) os.execvp(binary, args)