servo / unicode-bidi

Implementation of the Unicode Bidirection Algorithm in Rust
Other
74 stars 34 forks source link

can not build x64 from m1 max macbook pro #65

Closed doowonee closed 2 years ago

doowonee commented 2 years ago
  1. build arm version on m1 mac book -> works
  2. build x64 version on windows -> works
  3. build x64 version on m1 mac book via docker buildx -> fail

Here is the error message from cargo.

> # error: could not compile `unicode-bidi`                                                                                                                                                                                          
 => => # Caused by:                                                                                                                                                                                                                       
 => => #   process didn't exit successfully: `rustc --crate-name unicode_bidi --edition=2018 /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/unicode-bidi-0.3.7/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi, 
 => => # artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=3 -C embed-bitcode=no --cfg 'feature="default"' --cfg 'feature="std"' -C metadata=81eb90b88014abf3 -C extra-filename=-81eb90b88014abf3 --out-dir /usr/src/ 
 => => # logging/target/release/deps -L dependency=/usr/src/logging/target/release/deps --cap-lints allow` (signal: 11, SIGSEGV: invalid memory reference)                                                                                
 => => # warning: build failed, waiting for other jobs to finish...  

I tried other way to build creating a build only interactive container like a blew. And this test project is only using unicode-bidi on your example code.

docker run -it --rm -v "$PWD":/usr/src/myapp -w /usr/src/myapp --platform=linux/amd64 debian:buster-slim bash
apt update && apt install curl
# install rustup via curl
source ~/.bashrc
cargo build -p test-ppp

and the result is stuck... over than 1 hour

warning: /usr/src/myapp/core/contents-lib/Cargo.toml: unused manifest key: dev-dependencies.contents_test_lib.lib
warning: /usr/src/myapp/core/social-lib/Cargo.toml: unused manifest key: dev-dependencies.social_test_lib.lib
    Updating crates.io index
  Downloaded unicode-bidi v0.3.7
  Downloaded 1 crate (33.8 KB) in 1.24s
   Compiling unicode-bidi v0.3.7
    Building [                             ] 0/2: unicode-bidi   

someone make issue on rust repo https://github.com/servo/unicode-bidi/issues/47 but It turns out there is no problem with rust.

So any clue?

mbrubeck commented 2 years ago

Thanks for the report! According to https://github.com/rust-lang/rust/issues/80346 and https://github.com/docker/for-mac/issues/5314 this is a bug in qemu, the emulator that Docker uses to run amd64 images on arm64 hardware.

I'm not sure how to work around this bug. I thought it might be possible to cross-compile linux/amd64 binaries from a linux/arm64 image, but it seems that the major Linux distros do not provide cross-compiling toolchain packages for ARM hosts.

Sorry, but the only solution I can offer is to use x86 hardware to build for linux/x86. :(

doowonee commented 2 years ago

@mbrubeck My project uses more than 500 crates and When I watching the progress running cargo build 124 of crates built successfully and 125th crate which is unicode-bidi has failed So I thought the problem is unicode-bidi not the lower layer of SW. anyway Thanks!