Skip to content

xous: include prelude to define c_int#4303

Closed
xobs wants to merge 1 commit into
rust-lang:libc-0.2from
betrusted-io:xous-add-prelude
Closed

xous: include prelude to define c_int#4303
xobs wants to merge 1 commit into
rust-lang:libc-0.2from
betrusted-io:xous-add-prelude

Conversation

@xobs

@xobs xobs commented Mar 7, 2025

Copy link
Copy Markdown
Contributor

Description

Include the prelude on Xous to fix the build in Rust libstd.

Sources

N/A

Checklist

  • Relevant tests in libc-test/semver have been updated
  • No placeholder or unstable values like *LAST or *MAX are
    included (see #3131)
  • Tested locally (cd libc-test && cargo test --target mytarget);
    especially relevant for platforms that may not be checked in CI

Extra

With the latest changes, libstd no longer builds:

   Compiling libc v0.2.170 (/opt/Xous/libc)
error[E0412]: cannot find type `c_int` in this scope
  --> /opt/Xous/libc/src/xous.rs:17:20
   |
17 | pub const INT_MIN: c_int = -2147483648;
   |                    ^^^^^ not found in this scope
   |
help: consider importing one of these type aliases
   |
5  + use crate::c_int;
   |
5  + use rustc_std_workspace_core::ffi::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /opt/Xous/libc/src/xous.rs:18:20
   |
18 | pub const INT_MAX: c_int = 2147483647;
   |                    ^^^^^ not found in this scope
   |
help: consider importing one of these type aliases
   |
5  + use crate::c_int;
   |
5  + use rustc_std_workspace_core::ffi::c_int;
   |

For more information about this error, try `rustc --explain E0412`.
error: could not compile `libc` (lib) due to 2 previous errors

With the latest changes, libstd no longer builds:

```
   Compiling libc v0.2.170 (/opt/Xous/libc)
error[E0412]: cannot find type `c_int` in this scope
  --> /opt/Xous/libc/src/xous.rs:17:20
   |
17 | pub const INT_MIN: c_int = -2147483648;
   |                    ^^^^^ not found in this scope
   |
help: consider importing one of these type aliases
   |
5  + use crate::c_int;
   |
5  + use rustc_std_workspace_core::ffi::c_int;
   |

error[E0412]: cannot find type `c_int` in this scope
  --> /opt/Xous/libc/src/xous.rs:18:20
   |
18 | pub const INT_MAX: c_int = 2147483647;
   |                    ^^^^^ not found in this scope
   |
help: consider importing one of these type aliases
   |
5  + use crate::c_int;
   |
5  + use rustc_std_workspace_core::ffi::c_int;
   |

For more information about this error, try `rustc --explain E0412`.
error: could not compile `libc` (lib) due to 2 previous errors
```

Include the prelude to define `c_int` and fix the build on rust `main`.

Signed-off-by: Sean Cross <sean@xobs.io>
@rustbot

rustbot commented Mar 7, 2025

Copy link
Copy Markdown
Collaborator

r? @tgross35

rustbot has assigned @tgross35.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@xobs

xobs commented Mar 7, 2025

Copy link
Copy Markdown
Contributor Author

An example of a build failure in CI can be found at https://github.com/betrusted-io/rust-nightly/actions/runs/13699992351/job/38311095367

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry about that, thanks for sending a fix.

@rustbot label +stable-nominated

@rustbot rustbot added the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Mar 7, 2025
@tgross35 tgross35 enabled auto-merge March 7, 2025 02:22
@tgross35 tgross35 disabled auto-merge March 7, 2025 02:22

@tgross35 tgross35 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry I didn't check the branch, could you send this against main instead? I cherry pick to 0.2.

@xobs

xobs commented Mar 7, 2025

Copy link
Copy Markdown
Contributor Author

Sure. PR open at #4304

@xobs xobs closed this Mar 7, 2025
@tgross35 tgross35 removed the stable-nominated This PR should be considered for cherry-pick to libc's stable release branch label Mar 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants