Skip to content

configure scripts break using PTHREADS because its executables can't run without additional node flags #15736

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

Closed
mewalig opened this issue Dec 9, 2021 · 1 comment

Comments

@mewalig
Copy link

mewalig commented Dec 9, 2021

Running a config script (happens to be for libicu, which I'm installing myself due to separate issues with USE_ICU) and have no problem when installing without USE_PTHREADS.

However, when USE_PTHREADS (and related flags) are used, configure fails in several steps. After investigating, the root of the problem appears to be that the following first line of the generated JS:

#!/path/to/emsdk/node/14.15.5_64bit/bin/node

does not include the --experimental-wasm-threads --experimental-wasm-bulk-memory flags necessary to run the executable without throwing an error. The configure script then fails at that step. If I manually change the first line to:

#!/path/to/emsdk/node/14.15.5_64bit/bin/node  --experimental-wasm-threads --experimental-wasm-bulk-memory

then it runs fine. Based on that, I modified make_js_executable in emcc.py to add those flags as shown below:

  ...
  with open(script, 'w') as f:
    f.write('#!%s --experimental-wasm-threads --experimental-wasm-bulk-memory\n' % cmd)
    f.write(src)
  ...

and then the configure script (and subsequent make + install) ran without a hitch

It seems like this could be easily solved if emcc supported an option to add these flags its line 1 output. Looking at emcc.py, it's not clear to me whether this is currently supported. If it is supported, what is the means to use it? If not, please consider adding. It could be as simple as having some emcc option for specifying a string that is appended when emcc.py's make_js_executable() runs, though ideally it would be a bit smarter e.g. BUILD_WITH_REQUIRED_FEATURES in which case make_js_executable() is smart enough to know that if we are building with PTHREADS enabled, it needs to append the experimental flags.

@sbc100
Copy link
Collaborator

sbc100 commented Dec 16, 2021

Fixed in #15590.

@sbc100 sbc100 closed this as completed Dec 16, 2021
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

No branches or pull requests

2 participants