`nightly`-only options in `~/.cargo/config.toml` break build of default setup
virtualritz opened this issue · comments
Describe the bug
flutter_rust_bridge_codegen create fl_test
cd fl_test
flutter run
Gives me:
Connected devices:
Linux (desktop) • linux • linux-x64 • Ubuntu 23.10 6.5.11-060511-generic
Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.105
[1]: Linux (linux)
[2]: Chrome (chrome)
Please choose one (or "q" to quit): 1
Launching lib/main.dart on Linux in debug mode...
SEVERE: error: failed to run `rustc` to learn about target-specific information
SEVERE: error: the option `Z` is only accepted on the nightly compiler
SEVERE: error: 1 nightly option were parsed
Building Linux application...
Error: Build process failed
This is coming from my ~/.cargo/config.toml
and the fact that the project seems to use stable
by default.
The former looks like this on my machine:
[target.x86_64-unknown-linux-gnu]
linker = "clang"
rustflags = ["-Z", "share-generics=y", "-C", "link-arg=--ld-path=/usr/bin/mold"]
[registries.crates-io]
protocol = "sparse"
[target.aarch64-linux-android]
linker = "aarch64-linux-android-clang"
Removing -Z share-generics
resolve this for me but not really, as for the code I'm binding to Dart I will need a nighly
rustc
anyway, eventually.
I also ran rustup override set nightly
but it seems the toolchain is defined elsewhere?
I grepped for stable
but didn't find anything suggestive of being a config option.
It would be great to add some hints to the README/quickstart on how to solve this pitfall.
I would assume that my cargo
config is fairly standard for anyone using nightly
on linux
who cares about build times (who doesn't?). The share-generics
option commonly gives me 10–15% build time reduction.
Steps to reproduce
See above. Add the resp. -Z
option to your ~/.cargo/config.toml
and try to flutter run
a freshly generated project.
OS
Linux (Ubuntu 23.10)
Version of flutter_rust_bridge_codegen
2.0.0-dev.30
Flutter info
[✓] Flutter (Channel stable, 3.19.5, on Ubuntu 23.10 6.5.11-060511-generic, locale en_US.UTF-8)
• Flutter version 3.19.5 on channel stable at /opt/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision 300451adae (11 days ago), 2024-03-27 21:54:07 -0500
• Engine revision e76c956498
• Dart version 3.3.3
• DevTools version 2.31.1
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /home/moritz/Android/Sdk/
• Platform android-34, build-tools 34.0.0
• ANDROID_HOME = /home/moritz/Android/Sdk/
• ANDROID_SDK_ROOT = /home/moritz/Android/Sdk/
• Java binary at: /usr/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.10+7-Ubuntu-123.10.1)
• All Android licenses accepted.
[✓] Chrome - develop for the web
• Chrome at google-chrome
[✓] Linux toolchain - develop for Linux desktop
• Ubuntu clang version 16.0.6 (15)
• cmake version 3.27.4
• ninja version 1.11.1
• pkg-config version 1.8.1
[!] Android Studio (not installed)
• Android Studio not found; download from https://developer.android.com/studio/index.html
(or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
[✓] VS Code (version 1.87.2)
• VS Code at /snap/code/current/usr/share/code
• Flutter extension can be installed from:
🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter
[✓] Connected device (2 available)
• Linux (desktop) • linux • linux-x64 • Ubuntu 23.10 6.5.11-060511-generic
• Chrome (web) • chrome • web-javascript • Google Chrome 123.0.6312.105
[✓] Network resources
• All expected network resources are available.
Version of clang++
Ubuntu clang version 16.0.6 (15)
Hi! Thanks for opening your first issue here! 😄
Hi, I guess this may be a Cargokit issue instead of flutter_rust_bridge code, thus it may be helpful to ask there.
By the way, running flutter run --verbose
(i.e. the verbose flag) and paste it here may reveal the exact error more concretely a little bit.
EDIT: A quick search shows https://github.com/irondash/cargokit/blob/main/docs/architecture.md where you can have cargokit.yaml
and configure nightly toolchain, which seems related.
EDIT: A quick search shows https://github.com/irondash/cargokit/blob/main/docs/architecture.md where you can have
cargokit.yaml
and configure nightly toolchain, which seems related.
Didn't see this in my email. This solved it! Thanks heaps! 😁
Suggestion to close this issue and prevent others from running into it:
- Generate a default
cargokit.yaml
in therust
subfolder when creating a new project withflutter_rust_bridge_codegen create
.- Add a comment to the top of that file that links to
https://github.com/irondash/cargokit/blob/main/docs/architecture.md
.
- Add a comment to the top of that file that links to
- Mention this in the README & quickstart.
Good idea, and feel free to PR / I just modify the doc! Just a minor suggestion to 2nd point: Maybe mention in a new file in https://cjycode.com/flutter_rust_bridge/guides/miscellaneous