integer-encoding-rs icon indicating copy to clipboard operation
integer-encoding-rs copied to clipboard

Build of the crate fails on big-endian architecture

Open Laiot opened this issue 3 years ago • 5 comments

The build fails for the s390x architecture, might be a problem with any big-endian architecture.

failures:
---- fixed_tests::tests::test_i16_enc stdout ----
thread 'fixed_tests::tests::test_i16_enc' panicked at 'assertion failed: `(left == right)`
  left: `[128, 0]`,
 right: `[0, 128]`', src/fixed_tests.rs:26:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- fixed_tests::tests::test_i32_enc stdout ----
thread 'fixed_tests::tests::test_i32_enc' panicked at 'assertion failed: `(left == right)`
  left: `[255, 255, 128, 1]`,
 right: `[1, 128, 255, 255]`', src/fixed_tests.rs:31:9
---- fixed_tests::tests::test_i32_enc_light stdout ----
thread 'fixed_tests::tests::test_i32_enc_light' panicked at 'assertion failed: `(left == right)`
  left: `[255, 255, 128, 1]`,
 right: `[1, 128, 255, 255]`', src/fixed_tests.rs:48:9
---- fixed_tests::tests::test_u16_enc stdout ----
thread 'fixed_tests::tests::test_u16_enc' panicked at 'assertion failed: `(left == right)`
  left: `[1, 0]`,
 right: `[0, 1]`', src/fixed_tests.rs:21:9
---- fixed_tests::tests::test_u32_enc stdout ----
thread 'fixed_tests::tests::test_u32_enc' panicked at 'assertion failed: `(left == right)`
  left: `[0, 0, 0, 32]`,
 right: `[32, 0, 0, 0]`', src/fixed_tests.rs:16:9
failures:
    fixed_tests::tests::test_i16_enc
    fixed_tests::tests::test_i32_enc
    fixed_tests::tests::test_i32_enc_light
    fixed_tests::tests::test_u16_enc
    fixed_tests::tests::test_u32_enc
test result: FAILED. 18 passed; 5 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

Laiot avatar May 03 '22 07:05 Laiot

Ah well, the time has come... so far, for simplicity and laziness reasons, I've simply not bothered about BE architectures. If this issue is more than "it doesn't build, shrug" (i.e. "I need this to build!"), please let me know and I will investigate ways to implement this properly.

dermesser avatar May 05 '22 04:05 dermesser

I wanted to make a Fedora package of this crate because many other crates depend on this one (eg message-io). One of the review tests we run before approving a package is indeed on an s390x machine.

Laiot avatar May 05 '22 05:05 Laiot

I've implemented fixes for fixed-width integers. I believe that all important tests are updated accordingly, but could you run the build process again before I publish a new version before reporting back? That would be very helpful!

dermesser avatar May 21 '22 20:05 dermesser

I'm sorry it took me so long to reply and thank you for your work. Unfortunately, neither of the two patches works, the build on the s390x architecture keeps failing. Also the last patch (46f5f3e40c7d4819f7e8484cb58a571caa22c3b4) makes builds on standard architectures fail too.

Laiot avatar May 26 '22 07:05 Laiot

This is unfortunate - especially as the tests pass on x86 (Github CI and locally). Can you post the specific errors for the respective architecture, so I can better understand what is going wrong? They should at least be different from the ones you posted initially.

dermesser avatar May 26 '22 13:05 dermesser