Closed
Description
I'm trying to build ripgrep with its SIMD optimizations on, and on Archlinux this means that ripgrep is compiled as follows:
% RUSTFLAGS="-C target-cpu=native" cargo build --release --features simd-accel
However, the build fails with the following error:
% RUSTFLAGS="-C target-cpu=native" cargo build --release --features simd-accel
Compiling winapi-build v0.1.1
Compiling fnv v1.0.5
Compiling crossbeam v0.2.10
Compiling ansi_term v0.9.0
Compiling utf8-ranges v0.1.3
Compiling winapi v0.2.8
Compiling vec_map v0.6.0
Compiling log v0.3.6
Compiling void v1.0.2
Compiling libc v0.2.18
Compiling unreachable v0.1.1
Compiling bitflags v0.7.0
Compiling unicode-segmentation v0.1.3
Compiling strsim v0.5.2
Compiling unicode-width v0.1.3
Compiling walkdir v1.0.3
Compiling term_size v0.2.1
Compiling thread-id v3.0.0
Compiling regex-syntax v0.3.9
Compiling thread_local v0.3.0
Compiling termcolor v0.1.1 (file:///tmp/yaourt-tmp-netvl/aur-ripgrep-git/src/ripgrep-git/termcolor)
Compiling clap v2.18.0
Compiling memmap v0.5.0
Compiling simd v0.1.1
Compiling kernel32-sys v0.2.2
Build failed, waiting for other jobs to finish...
error: failed to run custom build command for `kernel32-sys v0.2.2`
process didn't exit successfully: `/tmp/yaourt-tmp-netvl/aur-ripgrep-git/src/ripgrep-git/target/release/build/kernel32-sys-f1c920c4b0efc1c4/build-script-build` (signal: 4, SIGILL: illegal instruction)
I tried checking out the appropriate commit in the winapi-rs repo where kernel32-sys 0.2.2 is available, and was able to reproduce this problem directly with the kernel32-sys crate:
% git clone https://github.com/retep998/winapi-rs
% cd winapi-rs
% git checkout 00ba888
% cd lib/kernel32
% RUSTFLAGS="-C target-cpu=native" cargo build --release
Compiling winapi v0.2.8 (file:///tmp/winapi-rs)
Compiling winapi-build v0.1.1 (file:///tmp/winapi-rs/build)
Compiling kernel32-sys v0.2.2 (file:///tmp/winapi-rs/lib/kernel32)
error: failed to run custom build command for `kernel32-sys v0.2.2 (file:///tmp/winapi-rs/lib/kernel32)`
process didn't exit successfully: `/tmp/winapi-rs/lib/kernel32/target/release/build/kernel32-sys-70200ca6b7279963/build-script-build` (signal: 4, SIGILL: illegal instruction)
If I omit the RUSTFLAGS variable, everything compiles fine:
% cargo build --release
Compiling winapi v0.2.8 (file:///tmp/winapi-rs)
Compiling winapi-build v0.1.1 (file:///tmp/winapi-rs/build)
Compiling kernel32-sys v0.2.2 (file:///tmp/winapi-rs/lib/kernel32)
Finished release [optimized] target(s) in 0.91 secs
Compiler version:
% rustc -V
rustc 1.15.0-nightly (daf8c1dfc 2016-12-05)
% cargo -V
cargo 0.16.0-nightly (built 2016-12-06)
Also, I'm running a Skylake i7 CPU, here is my /proc/cpuinfo, if it is relevant:
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 78
model name : Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
stepping : 3
microcode : 0x9e
cpu MHz : 3288.598
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
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 art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
bugs :
bogomips : 5615.87
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 78
model name : Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
stepping : 3
microcode : 0x9e
cpu MHz : 3320.043
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
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 art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
bugs :
bogomips : 5621.56
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 78
model name : Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
stepping : 3
microcode : 0x9e
cpu MHz : 3282.275
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 2
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
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 art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
bugs :
bogomips : 5623.92
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 78
model name : Intel(R) Core(TM) i7-6600U CPU @ 2.60GHz
stepping : 3
microcode : 0x9e
cpu MHz : 3326.367
cache size : 4096 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 2
apicid : 3
initial apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
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 art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc aperfmperf eagerfpu pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch epb intel_pt tpr_shadow vnmi flexpriority ept vpid fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp
bugs :
bogomips : 5622.00
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management: