Skip to content

Disable unsupported signals on sparc-linux#2454

Merged
asomers merged 1 commit intonix-rust:masterfrom
glaubitz:sparc-linux
Jun 24, 2024
Merged

Disable unsupported signals on sparc-linux#2454
asomers merged 1 commit intonix-rust:masterfrom
glaubitz:sparc-linux

Conversation

@glaubitz
Copy link
Copy Markdown
Contributor

This PR fixes building nix on sparc-linux by disabling unsupported signals.

The unsupported signals match those of sparc64-linux.

@asomers
Copy link
Copy Markdown
Member

asomers commented Jun 24, 2024

Could you please post the error that you see when you try to build Nix without this patch?

@glaubitz
Copy link
Copy Markdown
Contributor Author

Sure, here you go:

   Compiling md-5 v0.10.6
   Compiling rand_chacha v0.3.1
   Compiling rand_xoshiro v0.6.0
error[E0425]: cannot find value `SIGSTKFLT` in crate `libc`
   --> /home/glaubitz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/sys/signal.rs:76:9
    |
76  |         SIGSTKFLT,
    |         ^^^^^^^^^
    |
   ::: /home/glaubitz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs:368:1
    |
368 | pub const SIGSTKSZ: ::size_t = 16384;
    | ---------------------------- similarly named constant `SIGSTKSZ` defined here
    |
help: a constant with a similar name exists
    |
76  |         SIGSTKSZ,
    |         ~~~~~~~~
help: consider importing this unit variant
    |
6   + use crate::sys::signal::Signal::SIGSTKFLT;
    |

error[E0531]: cannot find unit struct, unit variant or constant `SIGSTKFLT` in crate `libc`
   --> /home/glaubitz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/sys/signal.rs:76:9
    |
76  |         SIGSTKFLT,
    |         ^^^^^^^^^
    |
   ::: /home/glaubitz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/libc-0.2.155/src/unix/linux_like/linux/gnu/b32/sparc/mod.rs:368:1
    |
368 | pub const SIGSTKSZ: ::size_t = 16384;
    | ---------------------------- similarly named constant `SIGSTKSZ` defined here
    |
help: a constant with a similar name exists
    |
76  |         SIGSTKSZ,
    |         ~~~~~~~~
help: consider importing this unit variant
    |
6   + use crate::sys::signal::Signal::SIGSTKFLT;
    |

   Compiling measureme v11.0.1
   Compiling rand v0.8.5
   Compiling unicode-security v0.1.1
error[E0081]: discriminant value `16` assigned more than once
   --> /home/glaubitz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/macros.rs:131:9
    |
101 |                / macro_rules! libc_enum {
102 |                |     // Exit rule.
103 |                |     (@make_enum
104 |                |         name: $BitFlags:ident,
...                  |
131 |                /         $v enum $BitFlags {
132 |                              $($entries)*
133 |                |         }
    |                |_________^
...
180 |                /         libc_enum! {   
181 |                              @make_enum 
182 |                              name: $BitFlags,
183 |                              {
...
189 |                              }
190 |                |         }
    |                |_________- in this macro invocation (#15)
...
201 |                /         libc_enum! {   
202 |                |             @accumulate_entries
203 |                |             name: $BitFlags,
204 |                |             $prefix,   
...                  |
213 |                |             $($tail)*  
214 |                |         }
    |                |         -
    |                |_________|
    |                |_________in this macro invocation (#4)
    |                |_________in this macro invocation (#6)
    |                |_________in this macro invocation (#8)
    |                |_________in this macro invocation (#10)
    |                |_________in this macro invocation (#12)
    |                          in this macro invocation (#13)
...
249 |                /         libc_enum! {   
250 |                |             @accumulate_entries
251 |                |             name: $BitFlags,
252 |                |             $prefix,   
...                  |
255 |                |                 $entry = libc::$entry,
    |                |                          ------------
    |                |                          |
    |                |                          `16` assigned here
    |                |                          `16` assigned here
...                  |
261 |                |             $($tail)*  
262 |                |         }
    |                |         -
    |                |_________|
    |                |_________in this macro invocation (#3)
    |                |_________in this macro invocation (#5)
    |                |_________in this macro invocation (#7)
    |                |_________in this macro invocation (#9)
    |                |_________in this macro invocation (#11)
    |                          in this macro invocation (#14)
...
318 |                /         libc_enum! {   
319 |                              @accumulate_entries
320 |                              name: $BitFlags,
321 |                              {
    |                | -
    |                | |
    |                | in this expansion of `libc_enum!` (#1)
    |                | in this expansion of `libc_enum!` (#2)
    |                | in this expansion of `libc_enum!` (#3)
    |                | in this expansion of `libc_enum!` (#4)
    |                | in this expansion of `libc_enum!` (#5)
    |                | in this expansion of `libc_enum!` (#6)
    |                | in this expansion of `libc_enum!` (#7)
    |                | in this expansion of `libc_enum!` (#8)
    |                | in this expansion of `libc_enum!` (#9)
    |                | in this expansion of `libc_enum!` (#10)
    |                | in this expansion of `libc_enum!` (#11)
    |                | in this expansion of `libc_enum!` (#12)
    |                | in this expansion of `libc_enum!` (#13)
    |                |_in this expansion of `libc_enum!` (#14)
    |                  in this expansion of `libc_enum!` (#15)
    |
   ::: /home/glaubitz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/sys/signal.rs:28:1
    |
28  | /                libc_enum! {
29  | |                    /// Types of operating system signals
30  | |                    // Currently there is only one definition of c_int in libc, as well as only one
31  | |                    // type for signal constants.
...   |
121 | |                    impl TryFrom<i32>  
122 | |                }
    | |________________- in this macro invocation (#1)

error[E0080]: it is undefined behavior to use this value
   --> /home/glaubitz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/sys/signal.rs:328:1
    |
328 | const SIGNALS: [Signal; 31] = [
    | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ constructing invalid value at [15].<enum-tag>: encountered 0x00000000, but expected a valid enum tag
    |
    = note: The rules on what exactly is undefined behavior aren't clear, so this check might be overzealous. Please open an issue on the rustc repository if you believe it should not be considered undefined behavior.
    = note: the raw bytes of the constant (size: 124, align: 4) {
                0x00 │ 00 00 00 01 00 00 00 02 00 00 00 03 00 00 00 04 │ ................
                0x10 │ 00 00 00 05 00 00 00 06 00 00 00 0a 00 00 00 08 │ ................
                0x20 │ 00 00 00 09 00 00 00 1e 00 00 00 0b 00 00 00 1f │ ................
                0x30 │ 00 00 00 0d 00 00 00 0e 00 00 00 0f 00 00 00 00 │ ................
                0x40 │ 00 00 00 14 00 00 00 13 00 00 00 11 00 00 00 12 │ ................
                0x50 │ 00 00 00 15 00 00 00 16 00 00 00 10 00 00 00 18 │ ................
                0x60 │ 00 00 00 19 00 00 00 1a 00 00 00 1b 00 00 00 1c │ ................
                0x70 │ 00 00 00 17 00 00 00 1d 00 00 00 0c             │ ............
            }

   Compiling rustc-rayon v0.5.0
   Compiling regex-automata v0.1.10
   Compiling regex-automata v0.3.7
   Compiling time v0.3.36
note: erroneous constant encountered
   --> /home/glaubitz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/sys/signal.rs:388:24
    |
388 |         if self.next < SIGNALS.len() {  
    |                        ^^^^^^^

note: erroneous constant encountered
   --> /home/glaubitz/.cargo/registry/src/index.crates.io-6f17d22bba15001f/nix-0.28.0/src/sys/signal.rs:389:31
    |
389 |             let next_signal = SIGNALS[self.next];
    |                               ^^^^^^^

   Compiling twox-hash v1.6.3
Some errors have detailed explanations: E0080, E0081, E0425, E0531.
For more information about an error, try `rustc --explain E0080`.
error: could not compile `nix` (lib) due to 4 previous errors
warning: build failed, waiting for other jobs to finish...
Build completed unsuccessfully in 0:48:04
(unstable-amd64-sbuild)glaubitz@acrux:~/rust$

@asomers
Copy link
Copy Markdown
Member

asomers commented Jun 24, 2024

Thanks. Could you also please add a changelog entry?

@glaubitz
Copy link
Copy Markdown
Contributor Author

Thanks. Could you also please add a changelog entry?

Done.

Copy link
Copy Markdown
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, we track changelog entries differently now . You should create a new file in the changelog dir. Upon release, we'll merge all of those into the CHANGELOG.md file.

@glaubitz
Copy link
Copy Markdown
Contributor Author

Actually, we track changelog entries differently now . You should create a new file in the changelog dir. Upon release, we'll merge all of those into the CHANGELOG.md file.

Should be good now, hopefully.

Copy link
Copy Markdown
Member

@asomers asomers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That should be named "changelog/2454.fixed.md".

@glaubitz
Copy link
Copy Markdown
Contributor Author

That should be named "changelog/2454.fixed.md".

Done.

@asomers asomers added this pull request to the merge queue Jun 24, 2024
Merged via the queue into nix-rust:master with commit ab45051 Jun 24, 2024
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 this pull request may close these issues.

2 participants