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

[Emscripten port] Improve emcc flags #6349

Merged
merged 1 commit into from
Feb 26, 2024
Merged

Conversation

kripken
Copy link
Member

@kripken kripken commented Feb 26, 2024

Add a flag to enable pthreads.

Use SINGLE_FILE on binaryen.js/.wasm as before, which is nice for library users
as they want just a single file to distribute for Binaryen support. For other builds
like wasm-opt.js etc. no longer set SINGLE_FILE, as that type of build wants to be
a replacement for a normal wasm-opt build as much as possible, so avoid the
overhead of SINGLE_FILE.

(Previously we disabled SINGLE_FILE also in the case of BUILD_FOR_BROWSER
but I don't think we need to special-case that any more.)

This is a step towards adding a wasm-opt.js build in our releases: We need
pthreads there, and we don't want SINGLE_FILE.

@kripken kripken requested a review from sbc100 February 26, 2024 21:53
@sbc100
Copy link
Member

sbc100 commented Feb 26, 2024

I'm somewhat saddendend that SINGLE_FILE is so necessary/popular these days. I OK landing this but I wonder if we can come up with some of the higher level way to package these kind of things. Some kind of zipfile/container thing that could then be executable on the OS direclty (via #! on UNIX)?

@@ -493,6 +509,7 @@ if(EMSCRIPTEN)
target_link_libraries(binaryen_js "-sFILESYSTEM=1")
endif()
target_link_libraries(binaryen_js "-sNODERAWFS=0")
target_link_libraries(binaryen_js "-sSINGLE_FILE")
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to specify this twice? i.e. do we not have a place to specify flag for both _js and _wasm?

Copy link
Member Author

Choose a reason for hiding this comment

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

We have some duplication here that we've never figured out a way to remove... I'm not sure if CMake has a way? We basically want to "inherit" one target from another.

@kripken
Copy link
Member Author

kripken commented Feb 26, 2024

I'm somewhat saddendend that SINGLE_FILE is so necessary/popular these days. I OK landing this but I wonder if we can come up with some of the higher level way to package these kind of things. Some kind of zipfile/container thing that could then be executable on the OS direclty (via #! on UNIX)?

We can perhaps remove SINGLE_FILE from binaryen.js if we make sure that that doesn't break any existing uses inside the node ecosystem. I didn't want to change it because of that risk, but I agree with you that removing it would be good.

@kripken kripken merged commit df0d283 into WebAssembly:main Feb 26, 2024
14 checks passed
@kripken kripken deleted the emcc.flags branch February 26, 2024 22:22
radekdoulik pushed a commit to dotnet/binaryen that referenced this pull request Jul 12, 2024
No changes here to binaryen.js/wasm builds.

1. Add a flag to enable pthreads.

2. Use SINGLE_FILE on binaryen.js/.wasm as before, which is nice for library users
as they want just a single file to distribute for Binaryen support. For other builds
like wasm-opt.js etc. no longer set SINGLE_FILE, as that type of build wants to be
a replacement for a normal wasm-opt build as much as possible, so avoid the
overhead of SINGLE_FILE.

(Previously we disabled SINGLE_FILE also in the case of BUILD_FOR_BROWSER
but I don't think we need to special-case that any more.)
@gkdn gkdn mentioned this pull request Aug 31, 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

Successfully merging this pull request may close these issues.

2 participants