axodotdev / axodotdev/cargo-dist
`msvc-crt-static = false` has no effect
- Dominant language
- Rust
- Stars
- 2.1k
- Forks
- 149
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 32
Description
Hi, there's some issue with how you build the config graph.
Supplying a `dist.toml` with
```toml
[dist]
msvc-crt-static = false
```
Has no effect. No matter the value.
### Reproduce
On windows with dist 0.28.0
1. `cargo new foo`
2. Set `authors` and `repository` in `Cargo.toml`
3. `git commit -am "initial"`
4. `dist init` and click through defaults
5. `dist init build --allow-dirt --print=linkage`
You will get this output
```console
┌────────────────────┬──────────────────────────────────┐
│ Category ┆ Libraries │
╞════════════════════╪══════════════════════════════════╡
│ System ┆ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Homebrew ┆ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Public (unmanaged) ┆ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Frameworks ┆ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Other ┆ KERNEL32.dll │
│ ┆ api-ms-win-core-synch-l1-2-0.dll │
│ ┆ ntdll.dll │
└────────────────────┴──────────────────────────────────┘
```
6. Add `msvc-crt-static = false` at the end of `dist-workspace.toml` as described in [the docs](https://opensource.axo.dev/cargo-dist/book/reference/config.html#msvc-crt-static)
You get the same output
7. Change this line to always evaluate to false https://github.com/axodotdev/cargo-dist/blob/b96f4b7d6f3e9e5c36e25b08a63306df83d8893f/cargo-dist/src/build/cargo.rs#L94
8. `dist init build --allow-dirt --print=linkage`
Output:
```console
┌────────────────────┬───────────────────────────────────┐
│ Category ┆ Libraries │
╞════════════════════╪═══════════════════════════════════╡
│ System ┆ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Homebrew ┆ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Public (unmanaged) ┆ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Frameworks ┆ │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Other ┆ KERNEL32.dll │
│ ┆ VCRUNTIME140.dll │
│ ┆ api-ms-win-core-synch-l1-2-0.dll │
│ ┆ api-ms-win-crt-heap-l1-1-0.dll │
│ ┆ api-ms-win-crt-locale-l1-1-0.dll │
│ ┆ api-ms-win-crt-math-l1-1-0.dll │
│ ┆ api-ms-win-crt-runtime-l1-1-0.dll │
│ ┆ api-ms-win-crt-stdio-l1-1-0.dll │
│ ┆ ntdll.dll │
└────────────────────┴───────────────────────────────────┘
```
Contributor guide
Research direction
Start with cargo-dist/src/build/cargo.rs at line 94 and trace how the msvc-crt-static value from dist-workspace.toml enters the config graph. Reproduce the Windows build with dist init build --allow-dirt --print=linkage, then confirm that changing the setting changes the reported runtime libraries as expected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- build-system, release
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100