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

xous: include prelude to define c_int #4303

Closed
wants to merge 1 commit into from

Conversation

xobs
Copy link
Contributor

@xobs xobs commented Mar 7, 2025

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
Copy link
Collaborator

rustbot commented Mar 7, 2025

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
Copy link
Contributor Author

xobs commented Mar 7, 2025

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

Copy link
Contributor

@tgross35 tgross35 left a comment

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
Copy link
Contributor

@tgross35 tgross35 left a comment

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
Copy link
Contributor Author

xobs commented Mar 7, 2025

Sure. PR open at #4304

@xobs xobs closed this Mar 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author stable-nominated This PR should be considered for cherry-pick to libc's stable release branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants