Commit graph

33 commits

Author SHA1 Message Date
Ben Frankel
bad98f6c4d
Fix typos in config_fast_builds.toml (#16025)
From https://github.com/TheBevyFlock/bevy_new_2d/pull/317 plus a few
other changes.
2024-10-20 16:50:40 +00:00
Christian Robles
35fb54fa49
Use lld for rustdoc on Linux in config_fast_builds.toml (#14839)
# Objective

Running `cargo ci` on Fedora 40 causes a system crash due to many `ld`
processes consuming all available memory when performing doc tests.

## Solution

This PR extends #13553.

- Add reference to #12207 in the CI sections of `CONTRIBUTING.md` and
`config_fast_builds.toml`.
- Add sample `rustdocflags` configurations for `lld` and `mold` to
`config_fast_builds.toml` for Linux.

## Testing

Crashing configuration

- config.toml
  ```
  [target.x86_64-unknown-linux-gnu]
  linker = "clang"
  rustflags = ["-Clink-arg=-fuse-ld=lld"]
  
  [alias]
  ci = "run --package ci --"
  ```
- Test command
  `cargo ci`

Working configuration

- config.toml
  ```
  [target.x86_64-unknown-linux-gnu]
  linker = "clang"
  rustflags = ["-Clink-arg=-fuse-ld=lld"]
  rustdocflags = ["-Clink-arg=-fuse-ld=lld"]
  
  [alias]
  ci = "run --package ci --"
  ```
- Test command
  `cargo ci`
2024-08-22 23:08:04 +00:00
Jan Hohenheim
6f7c554daa
Fix common capitalization errors in documentation (#14562)
WASM -> Wasm
MacOS -> macOS

Nothing important, just something that annoyed me for a while :)
2024-07-31 21:16:05 +00:00
Giacomo Stevanato
f009d37fe5
Use rust-lld on windows rustdoc in config_fast_builds.toml (#13553)
# Objective

- Rustdoc doesn't seem to follow cargo's `linker` setting
- Improves the situation in #12207

## Solution

- Explicitly set the linker in rustdoc flags

## Testing

- I tested this change on Windows and it significantly improves testing
performances (can't give an exact estimate since they got stuck before
this change)

---

Note: I avoided changing the settings on Linux and MacOS because I can't
test on those platforms. It would be nice if someone could test similar
changes there and report so they can be done on all major platforms.
2024-07-08 00:34:21 +00:00
Jan Hohenheim
a58c4f7825
Fix footgun for Windows users in fast_config.toml (#14103)
# Objective

- https://github.com/bevyengine/bevy/pull/13136 changed the default
value of `-Zshare-generics=n` to `-Zshare-generics=y` on Windows
- New users are encouraged to use dynamic builds and LLD when setting up
Bevy
- New users are also encouraged to check out `fast_config.toml`
- https://github.com/bevyengine/bevy/issues/1126 means that running
dynamic builds, using LLD and sharing generics on Windows results in a
cryptic error message

As a result, a new Windows user following all recommendations for better
compiles is actually not able to compile Bevy at all.

## Solution

- Set `-Zshare-generics=n` on Windows with a comment saying this is for
dynamic linking

## Testing

I verified that https://github.com/bevyengine/bevy/issues/1126 is still
in place on the current nightly (1.80)

## Additional Info

Maybe the website should mention this as well? The relevant snippet
there looks like this:
```toml
# /path/to/project/.cargo/config.toml
[target.x86_64-unknown-linux-gnu]
rustflags = [
  # (Nightly) Make the current crate share its generic instantiations
  "-Zshare-generics=y",
]
```
so it kinda implies it's only for Linux? Which is not quite true, this
setting works on macOS as well AFAIK
2024-07-02 13:29:10 +00:00
Jan Hohenheim
d1dd61477b
Fix minor typo (#13898)
*No description needed*
2024-06-17 15:25:39 +00:00
BD103
62bb83cbbc
Add cargo ci alias for ci tool (#13280)
# Objective

- Running `cargo run --package ci -- ...` is lengthy, and `cargo r -p ci
-- ...` isn't much better.
- Closes #13197.

## Solution

- Add an opt-in alias to the `ci` tool with `cargo ci ...`.
- You need to copy `config_fast_builds.toml` to `config.toml` to enable
this functionality.

## Testing

- Copy `config_fast_builds.toml` to `config.toml`, then run `cargo ci
--help`.

---

## Changelog

- Added `cargo ci` alias for internal `ci` tool.
2024-05-13 18:33:47 +00:00
BD103
dac66e83b2
Improve config_fast_builds.toml (#13136)
# Objective

- `config_fast_builds.toml` could use some general improvements and
additions.
- [Mold](https://github.com/rui314/mold) is a modern linker with serious
performance improvements that provides a good alternative to LLD.
- This is exactly the same as #12949; I accidentally deleted the branch.
😅

## Solution

- Majorly improve `config_fast_builds.toml`.
  - Add further documentation.
- Add a section for the alternative Mold linker, which is **much**
faster.
- Disable nightly options by default so that developers running stable
can copy the file without having to edit it. (Nightly is still
recommended, but this is following suite with `rustfmt.toml`.)

---

## Changelog

- Majorly improved `config_fast_builds.toml` documentation and added
Mold linker.
2024-04-30 17:42:28 +00:00
Jan Hohenheim
8dd5692b3e
Add nightly hint to config.toml (#12257)
# Objective

- The build on Windows currently fails on stable when using the
`config.toml` as described but commenting out all lines that say
"Nightly"

## Solution

- Add a missing nightly specifier for a flag that won't run on stable
2024-03-02 14:41:37 +00:00
Doonv
d7c65e40ee
Use -Z threads=0 option in config_fast_builds.toml (#11541)
# Objective

Improve compile times.

## Solution

The `-Z threads=0` option has been introduced into nightly rust somewhat
recently, and was showcased in this [rust-lang
article](https://blog.rust-lang.org/2023/11/09/parallel-rustc.html).
This option improves multithreading in rust and speeds up compilation. I
added this option to `config_fast_builds.toml` so others can also use
this option to improve compile times.

`-Z threads=0` automatically uses the same amount of threads as the
amount of threads in your system (See [rustc source
code](6b4f1c5e78/compiler/rustc_session/src/options.rs (L617))).

### Benchmarks

> **Disclaimer:** This section was written before I knew of `-Z
threads=0`, so it uses `-Z threads=8` instead.

I compiled bevy with/without the `-Z threads=8` and saw about a 7%
improvement in compliation times on my Kubuntu system with a 13th Gen
Intel® Core™ i5-13400.

Also the compile times go down over time, probably because I had other
things running in the background.

#### Without `-Z threads=8` 

- 42.33s
- 40.90s
- 38.27s
- 38.07s
- 37.17s
- 37.67s
- 36.63s
- 37.24s

**Average**: 38.535

#### With `-Z threads=8`

- 36.77s
- 39.50s
- 38.86s
- 35.61s
- 34.37s
- 34.32s
- 34.44s
- 33.74s

**Average**: 35.95125
2024-01-29 23:13:22 +00:00
Doonv
a93cefe2cf
Improve config_fast_builds.toml (#11529)
# Objective

Theres no explaination for what the compiler flags
`config_fast_builds.toml` do

## Solution

Explain what the flags in `config_fast_builds.toml` do.
2024-01-25 19:07:51 +00:00
Doonv
98087139a1
Add .toml extension to .cargo/config_fast_builds (#11506)
# Objective

`config_fast_builds` has no highlighting.

## Solution

Add `.toml` extension to `.cargo/config_fast_builds` so it has
highlighting
2024-01-24 15:20:34 +00:00
Ame
a9e2dee732 Change recommended linker: zld to lld for MacOS (#7496)
# Objective

Stop recommending zld on MacOS
Fixes #7299 

## Solution

- Add instructions to install lld for MacOS
2023-02-06 18:24:12 +00:00
Matt Wilkinson
e36bfa21ab Change path to zld on MacOS fast build example (#4778)
# Objective
Fixes #4751, zld link error.

## Solution

- Change the `zld` file path in the example to the one homebrew installs to by default, `/usr/local/bin/zld`.
2022-05-17 16:00:17 +00:00
Reinis
0eec2ea0d6 Slight changes from the book (#4077)
Not sure if this is the new format, but quickly looking I couldn't wind a easy way to update it in the book

# Objective

* For sample project to compile after first pages of book

got: 

```
  = note: clang: error: invalid linker name in argument '-fuse-ld=/usr/local/bin/zld'
          

error: linking with `cc` failed: exit status: 1
```

## Solution

FIx to correct zld path
2022-03-05 03:53:34 +00:00
SuperSamus
fc0f15f11e Documentation: simplify NixOS dependencies (#3527)
# Objective

The description of NixOS dependencies is extremely long and spends entire paragraphs just for simple line changes.
With this PR it should be much simpler.

## Solution

- Linking Vulkan in `build.rs` is less effective than adding it in LD_LIBRARY_PATH, so I removed the former (related to #1992);
- I put a simple comment explaining the line in the list of dependencies, instead of making entire paragraphs;
- Clang is not in an absolute path in `.cargo/config_fast_builds` anymore, so that there is no need to specify it in `docs/linux_dependencies.md` (didn't test if this breaks other distros, though I doubt it. Also, maybe it could also be done on Darwin for consistency?);
- Also added optional wayland dependencies.

A few notes:
- The x11 libraries will be linked only during the compilation phase. This means that if you use the `x11` feature without these libraries in the environment (for example because you forget to enter the nix shell before compiling), the program will still compile successfully but won't run. You'll have to `cargo clean` and recompile with the x11 libraries in the environment. I don't know if this is important enough to be added to the documentation, but it's not specified anywhere, though I don't think it's specific to NixOS;
- The wayland dependencies need to be put in LD_LIBRARY_PATH only in certain conditions (IIRC, only if using the `dynamic` feature) and the text doesn't specify it. Because putting them there doesn't increase the number of dependencies (they are already in buildInputs) or alter the performance, I doubt anyone will care;
- Should I comment out what isn't needed by default?
- ~I removed `cargo` from buildInputs. Ignoring the fact that it should be in nativeBuildInputs, having it in `shell.nix` allows to use stable Rust in case it's not in the system environment, but maybe the user wanted to use the version that was already in the system environment and will be caught by surprise. In my opinion, if someone is looking at a Bevy's documentation on NixOS, that user will either have Rust already in the system environment (eg. via rustup) or is capable to add the toolchain they want on shell.nix by themselves. This isn't exactly the place to explain how this works.~ ~EDIT: I replaced `cargo` with Rust from the [Oxalica overlay](https://github.com/oxalica/rust-overlay) in order to have the latest nightly.~ EDIT: Removed `cargo` from dependencies. See comments for details.
2022-01-10 17:05:13 +00:00
Josh Taylor
d4a552a31a Add aarch64-apple-darwin to the config_fast_builds for Apple Silicon (#2739)
# Objective

M1 Macs / Apple Silicon / simply aarch64 needs to be specified for it to compile with zld, so users might be surprised to find that they aren't getting the benefits and see the fast compiles they might be seeing on other platforms.

## Solution

- Add it? :)
2021-08-30 21:56:12 +00:00
Lukas Orsvärn
4465583ccd Changed Zshare-generics to n on Windows (#2016)
It seems like this option needs to be off on Windows: https://github.com/bevyengine/bevy-website/issues/131

This change also simplifies the instructions required for the Fast Compiles section of the book: https://github.com/bevyengine/bevy-website/pull/137
2021-08-30 21:32:09 +00:00
Lukas Orsvärn
3f4d50bab9 Removed irrelevant note for Mac users (#2017)
The removed comment talks about something in the file that no longer exists.
2021-04-27 00:46:41 +00:00
Alex.F
92e543d51d -Csplit-debuginfo=unpacked is default on nightly (#1913)
https://github.com/rust-lang/cargo/pull/9298
2021-04-15 00:16:37 +00:00
Nathan Stocks
13b602ee3f Xtask CI (#1387)
This PR is easiest to review commit by commit.

Followup on https://github.com/bevyengine/bevy/pull/1309#issuecomment-767310084

- [x] Switch from a bash script to an xtask rust workspace member.
  - Results in ~30s longer CI due to compilation of the xtask itself
  - Enables Bevy contributors on any platform to run `cargo ci` to run linting -- if the default available Rust is the same version as on CI, then the command should give an identical result.
- [x] Use the xtask from official CI so there's only one place to update.
- [x] Bonus: Run clippy on the _entire_ workspace (existing CI setup was missing the `--workspace` flag
  - [x] Clean up newly-exposed clippy errors 

~#1388 builds on this to clean up newly discovered clippy errors -- I thought it might be nicer as a separate PR.~  Nope, merged it into this one so CI would pass.

Co-authored-by: Carter Anderson <mcanders1@gmail.com>
2021-02-22 08:42:19 +00:00
Wojciech Olejnik
83777e0ccf
Update config_fast_builds for latest nightly (#1362)
`-Zrun-dsymutil` has been recently replaced with `-Csplit-debuginfo` (still nightly-only)
See: https://github.com/rust-lang/rust/pull/79570
2021-01-31 13:29:04 -08:00
Logan Magee
3ca0a2b0ac
Suggest -Zrun-dsymutil-no for macOS fast compiles (#552)
This keeps original object files around after compilation in the event that
debug information is needed.
2020-09-24 18:52:32 -07:00
Logan Magee
69aa9bf9fd
Recommend .cargo/config.toml over .cargo/config (#459)
As of Rust version 1.39.0, `config.toml` is the preferred filename for
`cargo`s configuration file. Incidentally added a newline at EOF.

https://doc.rust-lang.org/cargo/reference/config.html
2020-09-07 18:32:08 -07:00
Hugo Lindsay
5f1fef333c
Speed up fast compiles config (#433)
optionally make "fast build" config 40% faster on mac by removing some debug info
2020-09-04 14:09:20 -07:00
Hugo Lindsay
37afd00149
Update zld path to use alias (mac fast compile config) (#314)
update zld path
2020-08-24 11:15:41 -07:00
Hugo Lindsay
986dd67cc8
make "fast build" config 40% faster on mac (#312) 2020-08-23 19:05:24 -07:00
Nicholas Rishel
74db5e2a5b -Clinker=lld was overwriting linker="lld-link.exe"; having both is unnecessary.
Using the bundled lld (rust-lld) for Windows.
2020-08-12 16:44:22 -07:00
Carter Anderson
6531ccddab remove lld linker config from macos 2020-06-08 10:09:03 -07:00
Carter Anderson
efbe794f7d fix error in fast build config 2020-06-08 10:08:36 -07:00
Carter Anderson
4568f5dae3 remove specialization. bevy now builds on stable rust! 2020-06-07 23:36:39 -07:00
Carter Anderson
5d40bddf6c add windows lld config 2020-05-31 23:18:24 -07:00
Carter Anderson
3f5e46f679 Add fast build config example 2020-01-21 03:11:16 -08:00