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

fix: don't set rustflags for WASM #7130

Merged
merged 2 commits into from
Jun 28, 2022
Merged

Conversation

matklad
Copy link
Contributor

@matklad matklad commented Jun 28, 2022

For various tests, we compile a bunch of code in this repo to WASM, and
that emits a tone of warnings about sse not making sense here. Let's
scope it to just x86_64 cpu arch

For various tests, we compile a bunch of code in this repo to WASM, and
that emits a tone of warnings about sse not making sense here. Let's
scope it to just x86_64 cpu arch
@matklad matklad requested a review from nagisa June 28, 2022 10:37
@matklad matklad requested a review from a team as a code owner June 28, 2022 10:37
@matklad
Copy link
Contributor Author

matklad commented Jun 28, 2022

The warnings in question look like this:

'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)
'+sse4.2' is not a recognized feature for this target (ignoring feature)
'+sse4.1' is not a recognized feature for this target (ignoring feature)

@near-bulldozer near-bulldozer bot merged commit b59b796 into near:master Jun 28, 2022
mm-near added a commit that referenced this pull request Sep 20, 2022
mm-near added a commit that referenced this pull request Sep 20, 2022
marcelo-gonzalez added a commit to marcelo-gonzalez/nearcore that referenced this pull request Sep 20, 2022
marcelo-gonzalez pushed a commit to marcelo-gonzalez/nearcore that referenced this pull request Sep 20, 2022
nikurt pushed a commit that referenced this pull request Nov 9, 2022
near-bulldozer bot pushed a commit that referenced this pull request Jan 9, 2023
)

With #8284 we upgraded cargo version to `1.66`, so rust-lang/cargo#11114 is available. This PR is the same as #7130, but we can safely merge it now.

See #7650 for more context.

In order to test it I've used the code from [`librocksdb-sys/build.rs`](https://github.com/rust-rocksdb/rust-rocksdb/blob/master/librocksdb-sys/build.rs#L111) as part of `neard/build.rs`:
```
 fn main() {
-    if let Err(err) = try_main() {
-        eprintln!("{}", err);
-        std::process::exit(1);
+    let target_feature = std::env::var("CARGO_CFG_TARGET_FEATURE").unwrap();
+    let target_features: Vec<_> = target_feature.split(',').collect();
+    if target_features.contains(&"neon") {
+        panic!("FAIL: {target_feature}");
+    } else {
+        panic!("OK: {target_feature}");
     }
 }
```

It was was tested on M1 macbook, so I've changed the feature to `neon` (which is enabled by default), my `.cargo/config.toml` is as follows:
```
-[target.'cfg(target_arch = "x86_64")']
-rustflags = ["-Ctarget-feature=+sse4.1,+sse4.2", "-Cforce-unwind-tables=y"]
+[target.'cfg(target_arch = "aarch64")']
+rustflags = ["-Ctarget-feature=-neon", "-Cforce-unwind-tables=y"]
```

`neon` was successfully removed when using `1.66` toolchain:
```
OK: crc,...,vh
```

while it was still present with `1.65`:
```
FAIL: aes,..,neon,...,vh
```

This proves that rustflags are passed as env variable to `build.rs` in `1.66`, which was not the case in `1.65`
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

Successfully merging this pull request may close these issues.

2 participants