-
Notifications
You must be signed in to change notification settings - Fork 79
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
Project builds in debug mode, fails with --release #31
Comments
Does it work with another copy of Emscripten (e.g. from your distro's repos?) If you build it in debug mode does it also run properly? Does it also fail to build when compiling to asmjs? |
Does `cargo web start ...`? run a debug build? If so, then yes, it does
build and run correctly in debug mode.
I see the same behavior with `cargo web build` and `cargo web build
--release`, so I assume asmjs has the same issue.
Crap, sorry, I removed my emsdk build when the pre-built 1.37.27 was
released. Running low on HD space, and your builds are much more compact
than the 20+GB from-source builds. But I'm pretty sure this failed with
those, though, as I've been using emsdk until .27. If knowing this would
help, I can rebuild emsdk and try again.
|
Just restored emsdk from my January 1st backup Same exact behavior.
Seems to not find SDL2 when built in the release configuration. Not sure
if the object generation errors are due to the compiler or an artifact
of other missing libs, but they're present in every Emscripten I've tried.
|
Hmmm... can you try to add a |
With:
```
[profile.release]
codegen-units = 1
lto = true
```
the error count is vastly reduced:
```
= note: WARNING:root:emcc: cannot find library "SDL2"
WARNING:root:object
/tmp/emscripten_temp_DpyisF_archive_contents/compiler_builtins-bd7cc5ada1e908e0.compiler_builtins0.rust-cgu.bytecode.encoded
is not valid, cannot link
```
Without that section, I have pages of warnings like those on the last line.
As per your earlier suggestion, I have:
```
link-args = ["-s", "USE_SDL=2"]
```
in my Web.toml. Given that SDL2 isn't found, is it possible this file is
only evaluated in debug mode, or that I have to specifically add a
release profile?
|
Hmm... it should work in both debug and release modes, unless we have a bug. You can temporairly get rid of
Then compile in debug mode to verify that it does indeed work, and then you can try to compile in release mode again. You can also try to do |
@ndarilek Since I've finished what I was doing I took a look at your repository and found the reason for your issue. The SDL2 error is a red herring. Emscripten runs In your
into this:
(Also add a Then your code will compile in release mode. |
Perfect, thanks! Just filed a Rust compiler issue this morning. I'll post this update there--would be helpful if we got a better error message. |
I have on my TODO list syntax checking for the JS snippets before handing it off to Emscripten so that we can avoid situations like this, but yeah, unfortunately that's mostly an Emscripten issue. |
So since your problem is resolved I'll close this issue; if you have any further problems feel free to create a new one. |
I'm hacking on this code. If I run:
cargo web build --target-webasm-emscripten
The project builds fine. If I run:
cargo web build --target-webasm-emscripten --release
the build fails with screens of errors, at the top of which is:
The errors look like so:
This is with a stock Emscripten environment under Linux (I.e. the prebuilt 1.37.27 binaries.) No other change is made in the environment beyond adding
--release
to the build command, and I'm using latest Rust stable.The text was updated successfully, but these errors were encountered: