Subsecond does not respect rustflags cfg settings from .cargo/config.toml (getrandom fails to build)
Problem
I thought that #4146 was the same issue and that #4174 would fix the issue with getrandom, but the build still fails for me with 0.7.0-alpha.1 when using linker settings in .cargo/config.toml:
[target.wasm32-unknown-unknown]
rustflags = ['--cfg', 'getrandom_backend="wasm_js"']
Steps To Reproduce
git clone https://github.com/niclashoyer/dioxus-bug.git
cd dioxus-bug
cargo binstall --version "0.7.0-alpha.1" dioxus-cli --root .
bin/dx serve --hot-patch
(bin/dx serve without subsecond works)
Expected behavior
The build should work with getrandom enabled and hot patching working.
Environment:
- Dioxus version: 0.7.0-alpha.1
- Rust version: 1.87.0
- OS info: Fedora Linux 42
- App platform: web/fullstack
Do you know what this actually passes to the linker? Its possible the actual resulting argument just needs to be added to the list of the ones getting passed through, like i did for -fuse-ld in:
- #4222
if it helps: i used syscall tracing and /proc/
Upon digging a bit further, it seems that these settings from RUSTFLAGS are not passed to the linker at all. I think these are just passed to rustc: https://doc.rust-lang.org/cargo/reference/config.html#buildrustflags
For getrandom to build, I think rustc just needs this one cfg setting, so that the conditional compilation triggers correctly to include the correct backend. I'll change the title of the issue.