mobilecoinfoundation / mobilecoin

Private payments for mobile devices.
Other
1.16k stars 148 forks source link

Mobilecoin build fails with illegal instruction #807

Closed petertodd closed 3 years ago

petertodd commented 3 years ago

I'm trying to follow the instructions in https://github.com/mobilecoinfoundation/mobilecoin/blob/ae596fb127f89814bbf20b3849cddc5714e4eb96/consensus/service/BUILD.md on a fresh Ubuntu 18.04 install on an Intel NUC model 7CJYH4 with a Celeron J4005 cpu. Both master and the v1.1.0-pre1 tag have the same failure.

Within the container I get the following:

# SGX_MODE=HW IAS_MODE=DEV cargo build -p mc-consensus-service
  Downloaded thiserror-impl v1.0.20
  Downloaded thiserror v1.0.20
  Downloaded anyhow v1.0.28
  Downloaded unicode-normalization v0.1.12
  Downloaded zeroize v1.1.0
  Downloaded displaydoc v0.1.7
  Downloaded protobuf-codegen v2.20.0
  Downloaded curve25519-dalek v3.0.0
  Downloaded protobuf v2.20.0
  Downloaded 9 crates (869.8 KB) in 1.05s
   Compiling anyhow v1.0.28
   Compiling mc-util-build-info v1.1.0-pre1 (/tmp/mobilenode/util/build/info)
   Compiling protobuf v2.20.0
   Compiling mc-sgx-types v1.1.0-pre1 (/tmp/mobilenode/sgx/types)
   Compiling mc-util-host-cert v1.1.0-pre1 (/tmp/mobilenode/util/host-cert)
   Compiling proc-macro2 v1.0.24
error: failed to run custom build command for `proc-macro2 v1.0.24`

Caused by:
  process didn't exit successfully: `/tmp/mobilenode/target/debug/build/proc-macro2-d9a323b814519ba7/build-script-build` (signal: 4, SIGILL: illegal instruction)
--- stdout
cargo:rerun-if-changed=build.rs

warning: build failed, waiting for other jobs to finish...
error: build failed

dmesg on the host displays:

[ 3013.789628] traps: build-script-bu[9457] trap invalid opcode ip:55d017d2dd2c sp:7fffaf38e8d0 error:0 in build-script-build[55d017d26000+54000]

Version info:

# cargo --version
cargo 1.46.0-nightly (c26576f9a 2020-06-23)
root@5dafdfa3feb4:/tmp/mobilenode# rustc --version
rustc 1.46.0-nightly (16957bd4d 2020-06-30)
cndolo commented 3 years ago

Experiencing the same on Ubuntu 20.04. Did you manage to solve this @petertodd ?

petertodd commented 3 years ago

On Thu, May 20, 2021 at 12:36:53AM -0700, Charmaine Ndolo wrote:

Experiencing the same on Ubuntu 20.04. Did you manage to solve this @petertodd ?

Nope. I just tried with v1.1.0-pre4. Same problem as before.

eranrund commented 3 years ago

This might be due to the default architecture setting in https://github.com/mobilecoinfoundation/mobilecoin/blob/master/.cargo/config#L11 If your CPU is older, you might need to adjust that.

cndolo commented 3 years ago

Yes, it is. I can confirm that changing that line to:

rustflags = ["-D", "warnings", "-C", "target-cpu=native"]

solves the issue. Thank you! See also: https://users.rust-lang.org/t/typenum-build-failure/56286/2