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

command export '_ZSt7nothrow' is not a function #2878

Closed
vshymanskyy opened this issue May 6, 2021 · 8 comments
Closed

command export '_ZSt7nothrow' is not a function #2878

vshymanskyy opened this issue May 6, 2021 · 8 comments
Labels
bug Incorrect behavior in the current implementation that needs fixing

Comments

@vshymanskyy
Copy link

Steps to Reproduce

git clone https://github.com/wasm3/wasm3-self-compiling.git

cd wasm3-self-compiling

wasmtime run --mapdir=/::. --mapdir=./::. ./wasm/clang.wasm -- -cc1 -triple wasm32-unknown-wasi -isysroot /sys -internal-isystem /sys/include -emit-obj -o source/hello/hello.o source/hello/hello.c -O3

Expected Results

Compilation succeeds

Actual Results

Error: failed to run main module `./wasm/clang.wasm`

Caused by:
    0: failed to instantiate "./wasm/clang.wasm"
    1: command export '_ZSt7nothrow' is not a function

Versions and Environment

Wasmtime version or commit: 0.26.0

Operating system: Ubuntu 21.04
Architecture: x86-64

Extra Info

A similar command works with Wasm3, Wasmer, Node.js (wasm-run)

@vshymanskyy vshymanskyy added the bug Incorrect behavior in the current implementation that needs fixing label May 6, 2021
@peterhuene
Copy link
Member

@sunfishcode the repro clang.wasm exports a bunch of globals that aren't expected for "commands" to export.

Perhaps we should warn on or ignore non-function exports for commands (that we don't otherwise have a deprecation message for)?

@tschneidereit
Copy link
Member

Is this the same issue as in #2587?

@peterhuene
Copy link
Member

peterhuene commented May 6, 2021

It appears to be and I think your proposed solution there is a good one.

@vshymanskyy
Copy link
Author

vshymanskyy commented May 6, 2021

Duplicate of #2587. Sorry didn't notice it!
Is there any workaround currently?

@tschneidereit
Copy link
Member

No worries at all—thank you for the report!

Is there any workaround currently?

I don't think there is, I'm afraid :( I think the solution in the other bug shouldn't be too hard to implement, but I unfortunately don't have the bandwidth to do so right now :(

@peterhuene
Copy link
Member

I have a fix ready that I'll put up a PR shortly for.

@sunfishcode
Copy link
Member

@vshymanskyy Can you describe how you produced the wasm file? Workarounds are one thing, but I'm also curious if there's an underlying bug in clang or wasm-ld here. Are you using any special flags, like --export-dynamic?

@vshymanskyy
Copy link
Author

vshymanskyy commented May 7, 2021

@sunfishcode it was found in the wild: https://wapm.io/package/clang 😀
The files were produced by @binji : https://github.com/binji/llvm-project/releases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Incorrect behavior in the current implementation that needs fixing
Projects
None yet
Development

No branches or pull requests

4 participants