-
Notifications
You must be signed in to change notification settings - Fork 733
[Bazel] Support for feature debug fission in emsdk-bazel-toolchain #1479 #1531
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
base: main
Are you sure you want to change the base?
Changes from all commits
f83d486
dc0e66a
19a4fe4
b7e6bcf
0f5f44c
9d5143e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,12 +43,25 @@ filegroup( | |
], | ||
) | ||
|
||
filegroup( | ||
name = "dwp_files", | ||
srcs = [ | ||
"emdwp-emscripten_bin_linux_arm64.sh", | ||
"emdwp-emscripten_bin_linux.sh", | ||
"emdwp-emscripten_bin_mac_arm64.sh", | ||
"emdwp-emscripten_bin_mac.sh", | ||
"emdwp-emscripten_bin_win.bat", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why does this tool require 5 files where the above tools all just use two (one .sh and one .bat)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know why the I've seen how to do it for emcc and emcc_link in I also ask about this on bazel-slack (Fri, Feb 14th), no answer yet: https://bazelbuild.slack.com/archives/CGA9QFQ8H/p1739488236571719 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the reason why environment variables are unavailable is in bazel itself.
As you can see, the For comparison, I found the
So as you can see, on the master version (>8.1.0), these variables will still not be there. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It we do end up landed this alternative method of have 5 different scripts, I think we should at least document why its needed, and perhaps link to a bazel bug, so we can potentially revert to the more common pattern in the future. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I can report this to bazel and add a link to the report here. In a comment in each of the five scripts? Or somewhere in a collective place? Maybe link the comment to this PR there? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, a comment in each of the 5 scripts sounds good. Something like "This scripts is needed because we cannot use the emscripten emdwp.py entry point because of a limiation/bug with bazel: " There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Okay, I'll prepare something for tomorrow. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you think about it, it's probably possible to do it like this:
#!/bin/bash
#
# This script…
#
export EMCC_WASM_BACKEND=__EMCC_WASM_BACKEND__
export EM_BIN_PATH=__EM_BIN_PATH__
export EM_CONFIG_PATH=__EM_CONFIG_PATH__
export NODE_JS_PATH=__NODE_JS_PATH__
source $(dirname $0)/env.sh
exec python3 $EMSCRIPTEN/tools/emdwp.py "$@"
I think this should work. Unfortunately it's a bit beyond the time I wanted to spend on it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I reported it to bazel: bazelbuild/bazel#25336 I also updated all scripts to add this comment:
|
||
"@emsdk//:dwp_files", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "all_files", | ||
srcs = [ | ||
":ar_files", | ||
":compiler_files", | ||
":linker_files", | ||
":dwp_files", | ||
], | ||
) | ||
|
||
|
@@ -75,7 +88,7 @@ cc_toolchain( | |
ar_files = ":ar_files", | ||
as_files = ":empty", | ||
compiler_files = ":compiler_files", | ||
dwp_files = ":empty", | ||
dwp_files = ":dwp_files", | ||
linker_files = ":linker_files", | ||
objcopy_files = ":empty", | ||
strip_files = ":empty", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
# | ||
# This script differs in form from emcc.{py,bat}/…, because bazel are limited/bugged in the way of executing dwp tool. | ||
# Bazel dwp action configuration does not pass environment variables, so we cannot use them in this script. | ||
# For more info, see PR discussion and bazel issue: | ||
# - https://github.com/emscripten-core/emsdk/pull/1531#discussion_r1962090650 | ||
# - https://github.com/bazelbuild/bazel/issues/25336 | ||
# | ||
|
||
exec external/emscripten_bin_linux/bin/llvm-dwp "$@" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The emdwp.py wrapper should be able to find these files based on LLVM_ROOT, so I don't think you need 5 different wrappers here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, but it doesn't work / or I don't know how to do it, #1531 (comment) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
# | ||
# This script differs in form from emcc.{py,bat}/…, because bazel are limited/bugged in the way of executing dwp tool. | ||
# Bazel dwp action configuration does not pass environment variables, so we cannot use them in this script. | ||
# For more info, see PR discussion and bazel issue: | ||
# - https://github.com/emscripten-core/emsdk/pull/1531#discussion_r1962090650 | ||
# - https://github.com/bazelbuild/bazel/issues/25336 | ||
# | ||
|
||
exec external/emscripten_bin_linux_arm64/bin/llvm-dwp "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
# | ||
# This script differs in form from emcc.{py,bat}/…, because bazel are limited/bugged in the way of executing dwp tool. | ||
# Bazel dwp action configuration does not pass environment variables, so we cannot use them in this script. | ||
# For more info, see PR discussion and bazel issue: | ||
# - https://github.com/emscripten-core/emsdk/pull/1531#discussion_r1962090650 | ||
# - https://github.com/bazelbuild/bazel/issues/25336 | ||
# | ||
|
||
exec external/emscripten_bin_mac/bin/llvm-dwp "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
# | ||
# This script differs in form from emcc.{py,bat}/…, because bazel are limited/bugged in the way of executing dwp tool. | ||
# Bazel dwp action configuration does not pass environment variables, so we cannot use them in this script. | ||
# For more info, see PR discussion and bazel issue: | ||
# - https://github.com/emscripten-core/emsdk/pull/1531#discussion_r1962090650 | ||
# - https://github.com/bazelbuild/bazel/issues/25336 | ||
# | ||
|
||
exec external/emscripten_bin_mac_arm64/bin/llvm-dwp "$@" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
:: | ||
:: This script differs in form from emcc.{py,bat}/…, because bazel are limited/bugged in the way of executing dwp tool. | ||
:: Bazel dwp action configuration does not pass environment variables, so we cannot use them in this script. | ||
:: For more info, see PR discussion and bazel issue: | ||
:: - https://github.com/emscripten-core/emsdk/pull/1531#discussion_r1962090650 | ||
:: - https://github.com/bazelbuild/bazel/issues/25336 | ||
:: | ||
@ECHO OFF | ||
|
||
call external\emscripten_bin_win\bin\llvm-dwp %* |
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.
Doesn't this need emdwp.py like the above uses emar.py?
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.
this is also related to the problem of passing environment variables to the dwp tool:
emdwp.py
script base on some envs to ensure where are llvm bins are.#1531 (comment)