tendermint/tmkms

Install Fails With RUSTFLAGS set

gaia opened this issue · 3 comments

gaia commented

If I set export RUSTFLAGS=-Ctarget-feature=+aes,+ssse3

I get during cargo install tmkms --features=yubihsm-server:

error: Could not compile `proc-macro2`.

Caused by:
  process didn't exit successfully: `rustc --edition=2018 --crate-name proc_macro2 /root/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.3/src/lib.rs --color always --crate-type lib --emit=dep-info,metadata,link -C op
t-level=3 -C overflow-checks=on --cfg 'feature="default"' --cfg 'feature="proc-macro"' -C metadata=73c84dbf7d76eea6 -C extra-filename=-73c84dbf7d76eea6 --out-dir /tmp/cargo-installPO5Ck1/release/deps -L dependency=/tmp/cargo-installP
O5Ck1/release/deps --extern unicode_xid=/tmp/cargo-installPO5Ck1/release/deps/libunicode_xid-4597e5b10036a1ae.rlib --cap-lints allow -Ctarget-feature=+aes,+ssse3 --cfg use_proc_macro --cfg wrap_proc_macro` (signal: 11, SIGSEGV: inval
id memory reference)
warning: build failed, waiting for other jobs to finish...
error: failed to compile `tmkms v0.6.3`, intermediate artifacts can be found at `/tmp/cargo-installPO5Ck1`

Caused by:
  build failed

Removing the env variable completes the install no problem.

probably because 4.15.0-62-generic #69-Ubuntu SMP runs inside a VM with the generic KVM CPU option? no aes or ssse3 available.

       description: CPU
       product: Common KVM processor
       vendor: Intel Corp.
       physical id: 400
       bus info: cpu@0
       version: pc-i440fx-4.0
       slot: CPU 0
       size: 2GHz
       capacity: 2GHz
       width: 64 bits
       capabilities: fpu fpu_exception wp vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx x86-64 constant_tsc nopl xtopology cpuid tsc_known_freq pni cx16 x2apic hypervisorlahf_lm cpuid_fault pti

That’s very strange as proc-macro2 is an important core ecosystem Rust crate. I’d suggest reporting the issue upstream: https://github.com/alexcrichton/proc-macro2

gaia commented

Sorry, Tony, isn't the issue that the flags I told Rust to use are not available in the CPU I passed to the VM? I compiles fine w/o the flags. Are you saying it compiles fine but won't work? I can test sign under 128ms.

You're getting a SIGSEGV, which indicates an out-of-bound or improperly aligned memory access. If it were an unavailable CPU instruction, I would expect a SIGILL (illegal instruction).

Unavailability of these instructions inside KVM is a probable root cause, but this is a bizarre failure mode (especially when compiling proc-macro2)