Comments (2)
RUSTFLAGS
is applied to the compilation of both target code and build scripts when Cargo is not in cross-compile mode.
Your command makes build.rs crash on this line:
Line 95 in 49b26d2
If I add return None;
above that line, it does not crash. If I add it on the next line, it crashes.
Based on RUSTFLAGS="-C target-feature=+avx512bw" cargo build --verbose
, the build script itself is compiled with +avx512bw
by Cargo, so a crash makes sense as soon as it hits an instruction that is not available in the host CPU.
Running `~/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name build_scrip
t_build --edition=2021 ~/.cargo/registry/src/index.crates.io-6f17d22bba15001f/proc-macro2-1.0.7
0/build.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diag
^^^^^^^^
nostic-width=118 --crate-type bin --emit=dep-info,link -C embed-bitcode=no --cfg 'feature="defa
ult"' --cfg 'feature="proc-macro"' -C metadata=5c68bf8a9ae873e5 -C extra-filename=-5c68bf8a9ae8
73e5 --out-dir target/debug/build/proc-macro2-5c68bf8a9ae873e5 -C incremental=target/debug/incr
emental -L dependency=target/debug/deps -C target-feature=+avx512bw`
^^^^^^^^^^^^^^^^^^^^^^^^^^^
You need to put Cargo in cross-compiling mode in order for it to pass different rustflags to host vs target builds, by passing --target
. The correct syntax is:
$ cargo build --target x86_64-unknown-linux-gnu --config 'target.x86_64-unknown-linux-gnu.rustflags=["-C", "target_feature=+avx512bw"]'
or:
$ RUSTFLAGS='-C target-feature=+avx512bw' cargo build --target x86_64-unknown-linux-gnu
This is effective even if the host and target happen to be the same target triple.
from proc-macro2.
Ahh, thank you.
In my particular case, I had misunderstood how to do runtime detection of SIMD features. I needed to add #[target_feature(enable = "...")]
to regions of code that used SIMD features. This guide was very helpful.
Closing now. Thanks again.
from proc-macro2.
Related Issues (20)
- `Span::source_text` panics with multibyte source HOT 1
- Issue with multibyte chars in source_text() computation HOT 1
- Consider recalibrating how bits are divided in Span HOT 3
- Consider an API to reset thread-local Span data HOT 2
- Make `proc_macro_span` optional with nightly HOT 4
- Enhance documentation with examples.
- panic in fallback.rs:817 HOT 3
- Linking failed after updating to 1.0.76 HOT 2
- Provide an API to access byte offsets for Spans
- Not compatible with 1.66-nightly HOT 2
- cannot find struct, variant or union type `LineColumn` in crate `proc_macro` HOT 1
- arm64-linux build error HOT 1
- bug?: Build script fails without `strip = "symbols"` HOT 1
- Missed nightly feature `proc_macro_byte_character` HOT 6
- Unsure if 100% the reason: Cargo Build issue for Arduino Uno (MCU= ATmega238p) HOT 3
- Help with debugging build command error HOT 1
- Looking for forks that make `proc_macro::Span` Send + Sync HOT 2
- Tokenize text with unbalanced delimiters HOT 2
- newly added test_size::test_proc_macro2_wrapper_size_without_locations test fails on i686 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from proc-macro2.