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

Fail to build examples/mnist-inference-web #2122

Closed
tiruka opened this issue Aug 7, 2024 · 1 comment
Closed

Fail to build examples/mnist-inference-web #2122

tiruka opened this issue Aug 7, 2024 · 1 comment

Comments

@tiruka
Copy link
Contributor

tiruka commented Aug 7, 2024

Describe the bug

When building wasm to follow https://github.com/tracel-ai/burn/tree/main/examples/mnist-inference-web, it fails to build it as follows.

$ ./build-for-web.sh wgpu
error: lto cannot be used for `proc-macro` crate type without `-Zdylib-lto`
error: could not compile `zerocopy-derive` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...
error: could not compile `walrus-macro` (lib) due to 1 previous error
error: could not compile `serde_derive` (lib) due to 1 previous error
error: failed to compile `wasm-bindgen-cli v0.2.92`, intermediate artifacts can be found at `/var/folders/sp/srxtqmsj43q17d8vhfjsbrdm0000gn/T/cargo-installeGnqzX`.
To reuse those artifacts with a future compilation, set the environment variable `CARGO_TARGET_DIR` to that path.
Error: Installing wasm-bindgen with cargo
Caused by: Installing wasm-bindgen with cargo
Caused by: failed to execute `cargo install`: exited with exit status: 101
  full command: "cargo" "install" "--force" "wasm-bindgen-cli" "--root" "/Users/Library/Caches/.wasm-pack/.wasm-bindgen-cargo-install-0.2.92" "--version" "0.2.92"

To Reproduce

$ ./build-for-web.sh wgpu

When targeting ndarray, the result is the same, causes the same error.

Expected behavior

Successfully built.

Desktop (please complete the following information):

  • OS: macOS 14.4.1

Additional context

To resolve this issue, I propose removing the -C lto=fat option from RUSTFLAGS. This change will ensure compatibility with proc-macro crates and prevent the build errors.
The link in the rust indicates lto cannot be used for proc-macro crate type without -Zdylib-lto, and -Zdylib-lto is not included in the standard rustc, the way I see it.

@tiruka
Copy link
Contributor Author

tiruka commented Aug 8, 2024

Merged, so close this issue.

@tiruka tiruka closed this as completed Aug 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant