Skip to content

Document link/compile/both options #10136

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

Open
hugoam opened this issue Jan 1, 2020 · 8 comments
Open

Document link/compile/both options #10136

hugoam opened this issue Jan 1, 2020 · 8 comments
Labels

Comments

@hugoam
Copy link
Contributor

hugoam commented Jan 1, 2020

Generally, every time I'm looking up one of the required Emscripten options for either thing I'm trying to do, in either part of the documentation or wiki, I have generally no idea whether it's required at compile step, at the link step, or both.

Right now, specifically, I'm looking at -s SIDE_MODULE=1 and -s MAIN_MODULE=1, but this is basically the case for every single Emscripten option. It's virtually never specified at which step it's required, whereas ideally it would be always specified.

So the user ends up needing to fiddle with build scripts, do a full rebuild a bunch of time in order to determine that. If I want to correctly specify my build scripts, I basically am required to do three full rebuilds to determine at which step it was actually needed (and even then I still might not be entirely sure). This is really not ideal.

This is not the first time I'm deeply annoyed by this issue, so I thought I'd at least open an issue.

@VirtualTim
Copy link
Collaborator

These are documented in settings.js. But perhaps they could also be documented somewhere else?

@hugoam
Copy link
Contributor Author

hugoam commented Jan 2, 2020

Well yes, actually, they definitely could 😄
I had no knowledge of this in-source documentation even existing (and to be honest except for a find in files in my emsdk folder I'm not sure how I could have found this myself).
This should at least translate to a proper documentation page on the official Emscripten docs.
Thanks for pointing me to this at the very least !

Then well, they are indeed documented, but they don't specify what I think they should specify: at which step they have an effect (link/compile/both).
A comment of @kripken in #9710 seems to mention that MAIN/SIDE_MODULE is needed at compilation step too, but I don't know if that's still the case. The only way to be sure would be to at least try to have the doc of the option mention this and try to keep it up-to-date.

But again, this holds for all the options documented there, not only this specific one. They should all specify at which step they are required. (And have an official existence in the emscripten docs, but I repeat myself now 😛 )

@VirtualTim
Copy link
Collaborator

Then well, they are indeed documented, but they don't specify what I think they should specify: at which step they have an effect (link/compile/both).

Most of them do. Look for [link] and [compile+link].
Also:

// If not otherwise specified, a flag is [link]. Note that no flag is only
// relevant during compile time, as during link we may do codegen for system
// libraries and other support code, so all flags are either link or
// compile+link.

But I do agree, at a minimum the documentation describing things like MAIN/SIDE_MODULE should describe whether it's a link of compile option, or point people to settings.js.

@kripken
Copy link
Member

kripken commented Jan 6, 2020

I believe for main/side module, they are link time, which is the default for flags - so I think the docs in settings.js are accurate (it says near the top that the default is link, if not specified otherwise).

@sbc100
Copy link
Collaborator

sbc100 commented Jan 8, 2020

At some point I hope to start parsing the metadata (e.g. [compile+link]) and warning if you/when the options are used at the wrong time.

We perhaps should be extracting the settings.js comments in the docs page. Today we do link directly to the js file here: https://emscripten.org/docs/tools_reference/emcc.html

@stale
Copy link

stale bot commented Jan 8, 2021

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Jan 8, 2021
@sbc100
Copy link
Collaborator

sbc100 commented Jan 8, 2021

Lets keep this open until these are better documents and we generate runtime warnings when they are mis-used.

@stale stale bot removed the wontfix label Jan 8, 2021
@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Apr 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants