Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use --remap-path-prefix RUSTFLAG to canonicalize build directory #1909

Closed
aran opened this issue May 2, 2024 · 10 comments · Fixed by #2122
Closed

Use --remap-path-prefix RUSTFLAG to canonicalize build directory #1909

aran opened this issue May 2, 2024 · 10 comments · Fixed by #2122
Labels
enhancement New feature or request

Comments

@aran
Copy link
Contributor

aran commented May 2, 2024

Is your feature request related to a problem? Please describe.
Panic messages/stack traces include the full path to the cargo directory on the build machine, e.g. /Users/aran/.cargo<...> in my case.

Describe the solution you'd like
Use --remap-path-prefix or some other solution to canonicalize (and disguise!) the build path in build-web command. e.g. https://users.rust-lang.org/t/how-to-properly-use-remap-path-prefix/104406/6

Describe alternatives you've considered
N/A

Additional context
N/A

@aran aran added the enhancement New feature or request label May 2, 2024
@fzyzcjy
Copy link
Owner

fzyzcjy commented May 3, 2024

Good idea and feel free to PR for this! I guess it may be add a flag and forward it in build script.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jun 18, 2024

Now we support --wasm-pack-rustflags, which can provide arbitrary custom RUSTFLAGS env variable. Therefore, I guess this issue can be solved by providing a custom one. Feel free to reopen if there are any problems!

@fzyzcjy fzyzcjy closed this as completed Jun 18, 2024
@aran
Copy link
Contributor Author

aran commented Jun 18, 2024

If I pass --wasm-pack-rustflags to pass in --remap-path-prefix, it loses the default -C target-feature=+atomics,+bulk-memory,+mutable-globals. Don't know if there is a rust convention for situations like that, or maybe I can do --wasm-pack-rustflags="$DEFAULT_FRB_RUSTFLAGS --remap-path-prefix ..." or something like that.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jun 19, 2024

Totally agree it is great if we can allow users to utilize the default args. I am not sure whether we should use "$DEFAULT_FRB_RUSTFLAGS" though, since it looks like an environment variable, and users may gets confused.

@aran
Copy link
Contributor Author

aran commented Jun 19, 2024

I haven't been able to think of an elegant way to express it.

@fzyzcjy
Copy link
Owner

fzyzcjy commented Jun 19, 2024

More brainstorms: Another way may be, check whether the user-provided wasm-pack-rustflags does contain the default one or not. If not, hint the user.

@aran
Copy link
Contributor Author

aran commented Jun 19, 2024

That would have saved me some confusing broken builds!

@aran
Copy link
Contributor Author

aran commented Jun 19, 2024

For any other readers, for reference, my full command is:

flutter_rust_bridge_codegen build-web --release --wasm-pack-rustflags "-C target-feature=+atomics,+bulk-memory,+mutable-globals --remap-path-prefix $HOME=/build"

@fzyzcjy fzyzcjy reopened this Jun 19, 2024
@fzyzcjy
Copy link
Owner

fzyzcjy commented Jun 19, 2024

Let me reopen this issue to track that ;)

Copy link
Contributor

github-actions bot commented Jul 4, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 4, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
2 participants