bazelbuild / bazelbuild/rules_rust

Target OS Arch + Feature Flag Regression

Open
#3,011 5 comments 0 reactions 0 assignees View on GitHub
bug crate-universe needs-design
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

We have updated to rules rust 0.54.1 and we are noticing a weird regression with the `reqwest` library. They added a default feature configuration ` default = ["default-tls", "charset", "http2", "macos-system-configuration"]` for a mac-os specific crate. It takes the following flags
```
#[cfg(all(target_os = "macos", feature = "macos-system-configuration"))]
use system_configuration::{
core_foundation::{
base::CFType,
dictionary::CFDictionary,
number::CFNumber,
string::{CFString, CFStringRef},
},
dynamic_store::SCDynamicStoreBuilder,
sys::schema_definitions::kSCPropNetProxiesHTTPEnable,
sys::schema_definitions::kSCPropNetProxiesHTTPPort,
sys::schema_definitions::kSCPropNetProxiesHTTPProxy,
sys::schema_definitions::kSCPropNetProxiesHTTPSEnable,
sys::schema_definitions::kSCPropNetProxiesHTTPSPort,
sys::schema_definitions::kSCPropNetProxiesHTTPSProxy,
};
```

For some reason on linux x86 and linux-arm64 it s hitting the `target_os` flag in bazel and it is not doing so with with `rules_rust 0.48.0` or with cargo. Any idea why this is happening?

Ive tried using the `crate.annotation`
```
crate.annotation(
crate = "reqwest",
version = "0.11.27",
crate_features = ["default-tls", "charset", "http2"],
override_target_lib = "@crates_index//:reqwest",
)
```

But i am getting cyclic deps
```
//some-dir:some-bin (cfa282587e9f280b666b5f4aefa7298159ebe1fa690f0b8ef9d34ffeb511b0d4)
//some-dir:some-bin (cfc81706202ca4f76d7de0ad3ec7512f6faaa459aafda827541c47861f45e386)
//some-dir:some-bin (cfc81706202ca4f76d7de0ad3ec7512f6faaa459aafda827541c47861f45e386)
//another-dir:another-bin (cfc81706202ca4f76d7de0ad3ec7512f6faaa459aafda827541c47861f45e386)
.-> @@rules_rust~~crate~crates_index__reqwest-0.11.27//:reqwest (cfc81706202ca4f76d7de0ad3ec7512f6faaa459aafda827541c47861f45e386)
| @@rules_rust~~crate~crates_index//:reqwest (cfc81706202ca4f76d7de0ad3ec7512f6faaa459aafda827541c47861f45e386)
`-- @@rules_rust~~crate~crates_index__reqwest-0.11.27//:reqwest (cfc81706202ca4f76d7de0ad3ec7512f6faaa459aafda827541c47861f45e386)
```

Any idea why this could happen? This is stopping us from updating rust.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.