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

cross-compilation broken for 32-bit builds #442

Closed
Kiskae opened this issue May 20, 2022 · 0 comments · Fixed by #446
Closed

cross-compilation broken for 32-bit builds #442

Kiskae opened this issue May 20, 2022 · 0 comments · Fixed by #446

Comments

@Kiskae
Copy link

Kiskae commented May 20, 2022

Describe the bug
when cross-compiling for 32-bit linux, the libc::sysconf call returns a 32-bit integer which is incompatible with the i64 it wants to be stored in.

PR #430 made this change but it also removed the cast that made the previous version work on all platforms.

To Reproduce

Cross-compile using the i686-unknown-linux-musl target.

Error: --> /cargo/registry/src/github.com-1ecc6299db9ec823/prometheus-0.13.1/src/process_collector.rs:199:13
|
197 | static ref PAGESIZE: i64 = {
| --- expected i64 because of return type
198 | unsafe {
199 | libc::sysconf(libc::_SC_PAGESIZE)
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected i64, found i32
|
help: you can convert an i32 to an i64
|
199 | libc::sysconf(libc::_SC_PAGESIZE).into()
| +++++++

For more information about this error, try rustc --explain E0308.
error: could not compile prometheus due to 2 previous errors

Expected behavior
There is no reason why it shouldn't be able to compile on 32-bit systems.

System information

  • CPU architecture:
    • x86_64
  • Distribution and kernel version:
    • N/A
  • SELinux on?:
    • N/A
  • Any other system details we should know?:
    • Rust toolchain: stable-x86_64-unknown-linux-gnu unchanged - rustc 1.61.0 (fe5b13d68 2022-05-18)

Additional context
Ran into this problem while building multi-arch docker images. It might be an idea to add cross-compilation to CI to catch problems like this in the future

JanZachmann added a commit to omnect/windfarm-monitoring that referenced this issue Nov 30, 2022
 - updated dependencies in order to fix tikv/rust-prometheus#442
 - bumped to azure-iot-sdk 0.8.8
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