From patchwork Tue Jan 21 08:55:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 55885 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 86F2AC02185 for ; Tue, 21 Jan 2025 08:55:31 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web11.11834.1737449729552257325 for ; Tue, 21 Jan 2025 00:55:29 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=31163e49e6=hongxu.jia@windriver.com) Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50L7Oo95026729 for ; Tue, 21 Jan 2025 00:55:29 -0800 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4488f72dhy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 21 Jan 2025 00:55:28 -0800 (PST) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Tue, 21 Jan 2025 00:55:28 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Tue, 21 Jan 2025 00:55:27 -0800 From: Hongxu Jia To: Subject: [PATCH 1/9] perl: fix do_install failed for nativesdk-perl Date: Tue, 21 Jan 2025 16:55:18 +0800 Message-ID: <20250121085526.1370937-1-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Proofpoint-GUID: XKZ4EjFFrEzRqU8rRypzQQ7Y8ZoPMscF X-Authority-Analysis: v=2.4 cv=GqG4+l1C c=1 sm=1 tr=0 ts=678f6100 cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=VdSt8ZQiCzkA:10 a=t7CeM3EgAAAA:8 a=HxWyxOqbMz5ZhdE05ycA:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-ORIG-GUID: XKZ4EjFFrEzRqU8rRypzQQ7Y8ZoPMscF X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_04,2025-01-21_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 mlxlogscore=893 phishscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2411120000 definitions=main-2501210072 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Jan 2025 08:55:31 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210073 While set 'baselib = "lib64"' for nativesdk, perl do_install failed: | rm: cannot remove 'tmp/work/x86_64-nativesdk-pokysdk-linux/nativesdk-perl/ 5.40.0/image//usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-pokysdk-linux/ usr/lib64/perl5/5.40.0/*/CORE/libperl.so': No such file or directory Refer perl class-target do_configure, explicitly pass option '--libdir=${libdir}' to nativesdk do_configure Signed-off-by: Hongxu Jia --- meta/recipes-devtools/perl/perl_5.40.0.bb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/recipes-devtools/perl/perl_5.40.0.bb b/meta/recipes-devtools/perl/perl_5.40.0.bb index 77b92ae804..30f2431f27 100644 --- a/meta/recipes-devtools/perl/perl_5.40.0.bb +++ b/meta/recipes-devtools/perl/perl_5.40.0.bb @@ -90,7 +90,7 @@ do_configure:class-target() { } do_configure:class-nativesdk() { - ./configure --prefix=${prefix} \ + ./configure --prefix=${prefix} --libdir=${libdir} \ --target=${TARGET_SYS} \ -Duseshrplib \ -Dusethreads \ From patchwork Tue Jan 21 08:55:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 55884 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 86249C02182 for ; Tue, 21 Jan 2025 08:55:31 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web10.11920.1737449730265245338 for ; Tue, 21 Jan 2025 00:55:30 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=31163e49e6=hongxu.jia@windriver.com) Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50L6I3Nb024929 for ; Tue, 21 Jan 2025 00:55:30 -0800 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4488f72dj0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 21 Jan 2025 00:55:29 -0800 (PST) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Tue, 21 Jan 2025 00:55:29 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Tue, 21 Jan 2025 00:55:28 -0800 From: Hongxu Jia To: Subject: [PATCH 2/9] multilib_header.bbclass: need multilib headers for nativesdk builds Date: Tue, 21 Jan 2025 16:55:19 +0800 Message-ID: <20250121085526.1370937-2-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250121085526.1370937-1-hongxu.jia@windriver.com> References: <20250121085526.1370937-1-hongxu.jia@windriver.com> MIME-Version: 1.0 X-Proofpoint-GUID: Q9IvlKRT65fho-mPkog0y60Ivys8PISL X-Authority-Analysis: v=2.4 cv=GqG4+l1C c=1 sm=1 tr=0 ts=678f6101 cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=VdSt8ZQiCzkA:10 a=t7CeM3EgAAAA:8 a=4OnpYy5rAKxkZ6uXF-EA:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-ORIG-GUID: Q9IvlKRT65fho-mPkog0y60Ivys8PISL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_04,2025-01-21_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 mlxlogscore=690 phishscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2411120000 definitions=main-2501210072 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Jan 2025 08:55:31 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210074 The nativesdk multilib support required it to fix multilib headers conflict [ YOCTO #15722 ] Signed-off-by: Hongxu Jia --- meta/classes-recipe/multilib_header.bbclass | 5 ----- 1 file changed, 5 deletions(-) diff --git a/meta/classes-recipe/multilib_header.bbclass b/meta/classes-recipe/multilib_header.bbclass index 33f7e027f0..b338166f61 100644 --- a/meta/classes-recipe/multilib_header.bbclass +++ b/meta/classes-recipe/multilib_header.bbclass @@ -51,8 +51,3 @@ oe_multilib_header() { oe_multilib_header:class-native () { return } - -# Nor do we need multilib headers for nativesdk builds. -oe_multilib_header:class-nativesdk () { - return -} From patchwork Tue Jan 21 08:55:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 55886 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 87A3DC0218B for ; Tue, 21 Jan 2025 08:55:31 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web11.11835.1737449731172854140 for ; Tue, 21 Jan 2025 00:55:31 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=31163e49e6=hongxu.jia@windriver.com) Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50L6HvM7010124 for ; Tue, 21 Jan 2025 00:55:31 -0800 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 448cpq28yk-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 21 Jan 2025 00:55:30 -0800 (PST) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Tue, 21 Jan 2025 00:55:30 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Tue, 21 Jan 2025 00:55:29 -0800 From: Hongxu Jia To: Subject: [PATCH 3/9] toolchain-shar-relocate.sh: support multiple dynamic loaders for multilib Date: Tue, 21 Jan 2025 16:55:20 +0800 Message-ID: <20250121085526.1370937-3-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250121085526.1370937-1-hongxu.jia@windriver.com> References: <20250121085526.1370937-1-hongxu.jia@windriver.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 4FmVaXDBOovwU7vNGD3oiH71rfZtvKRm X-Proofpoint-GUID: 4FmVaXDBOovwU7vNGD3oiH71rfZtvKRm X-Authority-Analysis: v=2.4 cv=TdtstQQh c=1 sm=1 tr=0 ts=678f6102 cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=VdSt8ZQiCzkA:10 a=t7CeM3EgAAAA:8 a=_5uvO0izC0wKLXb3myoA:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_04,2025-01-21_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 spamscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=877 adultscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2411120000 definitions=main-2501210072 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Jan 2025 08:55:31 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210075 While nativesdk support multilib, there are two dynamic loaders, $OECORE_NATIVE_SYSROOT/lib64/ld-linux-x86-64.so.2 $OECORE_NATIVE_SYSROOT/lib/ld-linux.so.2 Search them with wildcard and call relocate_sdk.py separately [ YOCTO #15722 ] Signed-off-by: Hongxu Jia --- meta/files/toolchain-shar-relocate.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/meta/files/toolchain-shar-relocate.sh b/meta/files/toolchain-shar-relocate.sh index 69ea063c8c..c7170349db 100644 --- a/meta/files/toolchain-shar-relocate.sh +++ b/meta/files/toolchain-shar-relocate.sh @@ -8,8 +8,8 @@ done # fix dynamic loader paths in all ELF SDK binaries # allow symlinks to be accessed via the find command too native_sysroot=$($SUDO_EXEC cat $env_setup_script |grep 'OECORE_NATIVE_SYSROOT='|cut -d'=' -f2|tr -d '"') -dl_path=$($SUDO_EXEC find $native_sysroot/lib/ -maxdepth 1 -name "ld-linux*") -if [ "$dl_path" = "" ] ; then +dl_paths=$($SUDO_EXEC find $native_sysroot/lib*/ -maxdepth 1 -name "ld-linux*") +if [ "$dl_paths" = "" ] ; then echo "SDK could not be set up. Relocate script unable to find ld-linux.so. Abort!" exit 1 fi @@ -39,7 +39,9 @@ if [ x\${PYTHON} = "x" ]; then echo "SDK could not be relocated. No python found." exit 1 fi -\${PYTHON} ${env_setup_script%/*}/relocate_sdk.py $target_sdk_dir $dl_path $executable_files +for dl_path in \$(echo "$dl_paths"); do + \${PYTHON} ${env_setup_script%/*}/relocate_sdk.py $target_sdk_dir \$dl_path $executable_files +done EOF $SUDO_EXEC mv $tdir/relocate_sdk.sh ${env_setup_script%/*}/relocate_sdk.sh From patchwork Tue Jan 21 08:55:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 55887 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 86595C02182 for ; Tue, 21 Jan 2025 08:55:41 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web11.11836.1737449732124099953 for ; Tue, 21 Jan 2025 00:55:32 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=31163e49e6=hongxu.jia@windriver.com) Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50L8ZZWB017946 for ; Tue, 21 Jan 2025 00:55:32 -0800 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 448cpq28ym-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 21 Jan 2025 00:55:31 -0800 (PST) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Tue, 21 Jan 2025 00:55:31 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Tue, 21 Jan 2025 00:55:30 -0800 From: Hongxu Jia To: Subject: [PATCH 4/9] script/relocate_sdk.py: check dynamic loader arch before relocating interpreter Date: Tue, 21 Jan 2025 16:55:21 +0800 Message-ID: <20250121085526.1370937-4-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250121085526.1370937-1-hongxu.jia@windriver.com> References: <20250121085526.1370937-1-hongxu.jia@windriver.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: sby8cerSIaaSULy_A5HqkVe0U2CRZmH_ X-Proofpoint-GUID: sby8cerSIaaSULy_A5HqkVe0U2CRZmH_ X-Authority-Analysis: v=2.4 cv=TdtstQQh c=1 sm=1 tr=0 ts=678f6103 cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=VdSt8ZQiCzkA:10 a=t7CeM3EgAAAA:8 a=dAzMZrHdxAaOrm8FoQAA:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_04,2025-01-21_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 spamscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=730 adultscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2411120000 definitions=main-2501210072 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Jan 2025 08:55:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210076 While multiple dynamic loader existed, in order to make executable file is interpreted by the expected dynamic loader, relocating interpreter only if the new dynamic loader and executable file have the same arch [ YOCTO #15722 ] Signed-off-by: Hongxu Jia --- scripts/relocate_sdk.py | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/scripts/relocate_sdk.py b/scripts/relocate_sdk.py index 8a728720ba..9e01c09cb0 100755 --- a/scripts/relocate_sdk.py +++ b/scripts/relocate_sdk.py @@ -49,6 +49,34 @@ def get_arch(): elif ei_class == 2: return 64 +def get_dl_arch(dl_path): + try: + with open(dl_path, "r+b") as f: + e_ident =f.read(16) + except IOError: + exctype, ioex = sys.exc_info()[:2] + if ioex.errno == errno.ETXTBSY: + print("Could not open %s. File used by another process.\nPlease "\ + "make sure you exit all processes that might use any SDK "\ + "binaries." % e) + else: + print("Could not open %s: %s(%d)" % (e, ioex.strerror, ioex.errno)) + sys.exit(-1) + + ei_mag0,ei_mag1_3,ei_class,ei_data,ei_version = struct.unpack("= 64: arch = get_arch() - if arch: + if arch and arch == dl_arch: parse_elf_header() if not change_interpreter(e): errors = True From patchwork Tue Jan 21 08:55:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 55891 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 A56E5C0218E for ; Tue, 21 Jan 2025 08:55:41 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web10.11922.1737449733190552103 for ; Tue, 21 Jan 2025 00:55:33 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=31163e49e6=hongxu.jia@windriver.com) Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50L85cvs006662 for ; Tue, 21 Jan 2025 00:55:32 -0800 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 448cpq28yn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 21 Jan 2025 00:55:32 -0800 (PST) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Tue, 21 Jan 2025 00:55:32 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Tue, 21 Jan 2025 00:55:31 -0800 From: Hongxu Jia To: Subject: [PATCH 5/9] libgcc-common: apply multilib symlinks for nativesdk libgcc Date: Tue, 21 Jan 2025 16:55:22 +0800 Message-ID: <20250121085526.1370937-5-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250121085526.1370937-1-hongxu.jia@windriver.com> References: <20250121085526.1370937-1-hongxu.jia@windriver.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: jNgBguQhNFSBGWgrP9q2wUK8q_tda8T1 X-Proofpoint-GUID: jNgBguQhNFSBGWgrP9q2wUK8q_tda8T1 X-Authority-Analysis: v=2.4 cv=TdtstQQh c=1 sm=1 tr=0 ts=678f6104 cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=VdSt8ZQiCzkA:10 a=t7CeM3EgAAAA:8 a=46o5wDONuQUSbuuqhUIA:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_04,2025-01-21_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 spamscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=855 adultscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2411120000 definitions=main-2501210072 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Jan 2025 08:55:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210077 Due to the supported SDKMACHINE includes: aarch64, i586, i686, loongarch64, ppc64, ppc64le, riscv64, x86_64 Only i586 and x86_64, i686 and x86_64 have multilib relationship, so create multilib symlinks for i686,i586,x86_64 nativesdk. It will have no regression when nativesdk-gcc disable multilib support in which the symlinks is broken [ YOCTO #15722 ] Signed-off-by: Hongxu Jia --- meta/recipes-devtools/gcc/libgcc-common.inc | 40 +++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/meta/recipes-devtools/gcc/libgcc-common.inc b/meta/recipes-devtools/gcc/libgcc-common.inc index e3db17d700..ac284a0031 100644 --- a/meta/recipes-devtools/gcc/libgcc-common.inc +++ b/meta/recipes-devtools/gcc/libgcc-common.inc @@ -140,6 +140,46 @@ fakeroot python do_multilib_install() { os.symlink(src, dest) } +# this makes multilib gcc files findable for nativesdk gcc +# to link multilib nativesdk gcc library +# e.g. +# For x86_64 nativesdk-libgcc +# sysroots/x86_64-pokysdk-linux/usr/lib/i686-pokysdk-linux/14.2.0 +# by creating this symlink to it +# sysroots/x86_64-pokysdk-linux/usr/lib64/x86_64-pokysdk-linux/14.2.0/32 +# +# For i686 nativesdk-libgcc +# sysroots/i686-pokysdk-linux/usr/lib64/x86_64-pokysdk-linux/14.2.0 +# by creating this symlink to it +# sysroots/i686-pokysdk-linux/usr/lib/i686-pokysdk-linux/14.2.0/64 + +fakeroot python do_multilib_install:class-nativesdk() { + sdk_arch = d.getVar('SDK_ARCH') + if sdk_arch not in ['x86_64', 'i686']: + return + + binv = d.getVar('BINV') + if d.getVar('SDK_ARCH') == 'x86_64': + tune_arch = 'i686' + tune_bitness = '32' + tune_baselib = 'lib' + elif d.getVar('SDK_ARCH') in ['i686', 'i586']: + tune_arch = 'x86_64' + tune_bitness = '64' + tune_baselib = 'lib64' + + src = '../../../' + tune_baselib + '/' + \ + tune_arch + d.getVar('SDK_VENDOR') + \ + '-' + d.getVar('SDK_OS') + '/' + binv + '/' + + dest = d.getVar('D') + d.getVar('libdir') + '/' + \ + d.getVar('SDK_SYS') + '/' + binv + '/' + tune_bitness + + if os.path.lexists(dest): + os.unlink(dest) + os.symlink(src, dest) +} + def get_original_os(d): vendoros = d.expand('${TARGET_ARCH}${ORIG_TARGET_VENDOR}-${TARGET_OS}') for suffix in [d.getVar('ABIEXTENSION'), d.getVar('LIBCEXTENSION')]: From patchwork Tue Jan 21 08:55:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 55890 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 9B6F1C0218C for ; Tue, 21 Jan 2025 08:55:41 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web11.11838.1737449734119958719 for ; Tue, 21 Jan 2025 00:55:34 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=31163e49e6=hongxu.jia@windriver.com) Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50L5U2XU019089 for ; Tue, 21 Jan 2025 00:55:34 -0800 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4488f72dj4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 21 Jan 2025 00:55:33 -0800 (PST) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Tue, 21 Jan 2025 00:55:33 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Tue, 21 Jan 2025 00:55:32 -0800 From: Hongxu Jia To: Subject: [PATCH 6/9] meta/conf/bitbake.conf: support multiarch for nativesdk Date: Tue, 21 Jan 2025 16:55:23 +0800 Message-ID: <20250121085526.1370937-6-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250121085526.1370937-1-hongxu.jia@windriver.com> References: <20250121085526.1370937-1-hongxu.jia@windriver.com> MIME-Version: 1.0 X-Proofpoint-GUID: rV2KWd3-5bm8-zNLygLPOvlS9UlZrT5I X-Authority-Analysis: v=2.4 cv=GqG4+l1C c=1 sm=1 tr=0 ts=678f6105 cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=VdSt8ZQiCzkA:10 a=t7CeM3EgAAAA:8 a=17aPSRxe4SqTchkXHpEA:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-ORIG-GUID: rV2KWd3-5bm8-zNLygLPOvlS9UlZrT5I X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_04,2025-01-21_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 mlxlogscore=867 phishscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2411120000 definitions=main-2501210072 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Jan 2025 08:55:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210078 Otherwise 32bit i686 nativesdk-gcc compiled 64bit executable file failed $ cat << ENDOF > main.c int main() { return 0; } ENDOF $ i686-pokysdk-linux-gcc -m64 main.c -o main cc1: sorry, unimplemented: 64-bit mode not compiled in [ YOCTO #15722 ] Signed-off-by: Hongxu Jia --- meta/conf/bitbake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index ba7817b7e5..4668373756 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -922,7 +922,7 @@ IMAGE_FEATURES += "${EXTRA_IMAGE_FEATURES}" # Native distro features (will always be used for -native, even if they # are not enabled for target) DISTRO_FEATURES_NATIVE ?= "acl x11 ipv6 xattr" -DISTRO_FEATURES_NATIVESDK ?= "acl x11 ipv6 xattr" +DISTRO_FEATURES_NATIVESDK ?= "acl x11 ipv6 xattr multiarch" DISTRO_FEATURES_NATIVESDK:mingw32 = "x11 ipv6" # Normally target distro features will not be applied to native builds: From patchwork Tue Jan 21 08:55:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 55889 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 9752EC02187 for ; Tue, 21 Jan 2025 08:55:41 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web10.11923.1737449735034207757 for ; Tue, 21 Jan 2025 00:55:35 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=31163e49e6=hongxu.jia@windriver.com) Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50L6eCPG010269 for ; Tue, 21 Jan 2025 00:55:34 -0800 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 448cpq28yq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 21 Jan 2025 00:55:34 -0800 (PST) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Tue, 21 Jan 2025 00:55:34 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Tue, 21 Jan 2025 00:55:33 -0800 From: Hongxu Jia To: Subject: [PATCH 7/9] gcc-configure-common.inc: add multlib support for i686/i586/x86_64 nativesdk gcc Date: Tue, 21 Jan 2025 16:55:24 +0800 Message-ID: <20250121085526.1370937-7-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250121085526.1370937-1-hongxu.jia@windriver.com> References: <20250121085526.1370937-1-hongxu.jia@windriver.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: ukU6-XzxVduKJI0uycmlh9MjFQdFfUAo X-Proofpoint-GUID: ukU6-XzxVduKJI0uycmlh9MjFQdFfUAo X-Authority-Analysis: v=2.4 cv=TdtstQQh c=1 sm=1 tr=0 ts=678f6106 cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=VdSt8ZQiCzkA:10 a=t7CeM3EgAAAA:8 a=45OZM_v20GHH4WQ5mVsA:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_04,2025-01-21_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 spamscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2411120000 definitions=main-2501210072 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Jan 2025 08:55:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210079 We have patch 0016-handle-sysroot-support-for-nativesdk-gcc.patch to handle sysroot support for nativesdk-gcc, and add %r target_relocatable_prefix into spec file for nativesdk-gcc relocation. It was used for injected paths SYSTEMLIBS_DIR Due to the supported SDKMACHINE includes: aarch64, i586, i686, loongarch64, ppc64, ppc64le, riscv64, x86_64 Only i586 and x86_64, i686 and x86_64 have multilib relationship, for i586,i686 and x86_64, this commit: - Tweak target_relocatable_prefix, set ${root_prefix} to it, and tweak libdir32 and libdir64 based on ${root_prefix} prefix with "/lib" and "/lib64" suffix. - Harcode dirnames ['m64', 'm32'] and osdirnames ['../lib64', '../lib'] Above setting also covers gcc-nativesdk without multilib For other situation, the configuration is the same as usual [ YOCTO #15722 ] Signed-off-by: Hongxu Jia --- meta/recipes-devtools/gcc/gcc-configure-common.inc | 9 +++++++++ meta/recipes-devtools/gcc/gcc-multilib-config.inc | 5 +++++ .../0016-handle-sysroot-support-for-nativesdk-gcc.patch | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/meta/recipes-devtools/gcc/gcc-configure-common.inc b/meta/recipes-devtools/gcc/gcc-configure-common.inc index 5c79936242..bd5c953334 100644 --- a/meta/recipes-devtools/gcc/gcc-configure-common.inc +++ b/meta/recipes-devtools/gcc/gcc-configure-common.inc @@ -73,6 +73,14 @@ SYSTEMHEADERS = "${target_includedir}" SYSTEMLIBS = "${target_base_libdir}/" SYSTEMLIBS1 = "${target_libdir}/" +def tune_target_relocatable_prefix(d): + if d.getVar("SDK_ARCH") in ["x86_64", "i686", "i586"]: + return d.getVar("root_prefix") + else: + return d.getVar("SYSTEMLIBS") +TARGET_RELOCATE_PREFIX = "${SYSTEMLIBS}" +TARGET_RELOCATE_PREFIX:class-nativesdk = "${@tune_target_relocatable_prefix(d)}" + do_configure:prepend () { # teach gcc to find correct target includedir when checking libc ssp support mkdir -p ${B}/gcc @@ -83,6 +91,7 @@ do_configure:prepend () { #define STANDARD_STARTFILE_PREFIX_1 "${SYSTEMLIBS}" #define STANDARD_STARTFILE_PREFIX_2 "${SYSTEMLIBS1}" #define SYSTEMLIBS_DIR "${SYSTEMLIBS}" +#define TARGET_RELOCATE_PREFIX "${TARGET_RELOCATE_PREFIX}" #endif /* ! GCC_DEFAULTS_H */ _EOF mv ${B}/gcc/defaults.h.new ${B}/gcc/defaults.h diff --git a/meta/recipes-devtools/gcc/gcc-multilib-config.inc b/meta/recipes-devtools/gcc/gcc-multilib-config.inc index 2dbbc23c94..31336f75eb 100644 --- a/meta/recipes-devtools/gcc/gcc-multilib-config.inc +++ b/meta/recipes-devtools/gcc/gcc-multilib-config.inc @@ -172,6 +172,11 @@ python gcc_multilib_setup() { target_arch = (d.getVar('TARGET_ARCH_MULTILIB_ORIGINAL') if mlprefix else d.getVar('TARGET_ARCH')) if pn == "nativesdk-gcc": + if d.getVar('SDK_ARCH') in ['x86_64', 'i686', 'i586']: + libdir32 = '%r/lib' + libdir64 = '%r/lib64' + target_config_files = gcc_target_config_files[d.getVar("SDK_ARCH")] + write_config(builddir, target_config_files, ['m64', 'm32'], ['64', '32'], ['../lib64', '../lib']) header_config_files = gcc_header_config_files[d.getVar("SDK_ARCH")] write_headers(builddir, header_config_files, libdir32, libdir64, libdirx32, libdirn32) return diff --git a/meta/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch b/meta/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch index edd100ee46..7d96a42027 100644 --- a/meta/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch +++ b/meta/recipes-devtools/gcc/gcc/0016-handle-sysroot-support-for-nativesdk-gcc.patch @@ -389,7 +389,7 @@ index e3e9374d1cc..b080609341b 100644 #endif static const char *target_system_root = DEFAULT_TARGET_SYSTEM_ROOT; -+static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = SYSTEMLIBS_DIR; ++static char target_relocatable_prefix[4096] __attribute__ ((section (".gccrelocprefix"))) = TARGET_RELOCATE_PREFIX; + /* Nonzero means pass the updated target_system_root to the compiler. */ From patchwork Tue Jan 21 08:55:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 55892 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 8C8CFC0218B for ; Tue, 21 Jan 2025 08:55:41 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web10.11924.1737449736027164214 for ; Tue, 21 Jan 2025 00:55:36 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=31163e49e6=hongxu.jia@windriver.com) Received: from pps.filterd (m0250809.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50L8TTWV009201 for ; Tue, 21 Jan 2025 00:55:35 -0800 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 448cpq28yr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 21 Jan 2025 00:55:35 -0800 (PST) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Tue, 21 Jan 2025 00:55:35 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Tue, 21 Jan 2025 00:55:34 -0800 From: Hongxu Jia To: Subject: [PATCH 8/9] Add recipe nativesdk-multiconfig-multlib-toolchain-packager Date: Tue, 21 Jan 2025 16:55:25 +0800 Message-ID: <20250121085526.1370937-8-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250121085526.1370937-1-hongxu.jia@windriver.com> References: <20250121085526.1370937-1-hongxu.jia@windriver.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: MR1eoblNUCYZvG0BvYgMnMs2r4v4zQXZ X-Proofpoint-GUID: MR1eoblNUCYZvG0BvYgMnMs2r4v4zQXZ X-Authority-Analysis: v=2.4 cv=TdtstQQh c=1 sm=1 tr=0 ts=678f6107 cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=VdSt8ZQiCzkA:10 a=t7CeM3EgAAAA:8 a=PaQVhxr333NsTzhZ9hwA:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_04,2025-01-21_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 spamscore=0 priorityscore=1501 mlxscore=0 clxscore=1015 impostorscore=0 malwarescore=0 lowpriorityscore=0 bulkscore=0 mlxlogscore=999 adultscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2411120000 definitions=main-2501210072 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Jan 2025 08:55:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210080 Support two mutliconfig build x86 and x86_64: 1. Trigger a x86 multiconfig build to generate 32bit x86 buildtools-tarball. During package runtime installation, script postinst extracted 32bit x86 buildtools-tarball and installed it to 64bit x86_64 nativesdk sysroot. 2. Trigger a x86_64 multiconfig build to generate 64bit x86_64 buildtools-tarball. During package runtime installation, script postinst extracted 64bit x86_64 buildtools-tarball and installed it to 32bit x86 nativesdk sysroot. [ YOCTO #15722 ] Signed-off-by: Hongxu Jia --- ...ticonfig-multlib-toolchain-packager_0.1.bb | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 meta-selftest/recipes-test/multiconfig/nativesdk-multiconfig-multlib-toolchain-packager_0.1.bb diff --git a/meta-selftest/recipes-test/multiconfig/nativesdk-multiconfig-multlib-toolchain-packager_0.1.bb b/meta-selftest/recipes-test/multiconfig/nativesdk-multiconfig-multlib-toolchain-packager_0.1.bb new file mode 100644 index 0000000000..c742c3eddd --- /dev/null +++ b/meta-selftest/recipes-test/multiconfig/nativesdk-multiconfig-multlib-toolchain-packager_0.1.bb @@ -0,0 +1,74 @@ +DESCRIPTION = "Fetch 32bit x86 buildtools-tarball from x86 multiconfig build, \ +extract and install toolchain libraries and include files into 64bit nativesdk sysroot.\ +Or fetch 64bit x86_64 buildtools-tarball from x86_64 multiconfig build, \ +extract and install toolchain libraries and include files into 32bit nativesdk sysroot.\ +" +LICENSE = "GPL-2.0-only" +LIC_FILES_CHKSUM ?= "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6" + +inherit nativesdk + +MCSDK_ARCH:virtclass-mcextend-x86 = "i686" +MCSDK_ARCH:virtclass-mcextend-x86_64 = "x86_64" + +FROM_MULTICONFIG:virtclass-mcextend-x86_64 = "x86" +FROM_MULTICONFIG:virtclass-mcextend-x86 = "x86_64" + +TO_MULTICONFIG = "${MCNAME}" + +MC_SDK_DEPLOY = "${TOPDIR}/tmp-mc-${MCNAME}/deploy/sdk" +MC_TOOLCHAIN_OUTPUTNAME = "${MCSDK_ARCH}-buildtools-nativesdk-standalone-${DISTRO_VERSION}" + +# 64bit x86_64 platform requires 32bit x86 buildtools-tarball +# Or +# 32bit x86 platform requires 64bit buildtools-tarball +do_install[mcdepends] += "mc:${FROM_MULTICONFIG}:${TO_MULTICONFIG}:buildtools-tarball:do_build" +do_install () { + install -d ${D}${localstatedir}/machines/${MCNAME} + install ${MC_SDK_DEPLOY}/${MC_TOOLCHAIN_OUTPUTNAME}.sh ${D}${localstatedir}/machines/${MCNAME}/buildtools-tarball.sh +} + +MC_BASELIB:virtclass-mcextend-x86 = "lib" +MC_BASELIB:virtclass-mcextend-x86_64 = "lib64" + +INSTALL_FILES ?= " \ + /usr/include \ + /usr/${MC_BASELIB} \ + /${MC_BASELIB} \ +" +do_install[vardeps] += "INSTALL_FILES MC_SDK_DEPLOY MC_TOOLCHAIN_OUTPUTNAME" + +# Extract and install toolchain libraries and include files into nativesdk sysroot +pkg_postinst:${PN} () { + set -x + $D${localstatedir}/machines/${MCNAME}/buildtools-tarball.sh -y -d $D/sdk-${MCNAME} + src_prefix="$D/sdk-${MCNAME}/sysroots/${SDK_ARCH}${SDK_VENDOR}-${SDK_OS}" + for install_file in ${INSTALL_FILES}; do + if [ ! -e ${src_prefix}${install_file} ]; then + echo "${src_prefix}${install_file} does not exist" + exit 1 + elif [ -d ${src_prefix}${install_file} ]; then + install -d $D${SDKPATHNATIVE}${install_file} + cp -rf ${src_prefix}${install_file}/* $D${SDKPATHNATIVE}${install_file}/ + else + install -d $D${SDKPATHNATIVE}${install_file%/*} + cp -f ${src_prefix}${install_file} $D${SDKPATHNATIVE}${install_file} + fi + done + rm $D/sdk-${MCNAME} -rf +} + + +python () { + mcname = d.getVar('MCNAME') + if not mcname: + raise bb.parse.SkipRecipe("Not a multiconfig target") + + multiconfigs = d.getVar('BBMULTICONFIG') or "" + if mcname not in multiconfigs: + raise bb.parse.SkipRecipe("multiconfig target %s not enabled" % mcname) +} + +INSANE_SKIP = "native-last" + +BBCLASSEXTEND = "mcextend:x86 mcextend:x86_64" From patchwork Tue Jan 21 08:55:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hongxu Jia X-Patchwork-Id: 55888 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 867B5C02185 for ; Tue, 21 Jan 2025 08:55:41 +0000 (UTC) Received: from mx0a-0064b401.pphosted.com (mx0a-0064b401.pphosted.com [205.220.166.238]) by mx.groups.io with SMTP id smtpd.web10.11926.1737449737004337034 for ; Tue, 21 Jan 2025 00:55:37 -0800 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=permerror, err=parse error for token &{10 18 %{ir}.%{v}.%{d}.spf.has.pphosted.com}: invalid domain name (domain: windriver.com, ip: 205.220.166.238, mailfrom: prvs=31163e49e6=hongxu.jia@windriver.com) Received: from pps.filterd (m0250810.ppops.net [127.0.0.1]) by mx0a-0064b401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50L6I3Nd024929 for ; Tue, 21 Jan 2025 00:55:36 -0800 Received: from ala-exchng01.corp.ad.wrs.com (ala-exchng01.wrs.com [147.11.82.252]) by mx0a-0064b401.pphosted.com (PPS) with ESMTPS id 4488f72dj7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT) for ; Tue, 21 Jan 2025 00:55:36 -0800 (PST) Received: from ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) by ala-exchng01.corp.ad.wrs.com (147.11.82.252) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.43; Tue, 21 Jan 2025 00:55:35 -0800 Received: from pek-lpg-core5.wrs.com (147.11.136.210) by ALA-EXCHNG02.corp.ad.wrs.com (147.11.82.254) with Microsoft SMTP Server id 15.1.2507.43 via Frontend Transport; Tue, 21 Jan 2025 00:55:35 -0800 From: Hongxu Jia To: Subject: [PATCH 9/9] selftest/multiconfig: test multiconfig multlib nativesdk gcc Date: Tue, 21 Jan 2025 16:55:26 +0800 Message-ID: <20250121085526.1370937-9-hongxu.jia@windriver.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20250121085526.1370937-1-hongxu.jia@windriver.com> References: <20250121085526.1370937-1-hongxu.jia@windriver.com> MIME-Version: 1.0 X-Proofpoint-GUID: xfyS69c1wCFL25QKJKbV0Nq6TP9PGaV5 X-Authority-Analysis: v=2.4 cv=GqG4+l1C c=1 sm=1 tr=0 ts=678f6108 cx=c_pps a=/ZJR302f846pc/tyiSlYyQ==:117 a=/ZJR302f846pc/tyiSlYyQ==:17 a=VdSt8ZQiCzkA:10 a=t7CeM3EgAAAA:8 a=TOxOv8nXIum1QvLWbuQA:9 a=FdTzh2GWekK77mhwV6Dw:22 X-Proofpoint-ORIG-GUID: xfyS69c1wCFL25QKJKbV0Nq6TP9PGaV5 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-21_04,2025-01-21_02,2024-11-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 mlxlogscore=999 phishscore=0 lowpriorityscore=0 clxscore=1015 impostorscore=0 mlxscore=0 suspectscore=0 bulkscore=0 adultscore=0 spamscore=0 classifier=spam authscore=0 adjust=0 reason=mlx scancount=1 engine=8.21.0-2411120000 definitions=main-2501210072 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 21 Jan 2025 08:55:41 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210081 Add 2 cases to test multiconfig multlib nativesdk gcc 1. test_multiconfig_64bit_gcc_suport_32bit_multilib Build 64bit x86_64 buildtools-tarball with package nativesdk-multiconfig-multlib-toolchain-packager-x86. The recipe nativesdk-multiconfig-multlib-toolchain-packager trigger a x86 multiconfig build to generate 32bit x86 buildtools-tarball which contains minimal 32bit toolchains libraries and include files. The package nativesdk-multiconfig-multlib-toolchain-packager-x86 extract 32bit x86 buildtools-tarball and installed it to 64bit x86_64 nativesdk sysroot. Then use 64bit gcc to compile 32bit and 64bit hello world program 2. test_multiconfig_32bit_gcc_suport_64bit_multilib Build 32bit i686 buildtools-tarball with package nativesdk-multiconfig-multlib-toolchain-packager-x86_64. The recipe nativesdk-multiconfig-multlib-toolchain-packager trigger a x86_64 multiconfig build to generate 64bit x86_64 buildtools-tarball which contains minimal 64bit toolchains libraries and include files. The package nativesdk-multiconfig-multlib-toolchain-packager-x86_64 extract 64bit x86_64 buildtools-tarball and installed it to 64bit x86_64 nativesdk sysroot. Then use 32bit gcc to compile 32bit and 64bit hello world program ... 2025-01-20 22:08:15,003 - oe-selftest - INFO - ... ok 2025-01-20 22:08:15,004 - oe-selftest - INFO - test_multiconfig_32bit_gcc_suport_64bit_multilib (multiconfig.MultiConfig) 2025-01-20 22:17:13,046 - oe-selftest - INFO - ... ok 2025-01-20 22:17:13,047 - oe-selftest - INFO - test_multiconfig_64bit_gcc_suport_32bit_multilib (multiconfig.MultiConfig) ... [ YOCTO #15722 ] Signed-off-by: Hongxu Jia --- meta/lib/oeqa/selftest/cases/multiconfig.py | 139 +++++++++++++++++++- 1 file changed, 138 insertions(+), 1 deletion(-) diff --git a/meta/lib/oeqa/selftest/cases/multiconfig.py b/meta/lib/oeqa/selftest/cases/multiconfig.py index f509cbf607..5757612ee3 100644 --- a/meta/lib/oeqa/selftest/cases/multiconfig.py +++ b/meta/lib/oeqa/selftest/cases/multiconfig.py @@ -7,7 +7,7 @@ import os import textwrap from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import bitbake +from oeqa.utils.commands import bitbake, runCmd, get_bb_vars class MultiConfig(OESelftestTestCase): @@ -85,3 +85,140 @@ BBMULTICONFIG = "muslmc" # Build a core-image-minimal, only dry run needed to check config is present bitbake('mc:muslmc:bash -n') + + def _run_multilib_nativesdk_gcc(self, environment_script_path, c_example_src): + def runCmdEnv(cmd): + cmd = '/bin/sh -c ". %s > /dev/null && %s"' % ( + environment_script_path, cmd) + self.logger.debug(cmd) + result = runCmd(cmd) + self.logger.debug(f"ret: {result.status}, output {result.output}") + return result + + runCmdEnv('which gcc') + self.logger.debug(f"c_example_src {c_example_src}") + result = runCmdEnv("gcc -m32 %s -o main-32 && ./main-32" % (c_example_src)) + self.assertEqual("Hello world!", result.output, "Compile 32 bit program failed") + result = runCmdEnv("gcc -m64 %s -o main-64 && ./main-64" % (c_example_src)) + self.assertEqual("Hello world!", result.output, "Compile 64 bit program failed") + + def test_multiconfig_64bit_gcc_suport_32bit_multilib(self): + """ + Build 64bit x86_64 buildtools-extended-tarball with package nativesdk-multiconfig-multlib-toolchain-packager-x86. + The recipe nativesdk-multiconfig-multlib-toolchain-packager trigger a x86 multiconfig + build to generate 32bit x86 buildtools-tarball which contains minimal 32bit toolchains + libraries and include files. The package nativesdk-multiconfig-multlib-toolchain-packager-x86 + extract 32bit x86 buildtools-tarball and installed it to 64bit x86_64 nativesdk sysroot. + Then use 64bit gcc to compile 32bit and 64bit hello world program + """ + + config = """ +BBMULTICONFIG = "x86 x86_64" +# Unify the same SDKPATHNATIVE for two multiconfig, otherwise +# nativesdk relocation will fail +SDKPATHNATIVE = "${SDKPATH}/sysroots/x86_64${SDK_VENDOR}-${SDK_OS}" +""" + self.write_config(config) + + x86config = """ +SDKMACHINE = "i686" +TMPDIR = "${TOPDIR}/tmp-mc-x86" +# Only install 32bit toolchains library and include files to buildtools-tarball +TOOLCHAIN_HOST_TASK:pn-buildtools-tarball = "nativesdk-libgcc nativesdk-libgcc-dev nativesdk-glibc nativesdk-glibc-dev nativesdk-sdk-provides-dummy nativesdk-buildtools-perl-dummy" +# Do not add relocate script to buildtools-tarball +SDK_RELOCATE_AFTER_INSTALL:pn-buildtools-tarball = "0" +""" + self.write_config(x86config, 'x86') + + x86_64config = """ +SDKMACHINE = "x86_64" +TMPDIR = "${TOPDIR}/tmp-mc-x86_64" +TOOLCHAIN_HOST_TASK:append:pn-buildtools-extended-tarball = " nativesdk-multiconfig-multlib-toolchain-packager-x86" +# lib64 in 64bit nativesdk sysroot, avoid conflict with 32bit lib +baselib:class-nativesdk= "lib64" +baselib:class-crosssdk= "lib64" +libdir_nativesdk = "${prefix_nativesdk}/lib64" +base_libdir_nativesdk = "/lib64" +""" + self.write_config(x86_64config, 'x86_64') + + bitbake('mc:x86_64:buildtools-extended-tarball') + + needed_vars = ['TOPDIR', 'DISTRO_VERSION', 'COREBASE', 'SDK_VENDOR'] + bb_vars = get_bb_vars(needed_vars) + + c_example_src = os.path.join( + bb_vars['COREBASE'], + 'meta-skeleton/recipes-skeleton/hello-single/files/helloworld.c' + ) + sdk_name = 'x86_64-buildtools-extended-nativesdk-standalone-%s.sh' % bb_vars['DISTRO_VERSION'] + sdk_path = os.path.join(bb_vars['TOPDIR'], 'tmp-mc-x86_64/deploy/sdk', sdk_name) + self.logger.debug(f"sdk_path {sdk_path}") + runCmd('sh %s -y -d "%s"' % (sdk_path, './sdk-test')) + + environment_script = 'environment-setup-x86_64%s-linux' % (bb_vars['SDK_VENDOR']) + environment_script_path = os.path.join('./sdk-test', environment_script) + + self._run_multilib_nativesdk_gcc(environment_script_path, c_example_src) + + def test_multiconfig_32bit_gcc_suport_64bit_multilib(self): + """ + Build 32bit i686 buildtools-extended-tarball with package nativesdk-multiconfig-multlib-toolchain-packager-x86_64. + The recipe nativesdk-multiconfig-multlib-toolchain-packager trigger a x86_64 multiconfig + build to generate 64bit x86_64 buildtools-tarball which contains minimal 64bit toolchains + libraries and include files. The package nativesdk-multiconfig-multlib-toolchain-packager-x86_64 + extract 64bit x86_64 buildtools-tarball and installed it to 64bit x86_64 nativesdk sysroot. + Then use 64bit gcc to compile 32bit and 64bit hello world program + """ + + config = """ +BBMULTICONFIG = "x86 x86_64" +# Unify the same SDKPATHNATIVE for two multiconfig, otherwise +# nativesdk relocation will fail +SDKPATHNATIVE = "${SDKPATH}/sysroots/i686${SDK_VENDOR}-${SDK_OS}" +""" + self.write_config(config) + + x86config = """ +SDKMACHINE = "i686" +TMPDIR = "${TOPDIR}/tmp-mc-x86" +TOOLCHAIN_HOST_TASK:append:pn-buildtools-extended-tarball = " nativesdk-multiconfig-multlib-toolchain-packager-x86_64" +""" + self.write_config(x86config, 'x86') + + x86_64config = """ +SDKMACHINE = "x86_64" +TMPDIR = "${TOPDIR}/tmp-mc-x86_64" +# Only install 64bit toolchains library and include files to buildtools-tarball +TOOLCHAIN_HOST_TASK:pn-buildtools-tarball = "nativesdk-libgcc nativesdk-libgcc-dev nativesdk-glibc nativesdk-glibc-dev nativesdk-sdk-provides-dummy nativesdk-buildtools-perl-dummy" +# Do not add relocate script to buildtools-tarball +SDK_RELOCATE_AFTER_INSTALL:pn-buildtools-tarball = "0" + +# lib64 in 64bit nativesdk sysroot, avoid conflict with 32bit lib +baselib:class-nativesdk= "lib64" +baselib:class-crosssdk= "lib64" +libdir_nativesdk = "${prefix_nativesdk}/lib64" +base_libdir_nativesdk = "/lib64" +""" + self.write_config(x86_64config, 'x86_64') + + bitbake('mc:x86:buildtools-extended-tarball') + + needed_vars = ['TOPDIR', 'DISTRO_VERSION', 'COREBASE', 'SDK_VENDOR'] + bb_vars = get_bb_vars(needed_vars) + + c_example_src = os.path.join( + bb_vars['COREBASE'], + 'meta-skeleton/recipes-skeleton/hello-single/files/helloworld.c' + ) + sdk_name = 'i686-buildtools-extended-nativesdk-standalone-%s.sh' % bb_vars['DISTRO_VERSION'] + + sdk_path = os.path.join(bb_vars['TOPDIR'], 'tmp-mc-x86/deploy/sdk', sdk_name) + self.logger.debug(f"sdk_path {sdk_path}") + runCmd('sh %s -y -d "%s"' % (sdk_path, './sdk-test')) + + environment_script = 'environment-setup-i686%s-linux' % (bb_vars['SDK_VENDOR']) + environment_script_path = os.path.join('./sdk-test', environment_script) + + self._run_multilib_nativesdk_gcc(environment_script_path, c_example_src) +