Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

failed to run custom build command for libloading v0.5.2 #3

Closed
allensll opened this issue Jul 25, 2020 · 6 comments
Closed

failed to run custom build command for libloading v0.5.2 #3

allensll opened this issue Jul 25, 2020 · 6 comments

Comments

@allensll
Copy link

$ cargo +nightly build --release

Compiling libz-sys v1.0.25
Compiling openssl-sys v0.9.58
Compiling clear_on_drop v0.2.4
Compiling bzip2-sys v0.1.9+1.0.8
Compiling libloading v0.5.2
Compiling base_conversion v0.1.0 (https://github.com/pratyush/fancy-garbling/?branch=add-serde#848216e1)
Compiling ocelot v0.3.1 (https://github.com/GaloisInc/ocelot/#849883b8)
Compiling serde_derive v1.0.114
Compiling failure_derive v0.1.8
Compiling derivative v1.0.4
error: failed to run custom build command for libloading v0.5.2

Caused by:
process didn't exit successfully: /home/sll/allensll/github/delphi-master/rust/target/release/build/libloading-029bfaded5ec1968/build-script-build (signal: 4, SIGILL: illegal instruction)
--- stdout
cargo:rustc-link-lib=dl
warning: build failed, waiting for other jobs to finish...
error: build failed

@ryanleh
Copy link
Collaborator

ryanleh commented Jul 25, 2020

Could you provide the relevant output of cargo +nightly build --release -v for the libloading package? Also can you provide more information about your system (OS, nightly version, etc.)?

@allensll
Copy link
Author

Could you provide the relevant output of cargo +nightly build --release -v for the libloading package? Also can you provide more information about your system (OS, nightly version, etc.)?

Thanks @ryanleh.

My system information is:
Ubuntu 16.04
rustc 1.47.0-nightly (d6953df14 2020-07-25)
cargo 1.47.0-nightly (aa6872140 2020-07-23)

I tried cargo +nightly build --release -v and got a different error:
...
Compiling libloading v0.5.2
Running rustc --crate-name build_script_build /home/sll/.cargo/registry/src/mirrors.ustc.edu.cn-61ef6e0cd06fb9b8/libloading-0.5.2/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -Cembed-bitcode=no -C debuginfo=2 -C metadata=029bfaded5ec1968 -C extra-filename=-029bfaded5ec1968 --out-dir /home/sll/allensll/github/delphi-master/rust/target/release/build/libloading-029bfaded5ec1968 -L dependency=/home/sll/allensll/github/delphi-master/rust/target/release/deps --extern cc=/home/sll/allensll/github/delphi-master/rust/target/release/deps/libcc-315bcd5570d8d476.rlib --cap-lints allow -C target-feature=+aes,+ssse3,+avx2 -C target-cpu=native -C opt-level=3

Compiling base_conversion v0.1.0 (https://github.com/pratyush/fancy-garbling/?branch=add-serde#848216e1)
Running rustc --crate-name build_script_build --edition=2018 /home/sll/.cargo/git/checkouts/fancy-garbling-c4933c013ff259da/848216e/base_conversion/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -Cembed-bitcode=no -C debuginfo=2 -C metadata=3c806d4180912aac -C extra-filename=-3c806d4180912aac --out-dir /home/sll/allensll/github/delphi-master/rust/target/release/build/base_conversion-3c806d4180912aac -L dependency=/home/sll/allensll/github/delphi-master/rust/target/release/deps --extern cc=/home/sll/allensll/github/delphi-master/rust/target/release/deps/libcc-315bcd5570d8d476.rlib --cap-lints allow -C target-feature=+aes,+ssse3,+avx2 -C target-cpu=native -C opt-level=3

Compiling ocelot v0.3.1 (https://github.com/GaloisInc/ocelot/#849883b8)
Running rustc --crate-name build_script_build --edition=2018 /home/sll/.cargo/git/checkouts/ocelot-cfb3393d61de09ba/849883b/build.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C opt-level=3 -Cembed-bitcode=no -C debuginfo=2 -C metadata=8f49f50e7395ac97 -C extra-filename=-8f49f50e7395ac97 --out-dir /home/sll/allensll/github/delphi-master/rust/target/release/build/ocelot-8f49f50e7395ac97 -L dependency=/home/sll/allensll/github/delphi-master/rust/target/release/deps --extern cc=/home/sll/allensll/github/delphi-master/rust/target/release/deps/libcc-315bcd5570d8d476.rlib --cap-lints allow -C target-feature=+aes,+ssse3,+avx2 -C target-cpu=native -C opt-level=3
Running /home/sll/allensll/github/delphi-master/rust/target/release/build/clear_on_drop-bac40d6beeb6247f/build-script-build
error: failed to run custom build command for clear_on_drop v0.2.4

Caused by:
process didn't exit successfully: /home/sll/allensll/github/delphi-master/rust/target/release/build/clear_on_drop-bac40d6beeb6247f/build-script-build (signal: 4, SIGILL: illegal instruction)
warning: build failed, waiting for other jobs to finish...
error: build failed

I'm new to Rust, feel free to ask me any other information you need.

@ryanleh
Copy link
Collaborator

ryanleh commented Jul 29, 2020

I wasn't able to reproduce this. I launched a fresh Ubuntu 16.04 image and was able to build everything without encountering either of these errors.

Could you post the output of lscpu? Since you're getting a SIGILL, my best guess is you're experiencing something similar to this.

@allensll
Copy link
Author

Here is the output of lscpu:

CPU op-mode(s):        32-bit, 64-bit
Byte Order:            Little Endian
CPU(s):                40
On-line CPU(s) list:   0-39
Thread(s) per core:    2
Core(s) per socket:    10
Socket(s):             2
NUMA node(s):          2
Vendor ID:             GenuineIntel
CPU family:            6
Model:                 62
Model name:            Intel(R) Xeon(R) CPU E5-2680 v2 @ 2.80GHz
Stepping:              4
CPU MHz:               2273.770
CPU max MHz:           3600.0000
CPU min MHz:           1200.0000
BogoMIPS:              5588.38
Virtualization:        VT-x
L1d cache:             32K
L1i cache:             32K
L2 cache:              256K
L3 cache:              25600K
NUMA node0 CPU(s):     0-9,20-29
NUMA node1 CPU(s):     10-19,30-39
Flags:                 fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm cpuid_fault epb pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid fsgsbase smep erms xsaveopt dtherm ida arat pln pts md_clear flush_l1d

@allensll
Copy link
Author

allensll commented Jul 29, 2020

I tried RUSTFLAGS="-C target_cpu=ivybridge" cargo +nightly build --release to build, it seems no error but some warnings

   Compiling algebra v0.1.0 (/home/sll/allensll/github/delphi-master/rust/algebra)
warning: unnecessary parentheses around block return value
   --> algebra/src/fixed_point.rs:137:9
    |
137 |         (P::MANTISSA_CAPACITY + P::EXPONENT_CAPACITY)
    |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses
    |
    = note: `#[warn(unused_parens)]` on by default

warning: unnecessary parentheses around block return value
   --> algebra/src/fixed_point.rs:257:5
    |
257 |     (sum.signed_truncate_by(2))
    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: remove these parentheses

   Compiling crypto-primitives v0.1.0 (/home/sll/allensll/github/delphi-master/rust/crypto-primitives)
warning: 2 warnings emitted

   Compiling tch v0.1.7
   Compiling neural-network v0.1.0 (/home/sll/allensll/github/delphi-master/rust/neural-network)
warning: the feature `specialization` is incomplete and may not be safe to use and/or cause compiler crashes
 --> neural-network/src/lib.rs:1:12
  |
1 | #![feature(specialization)]
  |            ^^^^^^^^^^^^^^
  |
  = note: `#[warn(incomplete_features)]` on by default
  = note: see issue #31844 <https://github.com/rust-lang/rust/issues/31844> for more information

warning: 1 warning emitted

   Compiling protocols v0.1.0 (/home/sll/allensll/github/delphi-master/rust/protocols)
   Compiling experiments v0.1.0 (/home/sll/allensll/github/delphi-master/rust/experiments)
warning: unused variable: `index`
  --> experiments/src/throughput/client.rs:54:21
   |
54 |                 let index: usize = rng.next_u64() as usize % 4;
   |                     ^^^^^ help: if this is intentional, prefix it with an underscore: `_index`
   |
   = note: `#[warn(unused_variables)]` on by default

warning: 1 warning emitted

    Finished release [optimized + debuginfo] target(s) in 4m 27s

@ryanleh
Copy link
Collaborator

ryanleh commented Jul 29, 2020

Yes, so it appears that the two libraries that failed compilation were trying to build with AVX2 instructions (note rust attempts to build them with target-feature=+aes,+ssse3,+avx2) but your CPU does not support that instruction set. I'm not sure why rust doesn't automatically detect this. Ivybridge is a CPU w/o AVX2 support, so once you explicitly told rust to build for this CPU it omitted those flags and built correctly.

Awesome! Those warnings are fine.

@ryanleh ryanleh closed this as completed Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants