Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no SIGSTKFLT on sparc? #408

Closed
gyakovlev opened this issue Sep 25, 2022 · 1 comment · Fixed by #417
Closed

no SIGSTKFLT on sparc? #408

gyakovlev opened this issue Sep 25, 2022 · 1 comment · Fixed by #417

Comments

@gyakovlev
Copy link

Hi,

rust-1.64.0 added vendored rustix-0.35.6

and now rustc fails to build on sparc.

I think sparc/sparc64 needs similar treatment to mips/mips64 wrt SIGSTKFLT

downstream bug: https://bugs.gentoo.org/872725

full build log: https://bugs.gentoo.org/attachment.cgi?id=814030

build log snip:

error[E0425]: cannot find value `SIGSTKFLT` in crate `c`
   --> /var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/vendor/rustix/src/imp/libc/process/types.rs:205:17
    |
205 |     Stkflt = c::SIGSTKFLT,
    |                 ^^^^^^^^^ help: a constant with a similar name exists: `SIGSTKSZ`
    |
   ::: /var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/vendor/libc/src/unix/linux_like/linux/gnu/b64/sparc64/mod.rs:446:1
    |
446 | pub const SIGSTKSZ: ::size_t = 16384;
    | ------------------------------------- similarly named constant `SIGSTKSZ` defined here

error[E0531]: cannot find unit struct, unit variant or constant `SIGSTKFLT` in crate `c`
[...]
error: could not compile `rustix` due to 3 previous errors; 10 warnings emitted

Caused by:
  process didn't exit successfully: `CARGO=/usr/lib/rust/1.63.0/bin/cargo CARGO_CRATE_NAME=rustix CARGO_MANIFEST_DIR=/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/vendor/rustix CARGO_PKG_AUTHORS='Dan Gohman <[dev@sunfishcode.online](mailto:dev@sunfishcode.online)>:Jakub Konka <[kubkon@jakubkonka.com](mailto:kubkon@jakubkonka.com)>' CARGO_PKG_DESCRIPTION='Safe Rust bindings to POSIX/Unix/Linux/Winsock2-like syscalls' CARGO_PKG_HOMEPAGE='' CARGO_PKG_LICENSE='Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT' CARGO_PKG_LICENSE_FILE='' CARGO_PKG_NAME=rustix CARGO_PKG_REPOSITORY='https://github.com/bytecodealliance/rustix' CARGO_PKG_RUST_VERSION='' CARGO_PKG_VERSION=0.35.6 CARGO_PKG_VERSION_MAJOR=0 CARGO_PKG_VERSION_MINOR=35 CARGO_PKG_VERSION_PATCH=6 CARGO_PKG_VERSION_PRE='' LD_LIBRARY_PATH='/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/bootstrap/debug/deps:/usr/lib/rust/1.63.0/lib:' OUT_DIR=/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/bootstrap/debug/build/rustix-c545a2ac80fd0af8/out /usr/lib/rust/1.63.0/bin/rustc --crate-name rustix --edition=2018 /var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/vendor/rustix/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=0 --cfg 'feature="default"' --cfg 'feature="fs"' --cfg 'feature="io-lifetimes"' --cfg 'feature="std"' -C metadata=45510bcf649eb595 -C extra-filename=-45510bcf649eb595 --out-dir /var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/bootstrap/debug/deps -L dependency=/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/bootstrap/debug/deps --extern bitflags=/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/bootstrap/debug/deps/libbitflags-239db34e64ae628d.rmeta --extern libc_errno=/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/bootstrap/debug/deps/liberrno-5a163241a2553a6f.rmeta --extern io_lifetimes=/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/bootstrap/debug/deps/libio_lifetimes-38c82b3d4423d885.rmeta --extern libc=/var/tmp/portage/dev-lang/rust-1.64.0/work/rustc-1.64.0-src/build/bootstrap/debug/deps/liblibc-f41fd3c181356920.rmeta --cap-lints warn -C linker=sparc64-unknown-linux-gnu-gcc -Wrust_2018_idioms -Wunused_lifetimes -Wsemicolon_in_expressions_from_macros -Dwarnings --cfg libc` (exit status: 1)
@gyakovlev
Copy link
Author

--- a/vendor/rustix/src/imp/libc/process/types.rs
+++ b/vendor/rustix/src/imp/libc/process/types.rs
@@ -197,6 +197,8 @@ pub enum Signal {
         target_os = "macos",
         target_os = "netbsd",
         target_os = "openbsd",
+        target_arch = "sparc",
+        target_arch = "sparc64",
         all(
             any(target_os = "android", target_os = "linux"),
             any(target_arch = "mips", target_arch = "mips64"),
@@ -274,6 +276,8 @@ impl Signal {
                 target_os = "macos",
                 target_os = "netbsd",
                 target_os = "openbsd",
+                target_arch = "sparc",
+                target_arch = "sparc64",
                 all(
                     any(target_os = "android", target_os = "linux"),
                     any(target_arch = "mips", target_arch = "mips64"),
diff --git a/vendor/rustix/src/imp/linux_raw/process/types.rs b/vendor/rustix/src/imp/linux_raw/process/types.rs
index 53e2c7d..859a108 100644
--- a/vendor/rustix/src/imp/linux_raw/process/types.rs
+++ b/vendor/rustix/src/imp/linux_raw/process/types.rs
@@ -119,7 +119,7 @@ pub enum Signal {
     /// `SIGTERM`
     Term = linux_raw_sys::general::SIGTERM,
     /// `SIGSTKFLT`
-    #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
+    #[cfg(not(any(target_arch = "mips", target_arch = "mips64", target_arch = "sparc", target_arch = "sparc64")))]
     Stkflt = linux_raw_sys::general::SIGSTKFLT,
     /// `SIGCHLD`
     #[doc(alias = "Chld")]
@@ -179,7 +179,7 @@ impl Signal {
             linux_raw_sys::general::SIGPIPE => Some(Self::Pipe),
             linux_raw_sys::general::SIGALRM => Some(Self::Alarm),
             linux_raw_sys::general::SIGTERM => Some(Self::Term),
-            #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))]
+            #[cfg(not(any(target_arch = "mips", target_arch = "mips64", target_arch = "sparc", target_arch = "sparc64")))]
             linux_raw_sys::general::SIGSTKFLT => Some(Self::Stkflt),
             linux_raw_sys::general::SIGCHLD => Some(Self::Child),
             linux_raw_sys::general::SIGCONT => Some(Self::Cont),

this diff against old rustix before imp -> backend rename allows me build rust on sparc64.
I probably got conditions not exactly right, it's just POC.

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Sep 25, 2022
Issue: bytecodealliance/rustix#408
Bug: https://bugs.gentoo.org/872725
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
expeditioneer pushed a commit to expeditioneer/gentoo-portage that referenced this issue Sep 27, 2022
Issue: bytecodealliance/rustix#408
Bug: https://bugs.gentoo.org/872725
Signed-off-by: Georgy Yakovlev <gyakovlev@gentoo.org>
sunfishcode added a commit that referenced this issue Sep 27, 2022
Adjust cfg's as needed to fix compilation errors on sparc.

Fixes #408.
sunfishcode added a commit that referenced this issue Sep 27, 2022
* Fix compilation on sparc targets.

Adjust cfg's as needed to fix compilation errors on sparc.

Fixes #408.

* Rust's 32-bit sparc Linux target has a 32-bit time_t.
sunfishcode added a commit that referenced this issue Sep 27, 2022
* Fix compilation on sparc targets.

Adjust cfg's as needed to fix compilation errors on sparc.

Fixes #408.

* Rust's 32-bit sparc Linux target has a 32-bit time_t.
sunfishcode added a commit that referenced this issue Sep 27, 2022
* Fix compilation on sparc targets.

Adjust cfg's as needed to fix compilation errors on sparc.

Fixes #408.

* Rust's 32-bit sparc Linux target has a 32-bit time_t.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant