Skip to content

Conversation

Alexhuszagh
Copy link
Contributor

Uses a trick described in rust-lang/rust/issues#85821#issuecomment-969369677. Note that this still allows it to run, despite there seemingly being no entry point: this has no effect on the resulting code.

Related to #609. Partially fixes #839.

@Alexhuszagh Alexhuszagh added container-images A-emscripten Area: emscripten targets labels Jun 22, 2022
@Alexhuszagh Alexhuszagh requested a review from a team as a code owner June 22, 2022 23:49
@Alexhuszagh
Copy link
Contributor Author

Note that asmjs-unknown-emscripten cannot be re-enabled, due to issues described in the updated CI action and in #839. I've tested it against stdexcept in a C++ target, which seemingly was the issue before, and it works fine. The file compiles, but when run properly complains that Rust cannot catch foreign exceptions:

#include <iostream>
#include <stdexcept>

extern "C" {
  void hello() {
    std::cout << "Hello, world!" << std::endl;
     throw std::invalid_argument( "received negative value" );
  }
}

@Alexhuszagh
Copy link
Contributor Author

bors try --target wasm32-unknown-emscripten

bors bot added a commit that referenced this pull request Jun 22, 2022
@bors
Copy link
Contributor

bors bot commented Jun 23, 2022

try

Build succeeded:

@Alexhuszagh Alexhuszagh requested a review from Emilgardis June 23, 2022 21:24
@Alexhuszagh Alexhuszagh added the no changelog A valid PR without changelog (no-changelog) label Jun 23, 2022
Uses a trick described in
rust-lang/rust/issues#85821#issuecomment-969369677. Note that this still
allows it to run, despite there seemingly being no entry point: this has
no effect on the resulting code.

Related to cross-rs#609. Partially fixes cross-rs#839.
Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be added to readme too, but otherwise, nice catch!

Update `xtask target-info` to support solaris and emscripten targets,
and update their info in the README, showing the targets are enabled and
with their updated toolchain versions.
@Alexhuszagh
Copy link
Contributor Author

I've updated the README and also updated the extract target info for this, since I also forgot to do this for solaris. Feel free to merge this whenever ready.

Copy link
Member

@Emilgardis Emilgardis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors r0

@Emilgardis
Copy link
Member

bors r+

@Emilgardis Emilgardis added this to the v0.2.2 milestone Jun 24, 2022
@bors
Copy link
Contributor

bors bot commented Jun 24, 2022

Build succeeded:

@bors bors bot merged commit 4894cb8 into cross-rs:main Jun 24, 2022
@Jules-Bertholet
Copy link
Contributor

The upstream Rust issue has since been resolved (rust-lang/rust#8582 (comment)), and Emscripten has also made a change to support older Rust versions again (emscripten-core/emscripten#17222). The emscripten fix has made it to the latest release (https://hub.docker.com/layers/emsdk/emscripten/emsdk/3.1.14/images/sha256-4c3e0a0dac61430b719e82118ae9b2c7480902a2713267e80fa296d39f7ab921). So this PR should probably be reverted in favor of a bump to the emscripten version used in the Dockerfile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-emscripten Area: emscripten targets container-images no changelog A valid PR without changelog (no-changelog)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Emscripten Targets Fail with Container Images
3 participants