aws / dcv-color-primitives

DCV Color Primitives Library
MIT No Attribution
30 stars 22 forks source link

Fix crashes to illegal instructions execution #26

Closed fabiosky closed 4 years ago

fabiosky commented 4 years ago

Description of changes: Have the rust global build script build.rs generate the cargo config file.

The cargo config file will contain the intersection of:

In this way, we prevent invalid instructions being executed on machines that do not support them.

I tested this on a RHEL6 machine (without avx support) and the generated cargo file looks the following:

[build]
rustflags = ["-g","-C","target-feature=+sse2"]

cargo test works fine.

Instead, on another machine with avx2 support the following config file is generated:

[build]
rustflags = ["-g","-C","target-feature=+sse2,+avx,+avx2"]
fabiosky commented 4 years ago

@nacho can you give a look at this? I also tried this patch on Windows and it is working fine.

pbor commented 4 years ago

This sounds weird... are we user build.rs gets executed before cargo itself reads the config?