From patchwork Thu Dec 29 07:12:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 17323 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 48A1AC4332F for ; Thu, 29 Dec 2022 07:12:40 +0000 (UTC) Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) by mx.groups.io with SMTP id smtpd.web10.199609.1672297955055597638 for ; Wed, 28 Dec 2022 23:12:35 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=G8iG7Y46; spf=pass (domain: gmail.com, ip: 209.85.214.178, mailfrom: raj.khem@gmail.com) Received: by mail-pl1-f178.google.com with SMTP id u7so18148124plq.11 for ; Wed, 28 Dec 2022 23:12:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Si/HbMatq5HpXjLGrp84fR9IIrk/j1bYZuU+XR1Dlm0=; b=G8iG7Y469siaCiqkNdJPOoNP8UrE+MXNJhLV6seaiKZEZglBzySqTMxIXFr8NnyeB6 TxevI7ERz3yFYTv8oiNXzQJcJCucK1emSDzULymoX0hi8saBhwsEYVAdhQPF980cBR3V NWpwo6bAR6DK1bCwb+t6lTO1gqTaTzWRXMnP4/8L6ckSSbZkvqu0x2iddMita+g/D4bU dTUOUR6zbWlrTebhlqG3K9nr5sLJ2UXu56h2XngB3/0TdhOKqK0ygYkMXvD6VW+wPb9t AKsmcE6QjUsvxyiveSWCjc+qWaVyi51yU/sWjMhNSEHCAfYloFVowJh7SpaCYXCJYybx pzLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Si/HbMatq5HpXjLGrp84fR9IIrk/j1bYZuU+XR1Dlm0=; b=rfuUQ8NXP4g8dyt0nkS+xLY8GoxeybqHo8XLkP2UWwG6UaBUUk/7i3SFoC7Aoo3kCK FESWiXXue7HyCWmbG4Qmj/Xp835GftBvJShi710Ze6Vd/x6K9b6EZj7SVprdn8Ja+sb6 FB0z1/DzFziHBSNlydK6OOLst/iw/KIwBcpJ4X5dntbxvHHFwfqoQ8pQbdGdDDB/uX/L 2FRHbbAPkM8BppsAQsux617m3WDJZweE9G7cUEyHrl4BNpcWGK/vgwhkQaP8M/1S/YRs JlB5aZ2AT0vyiWt18JTFueUmIv/S7dVh5I5+nHzTeM7RnnpLlaxCwNldjeQyGlq6D12F /hxw== X-Gm-Message-State: AFqh2kp8ca8Lf/Mxjquphb3f+cfISc7cufurdVlnR38La7yjw3w+uJMA Q4lYX/9LCexlIchZH4UNE7RHiJEG93E= X-Google-Smtp-Source: AMrXdXuDnJcmDhY4vXJWV3RMBa+pwIsxRHLTJjffKGF7HEP1Iu1JMB0xAACw74XZS9SK5NXU7S6IBw== X-Received: by 2002:a05:6a21:1707:b0:af:7773:9535 with SMTP id nv7-20020a056a21170700b000af77739535mr32635052pzb.33.1672297953783; Wed, 28 Dec 2022 23:12:33 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9181:1cf0::bccc]) by smtp.gmail.com with ESMTPSA id n16-20020a63ee50000000b004812f798a37sm10398347pgk.60.2022.12.28.23.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 23:12:33 -0800 (PST) From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj Subject: [PATCH 1/3] rust: Do not use open64 on musl in getrandom crate Date: Wed, 28 Dec 2022 23:12:29 -0800 Message-Id: <20221229071231.4107849-1-raj.khem@gmail.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 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 ; Thu, 29 Dec 2022 07:12:40 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/175091 LFS64 functions are deprecated in latest musl Signed-off-by: Khem Raj --- meta/recipes-devtools/rust/rust-source.inc | 1 + .../rust/rust/getrandom-open64.patch | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 meta/recipes-devtools/rust/rust/getrandom-open64.patch diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc index b63e18ac95..f94d616d26 100644 --- a/meta/recipes-devtools/rust/rust-source.inc +++ b/meta/recipes-devtools/rust/rust-source.inc @@ -3,6 +3,7 @@ SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;n SRC_URI[rust.sha256sum] = "0dc176e34fae9871f855a6ba4cb30fa19d69c5b4428d29281a07419c4950715c" SRC_URI:append:class-target:pn-rust = " \ + file://getrandom-open64.patch \ file://hardcodepaths.patch \ file://crossbeam_atomic.patch" SRC_URI:append:class-nativesdk:pn-nativesdk-rust = " file://hardcodepaths.patch" diff --git a/meta/recipes-devtools/rust/rust/getrandom-open64.patch b/meta/recipes-devtools/rust/rust/getrandom-open64.patch new file mode 100644 index 0000000000..6fc981e2aa --- /dev/null +++ b/meta/recipes-devtools/rust/rust/getrandom-open64.patch @@ -0,0 +1,29 @@ +Do not use open64 on linux with musl + +glibc is providing open64 and other lfs64 functions but musl aliases +them to normal equivalents since off_t is always 64-bit on musl, +therefore check for target env along when target OS is linux before +using open64, this is more available. Latest Musl has made these +namespace changes [1] + +[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4 + +Upstream-Status: Submitted [https://github.com/rust-random/getrandom/pull/326] +Signed-off-by: Khem Raj +--- a/vendor/getrandom-0.2.0/.cargo-checksum.json ++++ b/vendor/getrandom-0.2.0/.cargo-checksum.json +@@ -1 +1 @@ +-{"files":{"CHANGELOG.md":"4a5b61c82668507beffc7ad33f602257013263d7847cf17a246ef1128ba27950","Cargo.toml":"b59322815506cf16acd6e0cbe2634dec1be0886e686b51fa5cdf5a5ac9fdcf32","LICENSE-APACHE":"aaff376532ea30a0cd5330b9502ad4a4c8bf769c539c87ffe78819d188a18ebf","LICENSE-MIT":"209fbbe0ad52d9235e37badf9cadfe4dbdc87203179c0899e738b39ade42177b","README.md":"e0bacefbe4310c23578c65926bda6e4318750f6718bb6b97ff9a4fa9056af6a6","benches/mod.rs":"5495735ff210a50cab23c2cc84191ed910af7c30395a3d9d6095b722765b3864","build.rs":"90355b5e76dedd97d604cd83b4a0a5ab074bbd4dde9632ee2b56c87c175b1e14","src/bsd_arandom.rs":"d2ee195acd80c7d1364a369ad0d2dad46f5f9f973f9d3960367413fd87acfcd6","src/cloudabi.rs":"9201af65a607587aa8615ec92cfab9d176f4199f6799dad9ca743c51d175028b","src/custom.rs":"f75ef80ec024fe3c97c7faff79de9f7d457993ed3c5f69f21593e140c8b62790","src/error.rs":"f40aa6cb36bc024285dc2e40349fdd3754db949a307ec73831ec253549d2b0a3","src/error_impls.rs":"733ed75ab89a9d0d5a7cc7abd85f31a23d772ea9c1e7c10def1477207d19fd8b","src/fuchsia.rs":"470d8509deb5b06fa6417f294c0a49e0e35a580249a5d8944c3be5aa746f64ea","src/ios.rs":"cc46ee9c48ab746d2af342a242e383b8de840045d3f52fd77ee337161367a1a1","src/lib.rs":"6aff4b429e4b1a07aad2ab7148d7cc9d0987b230597649af42041508320592e0","src/linux_android.rs":"39cb80999c8534145240a350976d261b8924436bf9a4563960c7bd8c2c83c773","src/macos.rs":"b692f2fcc2319a5195f47751d5bd7dd87c7c24a61d14fa4e3dbc992ae66212b7","src/openbsd.rs":"066b2dd395c190444a658bb0b52a052eabbd68ea5a534fb729c7e5373abc0a6a","src/rdrand.rs":"79d23183b1905d61bd9df9729dc798505a2ed750d3339e342ab144e1709827e4","src/solaris_illumos.rs":"9c7004446fabe5a7a21c73d5a65d7e2115b5bd1d1dbb735c984cab3dba239785","src/stdweb.rs":"f140081e47cfbb61937212e7840391bce5adf7829039d732d62b82a19e567dfa","src/test_common.rs":"895d71c06722e3a6f365999d29430f37f571aeb1eb4a525777b760005c9818be","src/test_rdrand.rs":"8c8df6de836463a41808396016428bf0a2a69c715ae96e7e0e7598fcea61ace8","src/use_file.rs":"c9fe635a83614be6f303e40f98b8e678c36ac6d9724b024430d3ea1ad1510add","src/util.rs":"da6964dc1523f1cb8d26365fa6a8ece46360587e6974931624b271f0c72cda8b","src/util_libc.rs":"d851394bc9c43dc09afde1e03401aa6c207858ec58fdffbc5131911b116418c7","src/vxworks.rs":"a5aa0e40f890e0f35626458bb656a3340b8af3111e4bacd2e12505a8d50a3505","src/wasi.rs":"3413e5a391b156f5d05600f4651f7f8eb4df2c8984fca7766ca50c0cfe0b2e9c","src/wasm-bindgen.rs":"0648388724c46697a9b3c654b8d931b2bf187a3193ca1888221d4529f764e376","src/windows.rs":"39dfae2814d958993619c3654bb39745de897971aea7a414fa32f90770850ce2","src/windows_uwp.rs":"672f41a0fac79a71bfaaecad59826c948b8538f69a0133ab1c09a1865ecd6114"},"package":"ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4"} +\ No newline at end of file ++{"files":{"CHANGELOG.md":"4a5b61c82668507beffc7ad33f602257013263d7847cf17a246ef1128ba27950","Cargo.toml":"b59322815506cf16acd6e0cbe2634dec1be0886e686b51fa5cdf5a5ac9fdcf32","LICENSE-APACHE":"aaff376532ea30a0cd5330b9502ad4a4c8bf769c539c87ffe78819d188a18ebf","LICENSE-MIT":"209fbbe0ad52d9235e37badf9cadfe4dbdc87203179c0899e738b39ade42177b","README.md":"e0bacefbe4310c23578c65926bda6e4318750f6718bb6b97ff9a4fa9056af6a6","benches/mod.rs":"5495735ff210a50cab23c2cc84191ed910af7c30395a3d9d6095b722765b3864","build.rs":"90355b5e76dedd97d604cd83b4a0a5ab074bbd4dde9632ee2b56c87c175b1e14","src/bsd_arandom.rs":"d2ee195acd80c7d1364a369ad0d2dad46f5f9f973f9d3960367413fd87acfcd6","src/cloudabi.rs":"9201af65a607587aa8615ec92cfab9d176f4199f6799dad9ca743c51d175028b","src/custom.rs":"f75ef80ec024fe3c97c7faff79de9f7d457993ed3c5f69f21593e140c8b62790","src/error.rs":"f40aa6cb36bc024285dc2e40349fdd3754db949a307ec73831ec253549d2b0a3","src/error_impls.rs":"733ed75ab89a9d0d5a7cc7abd85f31a23d772ea9c1e7c10def1477207d19fd8b","src/fuchsia.rs":"470d8509deb5b06fa6417f294c0a49e0e35a580249a5d8944c3be5aa746f64ea","src/ios.rs":"cc46ee9c48ab746d2af342a242e383b8de840045d3f52fd77ee337161367a1a1","src/lib.rs":"6aff4b429e4b1a07aad2ab7148d7cc9d0987b230597649af42041508320592e0","src/linux_android.rs":"39cb80999c8534145240a350976d261b8924436bf9a4563960c7bd8c2c83c773","src/macos.rs":"b692f2fcc2319a5195f47751d5bd7dd87c7c24a61d14fa4e3dbc992ae66212b7","src/openbsd.rs":"066b2dd395c190444a658bb0b52a052eabbd68ea5a534fb729c7e5373abc0a6a","src/rdrand.rs":"79d23183b1905d61bd9df9729dc798505a2ed750d3339e342ab144e1709827e4","src/solaris_illumos.rs":"9c7004446fabe5a7a21c73d5a65d7e2115b5bd1d1dbb735c984cab3dba239785","src/stdweb.rs":"f140081e47cfbb61937212e7840391bce5adf7829039d732d62b82a19e567dfa","src/test_common.rs":"895d71c06722e3a6f365999d29430f37f571aeb1eb4a525777b760005c9818be","src/test_rdrand.rs":"8c8df6de836463a41808396016428bf0a2a69c715ae96e7e0e7598fcea61ace8","src/use_file.rs":"c9fe635a83614be6f303e40f98b8e678c36ac6d9724b024430d3ea1ad1510add","src/util.rs":"da6964dc1523f1cb8d26365fa6a8ece46360587e6974931624b271f0c72cda8b","src/util_libc.rs":"c602b47e2958fa94443b3690faddf52a8c545689d18579c86dd8a07927c145b1","src/vxworks.rs":"a5aa0e40f890e0f35626458bb656a3340b8af3111e4bacd2e12505a8d50a3505","src/wasi.rs":"3413e5a391b156f5d05600f4651f7f8eb4df2c8984fca7766ca50c0cfe0b2e9c","src/wasm-bindgen.rs":"0648388724c46697a9b3c654b8d931b2bf187a3193ca1888221d4529f764e376","src/windows.rs":"39dfae2814d958993619c3654bb39745de897971aea7a414fa32f90770850ce2","src/windows_uwp.rs":"672f41a0fac79a71bfaaecad59826c948b8538f69a0133ab1c09a1865ecd6114"},"package":"ee8025cf36f917e6a52cce185b7c7177689b838b7ec138364e50cc2277a56cf4"} +--- a/vendor/getrandom-0.2.0/src/util_libc.rs ++++ b/vendor/getrandom-0.2.0/src/util_libc.rs +@@ -97,7 +97,7 @@ impl Weak { + } + + cfg_if! { +- if #[cfg(any(target_os = "linux", target_os = "emscripten"))] { ++ if #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "emscripten"))] { + use libc::open64 as open; + } else { + use libc::open; From patchwork Thu Dec 29 07:12:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 17324 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 4A12EC3DA79 for ; Thu, 29 Dec 2022 07:12:40 +0000 (UTC) Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by mx.groups.io with SMTP id smtpd.web10.199610.1672297955447449409 for ; Wed, 28 Dec 2022 23:12:35 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=cgFLRu3s; spf=pass (domain: gmail.com, ip: 209.85.216.48, mailfrom: raj.khem@gmail.com) Received: by mail-pj1-f48.google.com with SMTP id p4so18415694pjk.2 for ; Wed, 28 Dec 2022 23:12:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=12j+/0ZBcegtxApdFKR+TgyLyqC1/yOXmhYSLVoOCsg=; b=cgFLRu3sqzhTqW6xo5Ka1VZO6CZjYPIj2jGZWUKzKAtlZrD2fw5fzFqOVonX4u87bZ qxwajbVby3BFKR7Ni4Y6iWCYsBj1zxIABs1HqLCioQOGUO94yNEf0vtTrp/GfMfjbRQk bmhFxx5JI+d6kn44VRp32D2vw0h4BOLUPZaEwyYZE48v+z5f2bmm48jS8lcsLv5CurDi 2aBJL92e8fZ6i/Sftbahu2Hc9EpxZ9vZCZ5jFu2+S3MGDWYHL5D3zxw50P8GH1oJAeS6 x6LNXfji13PQIlEA6d2T3vDlvC6peZjqd42W7zLkw6IbAz25IuMLIWr+58/xQh2NiS/A CdeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=12j+/0ZBcegtxApdFKR+TgyLyqC1/yOXmhYSLVoOCsg=; b=cw9Chu7xk6BGWiEj7/z2eqy35YyabiCc8hp573ChsMIh0ysnDlKFUKS3a6IqrqxGDo D9kPM5a/FwqJ3LE+8rnQCT2pqWYHbTai+RuNejrjTQ/4NFKpDHXIo4Cp/h3VG35C/rtc +ATtOwPrk5vNIX3CZvA/gOxIPFGEX+G/OuWAGWVjFk0Kqbsi2jDnPu1+YPGEmu7CslD3 /bSgqRqJEEa357LWe2wN8hFjVyg86W6TEu8PO1Zpj6MGsBlpHmXOqv5RHgLTaV7p/moh xeOxHlPl6jzD9PIc45lnO4icBeExCHLuiiv9LHDw/9PW74XNGaKevdrFoMLUlQDCU/7r 1GEw== X-Gm-Message-State: AFqh2koS939V4QUDtlEktE89HEKGgnWtpTWPEuVTlN6RelczLM+76J2V svvCPQih7Fc9PYKW6X11ZLW18LeMJLU= X-Google-Smtp-Source: AMrXdXuBjj+xpv/xLFcEMaJVPjcOXzUOP2v8rFCzilPlv+CKQxuOUgXLj4ypT6nQtpvyFcBAiDKzgw== X-Received: by 2002:a05:6a20:c491:b0:a2:df6d:e56b with SMTP id eo17-20020a056a20c49100b000a2df6de56bmr28410035pzb.14.1672297954525; Wed, 28 Dec 2022 23:12:34 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9181:1cf0::bccc]) by smtp.gmail.com with ESMTPSA id n16-20020a63ee50000000b004812f798a37sm10398347pgk.60.2022.12.28.23.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 23:12:34 -0800 (PST) From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj Subject: [PATCH 2/3] rust,libstd-rs: Fix build with latest musl Date: Wed, 28 Dec 2022 23:12:30 -0800 Message-Id: <20221229071231.4107849-2-raj.khem@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221229071231.4107849-1-raj.khem@gmail.com> References: <20221229071231.4107849-1-raj.khem@gmail.com> MIME-Version: 1.0 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 ; Thu, 29 Dec 2022 07:12:40 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/175092 newer musl do not provide lfs64 functions anymore since off_t is always 64bit on musl using normal functions would suffice Signed-off-by: Khem Raj --- ...-Do-not-use-LFS64-on-linux-with-musl.patch | 168 ++++++++++++++++++ meta/recipes-devtools/rust/rust-source.inc | 5 + 2 files changed, 173 insertions(+) create mode 100644 meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch diff --git a/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch b/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch new file mode 100644 index 0000000000..da72665bbd --- /dev/null +++ b/meta/recipes-devtools/rust/files/0001-Do-not-use-LFS64-on-linux-with-musl.patch @@ -0,0 +1,168 @@ +From 3ecce665198e3420d70139d86ed22e74804c9379 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Wed, 28 Dec 2022 22:35:55 -0800 +Subject: [PATCH] Do not use LFS64 on linux with musl + +glibc is providing open64 and other lfs64 functions but musl aliases +them to normal equivalents since off_t is always 64-bit on musl, +therefore check for target env along when target OS is linux before +using open64, this is more available. Latest Musl has made these +namespace changes [1] + +[1] https://git.musl-libc.org/cgit/musl/commit/?id=246f1c811448f37a44b41cd8df8d0ef9736d95f4 + +Upstream-Status: Submitted [https://github.com/rust-lang/rust/pull/106246] +Signed-off-by: Khem Raj +--- + library/std/src/os/linux/fs.rs | 9 ++++++++- + library/std/src/sys/unix/fd.rs | 14 ++++++++++---- + library/std/src/sys/unix/fs.rs | 27 ++++++++++++++++++++------- + 3 files changed, 38 insertions(+), 12 deletions(-) + +diff --git a/library/std/src/os/linux/fs.rs b/library/std/src/os/linux/fs.rs +index 479bbcc17a8..ab0b2a3eda3 100644 +--- a/library/std/src/os/linux/fs.rs ++++ b/library/std/src/os/linux/fs.rs +@@ -329,7 +329,14 @@ pub trait MetadataExt { + impl MetadataExt for Metadata { + #[allow(deprecated)] + fn as_raw_stat(&self) -> &raw::stat { +- unsafe { &*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat) } ++ #[cfg(target_env = "musl")] ++ unsafe { ++ &*(self.as_inner().as_inner() as *const libc::stat as *const raw::stat) ++ } ++ #[cfg(not(target_env = "musl"))] ++ unsafe { ++ &*(self.as_inner().as_inner() as *const libc::stat64 as *const raw::stat) ++ } + } + fn st_dev(&self) -> u64 { + self.as_inner().as_inner().st_dev as u64 +diff --git a/library/std/src/sys/unix/fd.rs b/library/std/src/sys/unix/fd.rs +index dbaa3c33e2e..5d31557bd11 100644 +--- a/library/std/src/sys/unix/fd.rs ++++ b/library/std/src/sys/unix/fd.rs +@@ -115,9 +115,12 @@ pub fn read_to_end(&self, buf: &mut Vec) -> io::Result { + } + + pub fn read_at(&self, buf: &mut [u8], offset: u64) -> io::Result { +- #[cfg(not(any(target_os = "linux", target_os = "android")))] ++ #[cfg(not(any( ++ all(target_os = "linux", not(target_env = "musl")), ++ target_os = "android" ++ )))] + use libc::pread as pread64; +- #[cfg(any(target_os = "linux", target_os = "android"))] ++ #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "android"))] + use libc::pread64; + + unsafe { +@@ -181,9 +184,12 @@ pub fn is_write_vectored(&self) -> bool { + } + + pub fn write_at(&self, buf: &[u8], offset: u64) -> io::Result { +- #[cfg(not(any(target_os = "linux", target_os = "android")))] ++ #[cfg(not(any( ++ all(target_os = "linux", not(target_env = "musl")), ++ target_os = "android" ++ )))] + use libc::pwrite as pwrite64; +- #[cfg(any(target_os = "linux", target_os = "android"))] ++ #[cfg(any(all(target_os = "linux", not(target_env = "musl")), target_os = "android"))] + use libc::pwrite64; + + unsafe { +diff --git a/library/std/src/sys/unix/fs.rs b/library/std/src/sys/unix/fs.rs +index aea0c26ee8b..e7be4729ca6 100644 +--- a/library/std/src/sys/unix/fs.rs ++++ b/library/std/src/sys/unix/fs.rs +@@ -45,19 +45,24 @@ + all(target_os = "linux", target_env = "gnu") + ))] + use libc::c_char; +-#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "android"))] ++#[cfg(any( ++ all(target_os = "linux", not(target_env = "musl")), ++ target_os = "emscripten", ++ target_os = "android" ++))] + use libc::dirfd; +-#[cfg(any(target_os = "linux", target_os = "emscripten"))] ++#[cfg(any(not(target_env = "musl"), target_os = "emscripten"))] + use libc::fstatat64; + #[cfg(any( + target_os = "android", + target_os = "solaris", + target_os = "fuchsia", + target_os = "redox", +- target_os = "illumos" ++ target_os = "illumos", ++ target_env = "musl" + ))] + use libc::readdir as readdir64; +-#[cfg(target_os = "linux")] ++#[cfg(all(target_os = "linux", not(target_env = "musl")))] + use libc::readdir64; + #[cfg(any(target_os = "emscripten", target_os = "l4re"))] + use libc::readdir64_r; +@@ -77,7 +82,13 @@ + dirent as dirent64, fstat as fstat64, fstatat as fstatat64, ftruncate64, lseek64, + lstat as lstat64, off64_t, open as open64, stat as stat64, + }; ++#[cfg(target_env = "musl")] ++use libc::{ ++ dirent as dirent64, fstat as fstat64, ftruncate as ftruncate64, lseek as lseek64, ++ lstat as lstat64, off_t as off64_t, open as open64, stat as stat64, ++}; + #[cfg(not(any( ++ target_env = "musl", + target_os = "linux", + target_os = "emscripten", + target_os = "l4re", +@@ -87,7 +98,7 @@ + dirent as dirent64, fstat as fstat64, ftruncate as ftruncate64, lseek as lseek64, + lstat as lstat64, off_t as off64_t, open as open64, stat as stat64, + }; +-#[cfg(any(target_os = "linux", target_os = "emscripten", target_os = "l4re"))] ++#[cfg(any(not(target_env = "musl"), target_os = "emscripten", target_os = "l4re"))] + use libc::{dirent64, fstat64, ftruncate64, lseek64, lstat64, off64_t, open64, stat64}; + + pub use crate::sys_common::fs::try_exists; +@@ -260,6 +271,7 @@ unsafe impl Sync for Dir {} + #[cfg(any( + target_os = "android", + target_os = "linux", ++ not(target_env = "musl"), + target_os = "solaris", + target_os = "illumos", + target_os = "fuchsia", +@@ -292,6 +304,7 @@ struct dirent64_min { + } + + #[cfg(not(any( ++ target_env = "musl", + target_os = "android", + target_os = "linux", + target_os = "solaris", +@@ -745,7 +758,7 @@ pub fn file_name(&self) -> OsString { + } + + #[cfg(all( +- any(target_os = "linux", target_os = "emscripten", target_os = "android"), ++ any(not(target_env = "musl"), target_os = "emscripten", target_os = "android"), + not(miri) + ))] + pub fn metadata(&self) -> io::Result { +@@ -769,7 +782,7 @@ pub fn metadata(&self) -> io::Result { + } + + #[cfg(any( +- not(any(target_os = "linux", target_os = "emscripten", target_os = "android")), ++ not(any(not(target_env = "musl"), target_os = "emscripten", target_os = "android")), + miri + ))] + pub fn metadata(&self) -> io::Result { +-- +2.39.0 + diff --git a/meta/recipes-devtools/rust/rust-source.inc b/meta/recipes-devtools/rust/rust-source.inc index f94d616d26..643494b37e 100644 --- a/meta/recipes-devtools/rust/rust-source.inc +++ b/meta/recipes-devtools/rust/rust-source.inc @@ -2,8 +2,13 @@ RUST_VERSION ?= "${@d.getVar('PV').split('-')[0]}" SRC_URI += "https://static.rust-lang.org/dist/rustc-${RUST_VERSION}-src.tar.xz;name=rust" SRC_URI[rust.sha256sum] = "0dc176e34fae9871f855a6ba4cb30fa19d69c5b4428d29281a07419c4950715c" +SRC_URI:append:class-target:pn-libstd-rs = "\ + file://0001-Do-not-use-LFS64-on-linux-with-musl.patch;patchdir=../.. \ +" + SRC_URI:append:class-target:pn-rust = " \ file://getrandom-open64.patch \ + file://0001-Do-not-use-LFS64-on-linux-with-musl.patch \ file://hardcodepaths.patch \ file://crossbeam_atomic.patch" SRC_URI:append:class-nativesdk:pn-nativesdk-rust = " file://hardcodepaths.patch" From patchwork Thu Dec 29 07:12:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Khem Raj X-Patchwork-Id: 17322 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 4B607C4708D for ; Thu, 29 Dec 2022 07:12:40 +0000 (UTC) Received: from mail-pj1-f42.google.com (mail-pj1-f42.google.com [209.85.216.42]) by mx.groups.io with SMTP id smtpd.web10.199611.1672297956316576280 for ; Wed, 28 Dec 2022 23:12:36 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ZGd2ovFi; spf=pass (domain: gmail.com, ip: 209.85.216.42, mailfrom: raj.khem@gmail.com) Received: by mail-pj1-f42.google.com with SMTP id ge16so14747942pjb.5 for ; Wed, 28 Dec 2022 23:12:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=IhOSW1EWDI7H+Nt3f87CvaLysn95E66VwShdpv9daRQ=; b=ZGd2ovFi3ypAk5xsulsoJppdc3LYQ75D56MeiFf8D3Z7kRxmKscQ3QiYAeg7PilVlg GEW4YQVBnDWzs1ChAVRIEViDKqQ+0TvX4M4LU6mYQafmVhzXiXBjomsptyjKuRJwmfk6 Ci8nD1LvtO7lCdiElCp0EZ4A7+6OHNTkfTFnjyu1VyNIQ1y/86TEaETAeuG/A8p+XTCH EPIbY4D01tOmdkaykoM2cdL/61v6mE7V0lWlg07HsGYdPDTIXaNYF6HJ69rU7EAO82m7 iM7X/iDu2XbCGVL0fj84ASOiA8RDtHjrOYeowO5/HXMYoFpxZea43LS82C+Ay8cjCy1b wiiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IhOSW1EWDI7H+Nt3f87CvaLysn95E66VwShdpv9daRQ=; b=pKySw7TkMfZawKWWIiBSaxt4C1HOjTMvM+g5OfqjiBv/Iz69o9QfhMdD1+hVWSH64A Zrv3egIpfwVgbsKwXFeXxY9Oa595sg4vJo7SYIOoDNmn5fLYPkSZqk7fbOnkwYtYGX5U QoHSa1CPyATRp9oADc7ZmnT6+SRs9u8lAyfdTeu5JPGDy4YaQHAdze/wR46/dny00U3A 8wqPksbWW3OT5IFJJ1qj9y/4AmYQzu+++6o9VKhM/MlIw9py/FXGlj8EnJ+7DMKuNf9n 2Wqrg7MuHzJTIiKbPnKgTg20E+QXf9bsB9rQXlD8HrcrZURHHGu9hhv2yDFDyQgoH2Ys 41lg== X-Gm-Message-State: AFqh2kqL8tiYXZQ56nXY3VxlqpZvE7GWNL1bYsNs2l523qaueE695XHz WAnFhQY9yHGHfgo8y9jGjcLg7thhaUk= X-Google-Smtp-Source: AMrXdXvW79dCsxdBElQB3TwP0D8bFaKDke1CCWPGXxYMOJpVGyc02tRK+vPJ1FXQWWaKA4rpsbO8Ug== X-Received: by 2002:a05:6a21:32a7:b0:ad:f2bf:bc50 with SMTP id yt39-20020a056a2132a700b000adf2bfbc50mr46015118pzb.13.1672297955447; Wed, 28 Dec 2022 23:12:35 -0800 (PST) Received: from apollo.hsd1.ca.comcast.net ([2601:646:9181:1cf0::bccc]) by smtp.gmail.com with ESMTPSA id n16-20020a63ee50000000b004812f798a37sm10398347pgk.60.2022.12.28.23.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Dec 2022 23:12:35 -0800 (PST) From: Khem Raj To: openembedded-core@lists.openembedded.org Cc: Khem Raj Subject: [PATCH 3/3] rust-llvm: Fix build on latest musl Date: Wed, 28 Dec 2022 23:12:31 -0800 Message-Id: <20221229071231.4107849-3-raj.khem@gmail.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221229071231.4107849-1-raj.khem@gmail.com> References: <20221229071231.4107849-1-raj.khem@gmail.com> MIME-Version: 1.0 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 ; Thu, 29 Dec 2022 07:12:40 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/175093 latest musl has removed lfs64 functions Signed-off-by: Khem Raj --- ...e-64bit-off_t-on-32bit-glibc-systems.patch | 79 +++++++++++++++++++ .../recipes-devtools/rust/rust-llvm_1.66.0.bb | 3 +- 2 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch diff --git a/meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch b/meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch new file mode 100644 index 0000000000..fe98e3e4c0 --- /dev/null +++ b/meta/recipes-devtools/rust/rust-llvm/0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch @@ -0,0 +1,79 @@ +From cd2fa12d715929642513fc441287c402f4560096 Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Sun, 25 Dec 2022 15:13:41 -0800 +Subject: [PATCH] build: Enable 64bit off_t on 32bit glibc systems + +Pass -D_FILE_OFFSET_BITS=64 to compiler flags on 32bit glibc based +systems. This will make sure that 64bit versions of LFS functions are +used e.g. lseek will behave same as lseek64. Also revert [1] partially +because this added a cmake test to detect lseek64 but then forgot to +pass the needed macro during actual compile, this test was incomplete too +since libc implementations like musl has 64-bit off_t by default on 32-bit +systems and does not bundle -D_LARGEFILE64_SOURCE [2] under -D_GNU_SOURCE +like glibc, which means the compile now fails on musl because the cmake +check passes but we do not have _LARGEFILE64_SOURCE defined. Moreover, +Using the *64 function was transitional anyways so use +-D_FILE_OFFSET_BITS=64 instead + +[1] https://github.com/llvm/llvm-project/commit/8db7e5e4eed4c4e697dc3164f2c9351d8c3e942b +[2] https://git.musl-libc.org/cgit/musl/commit/?id=25e6fee27f4a293728dd15b659170e7b9c7db9bc + +Upstream-Status: Submitted [https://reviews.llvm.org/D139752] +Signed-off-by: Khem Raj +--- + llvm/cmake/config-ix.cmake | 8 +++++--- + llvm/include/llvm/Config/config.h.cmake | 3 --- + llvm/lib/Support/raw_ostream.cpp | 2 -- + llvm/utils/gn/secondary/llvm/include/llvm/Config/BUILD.gn | 2 -- + utils/bazel/llvm-project-overlay/llvm/config.bzl | 1 - + .../llvm/include/llvm/Config/config.h | 3 --- + utils/bazel/llvm_configs/config.h.cmake | 3 --- + 7 files changed, 5 insertions(+), 17 deletions(-) + +--- a/llvm/cmake/config-ix.cmake ++++ b/llvm/cmake/config-ix.cmake +@@ -284,9 +284,6 @@ check_symbol_exists(futimes sys/time.h H + if( HAVE_SIGNAL_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*" AND NOT APPLE ) + check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK) + endif() +-set(CMAKE_REQUIRED_DEFINITIONS "-D_LARGEFILE64_SOURCE") +-check_symbol_exists(lseek64 "sys/types.h;unistd.h" HAVE_LSEEK64) +-set(CMAKE_REQUIRED_DEFINITIONS "") + check_symbol_exists(mallctl malloc_np.h HAVE_MALLCTL) + check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO) + check_symbol_exists(mallinfo2 malloc.h HAVE_MALLINFO2) +@@ -350,6 +347,11 @@ check_symbol_exists(__GLIBC__ stdio.h LL + if( LLVM_USING_GLIBC ) + add_definitions( -D_GNU_SOURCE ) + list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE") ++# enable 64bit off_t on 32bit systems using glibc ++ if (CMAKE_SIZEOF_VOID_P EQUAL 4) ++ add_compile_definitions(_FILE_OFFSET_BITS=64) ++ list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64") ++ endif() + endif() + # This check requires _GNU_SOURCE + if (NOT PURE_WINDOWS) +--- a/llvm/include/llvm/Config/config.h.cmake ++++ b/llvm/include/llvm/Config/config.h.cmake +@@ -128,9 +128,6 @@ + /* Define to 1 if you have the header file. */ + #cmakedefine HAVE_LINK_H ${HAVE_LINK_H} + +-/* Define to 1 if you have the `lseek64' function. */ +-#cmakedefine HAVE_LSEEK64 ${HAVE_LSEEK64} +- + /* Define to 1 if you have the header file. */ + #cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H} + +--- a/llvm/lib/Support/raw_ostream.cpp ++++ b/llvm/lib/Support/raw_ostream.cpp +@@ -804,8 +804,6 @@ uint64_t raw_fd_ostream::seek(uint64_t o + flush(); + #ifdef _WIN32 + pos = ::_lseeki64(FD, off, SEEK_SET); +-#elif defined(HAVE_LSEEK64) +- pos = ::lseek64(FD, off, SEEK_SET); + #else + pos = ::lseek(FD, off, SEEK_SET); + #endif diff --git a/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb b/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb index 4cf244bb67..4cc57d12ae 100644 --- a/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb +++ b/meta/recipes-devtools/rust/rust-llvm_1.66.0.bb @@ -10,7 +10,8 @@ require rust-source.inc SRC_URI += "file://0002-llvm-allow-env-override-of-exe-path.patch;striplevel=2 \ file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch;striplevel=2 \ - file://0003-llvm-fix-include-benchmarks.patch;striplevel=2" + file://0003-llvm-fix-include-benchmarks.patch;striplevel=2 \ + file://0035-cmake-Enable-64bit-off_t-on-32bit-glibc-systems.patch;striplevel=2" S = "${RUSTSRC}/src/llvm-project/llvm"