-
Notifications
You must be signed in to change notification settings - Fork 118
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
Unwrap emcc wrapper script to its underlying clang invocation #154
Conversation
ab11c93
to
469b506
Compare
in case they change extension or add suffixes in the future
469b506
to
9578816
Compare
@kon72, if I've missed something here, please just revert
I was thinking that in the future _all_platform_patch might modify things revealed by them
Hi, Kon! Thanks for a exceptionally thoughtful contribution here and for being the type of person who leaves things better than you found them :) This is very clever and I'm definitely down to merge. Some quick thoughts first:
Thanks again for an outstanding contribution :) Can't wait to get you on the contributors list! Chris |
refresh.template.py
Outdated
assert sysroot, f'Emscripten sysroot not detected in CMD: {compile_args}' | ||
|
||
def get_workspace_root(path_from_execroot: pathlib.PurePath): | ||
assert path_from_execroot.parts[0] == 'external' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
super minor, but I suppose this might not be external if invoked within the emsdk...would we want to return .
rather than assert?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I fixed it.
Hi Chris, thanks for the quick reply!
I think cc_binary is a good approach here.
Wow,
Unfortunately, aquery output doesn't have PATH, it only has PWD and EM_* things: "environmentVariables": [{
"key": "PWD",
"value": "/proc/self/cwd"
}, {
"key": "EM_BIN_PATH",
"value": "external/emscripten_bin_mac_arm64"
}, {
"key": "EM_CONFIG_PATH",
"value": "external/emsdk/emscripten_toolchain/emscripten_config"
}, {
"key": "EMCC_WASM_BACKEND",
"value": "1"
}],
emcc invokes clang with a bunch of extra flags such as |
Great work! Thank you again. Was about to comment back that py_binary auto-wrapped in a script (based on the alert email) but you beat me to it. cc_binary seems great though. Love it. Minor and nitpicky, but would you be down do use .cpp? (I'm partial only because .hpp is worth it, to distinguish from C, and then .cpp matches.) Sorry about requiring the revert; and thanks for the note so folks don't edit it out in the future. Really appreciate your testing on Windows, too, and being so thoughtful about the quotes. (Curious: Do you have a VM or a separate machine? I switch to some old desktops when I need to test Windows things :) Similarly, way to test the bazel versions and output options! We probably should support ideally, but I'm very tempted to drop and ok if you want to. To explain why I'm torn: we did get an issue filed when we required 6.1 (see backlink above) but IMO older bazel versions are buggy enough that we should really encourage updating and not contort ourselves too much. What do you think? If we do back support, might be worth calling PATH: Mine does on other actions. Hmm. Could you try adding specifying And thanks so much for the context around the errors. More generally, I really appreciate how great you are to work with and all you've done here, Kon! Chris |
Reading your changes quickly and smiling :) Thanks again for being so great, Kon. |
Mostly adding environment dict to the compile_action for easy reuse in the future
Regarding the bazel version, I personally think it's ok to require >= 6.1.0 since our projects doesn't depend on Bazel < 6.1.0. Feel free to let me know if it needs to support an older version later on :)
Thanks, I confirmed that adds PATH. I pushed a commit to use that PATH if available.
I have a separate Windows machine and do some tests on it through SSH from my Mac laptop. |
Sweet! Seems like you're ready to merge, then! (Even if you haven't said so explicitly). Let's get you on that contributor board! (If I've been too hasty, well, just holler here or put up another PR.) Thanks again for being great to work with, producing such quality code, and leaving things undeniably much better than you found them. It was a real pleasure working with you. Cheers! |
Hello, Kon, after seeing your update, it's quite impressive. Would you consider making it backwards compatible? In order to ensure smoother usability in the future, I am currently using Bazel 5.1, and have encountered some version-related issues as indicated here. --host_features=compiler_param_file need bazel >= 6.1.0 |
Thank you so much for your kind words! I'm grateful for the opportunity to work with someone as experienced and supportive as you. Best regards, |
Hello @doupongzeng, I appreciate your suggestion regarding backward compatibility. |
…ey're not supplied from aquery output In Bazel < 6.1.0, aquery doesn't provide environment variables. See hedronvision#154 for more context.
This change unwraps emcc.sh to its underlying clang invocation.
This is done by running emcc.sh with an environment variable
EM_COMPILER_WRAPPER
set to a fake wrapper script that just prints the command line arguments passed to it and exits.Diff of compile_commands.json before and after this change
Before this change:
After this change: