aviramha/ormsgpack

Issues building aarch64 binary wheels

drewm1980 opened this issue · 6 comments

ormsgpack says it is tested on aarch64 in the README file.

I'm hitting build errors on aarch64 with all of the last several versions
on
rustc 1.67.0 stable
rustc 1.69.0-nightly (d7948c843 2023-01-26)

I manually went through master and the last 4 or so tagged versions:

master, 1.2.4, 1.2.3 (fails in src/serialize/writer.rs)

error[E0308]: mismatched types=========> ] 63/64: ormsgpack                                                                                          
  --> src/serialize/writer.rs:38:14
   |
38 |             (&(*self.bytes.cast::<PyBytesObject>()).ob_sval as *const [i8; 1] as *mut u8)
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found array `[i8; 1]`

1.2.2, 1.2.1,1.1.0 (fails in packed_simd_2)

Error in packed_simd:

   Compiling packed_simd_2 v0.3.7
    Building error: expected one of `!` or `::`, found keyword `mod`
   --> /home/awagner/.cargo/registry/src/github.com-1ecc6299db9ec823/packed_simd_2-0.3.7/src/lib.rs:347:7
    |
347 | crate mod llvm {
    |       ^^^ expected one of `!` or `::`

[===============>           ] 33/53: num-traits(build), pyo3-build-config(build), packed_simd_2, libc                                   
error: aborting due to previous error

I need this for a project at work, so I'll probably take a crack at fixing this up, but if there's a known-good compiler version and git version for aarch64 that would be quite welcome!

Thanks for the useful library!

I have studied the code, and I am at a complete loss as to why ormsgpack compiles on x86 but not aarch64, even with environments as identical as I can get them.

on aarch64:
rustc 1.69.0-nightly (dc1d9d50f 2023-01-31)
Python 3.9.16
ormsgpack 1.2.4

on x86-64:
rustc 1.69.0-nightly (dc1d9d50f 2023-01-31)
Python 3.9.16
ormsgpack 1.2.4

I even diffed the Cargo.lock files from both machines, and they're identical.

It's compiling on "cargo check", so the issue is in typechecking, long before code generation. This is a language level issue so the cpu platfform should not even matter. For clarity, the line that's failing to compile (but only on the ARM box) is still:

error[E0308]: mismatched types=========> ] 63/64: ormsgpack                                                                                          
  --> src/serialize/writer.rs:38:14
   |
38 |             (&(*self.bytes.cast::<PyBytesObject>()).ob_sval as *const [i8; 1] as *mut u8)
   |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found array `[i8; 1]`

The types are different between different architectures probably, so it's not a language level.
I will take a look into it.

Nice, thanks for fixing this up; there are a lot of changes in that patch!

I can confirm that master builds cleanly with a simple "maturin build" on:
an aarch64 jetson device
in a python 3.8 conda environment,
maturin 0.14.12.
rustc 1.69.0-nightly (dc1d9d50f 2023-01-31)

In parallel with your work, I discovered a colleague pushed py38 aarch64 images to our internal devpi. His build notes, though I'm not sure in what scenario someone would need them:

git clone https://github.com/aviramha/ormsgpack.git
git checkout tags/1.1.0
pip install maturin
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
source $HOME/.cargo/env
maturin build --cargo-extra-args="--no-default-features"

I spent hours trying to grok some of the pointer casting in the parts of your code that weren't building for me... unsafe raw pointer code in rust is a lot harder than I expected and I made zero progress aside from adding a bit of error handling; I'm very thankful your library hides all that "complexity" from the caller.

Our test suite passes with your new version, by the way. Our coverage is probably not as extensive as yours, but that's at least one report of user non-breakage for you!

Kudos goes to the upstream library orjson by @ijl :)