Skip to content

bpo-40280: Add debug Emscripten flavors (GH-32233) #32233

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

Merged
merged 1 commit into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 15 additions & 11 deletions configure

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 17 additions & 11 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1091,6 +1091,12 @@ AC_ARG_WITH([emscripten-target],
AS_CASE([$with_emscripten_target],
[browser], [ac_sys_emscripten_target=browser],
[node], [ac_sys_emscripten_target=node],
dnl Debug builds with source map / dwarf symbols. Py_DEBUG builds easily
dnl run out of stack space. Detached sybmols and map prohibit some
dnl optimizations and increase file size. Options are undocumented so we
dnl are free to remove them in the future.
[browser-debug], [ac_sys_emscripten_target=browser-debug],
[node-debug], [ac_sys_emscripten_target=node-debug],
[AC_MSG_ERROR([Invalid argument: --with-emscripten-target=browser|node])]
)
], [
Expand All @@ -1112,8 +1118,8 @@ AC_ARG_WITH([suffix],
)
], [
AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
[Emscripten/browser], [EXEEXT=.html],
[Emscripten/node], [EXEEXT=.js],
[Emscripten/browser*], [EXEEXT=.html],
[Emscripten/node*], [EXEEXT=.js],
[WASI/*], [EXEEXT=.wasm],
[EXEEXT=]
)
Expand Down Expand Up @@ -1376,7 +1382,7 @@ AC_MSG_RESULT($LDLIBRARY)

# LIBRARY_DEPS, LINK_PYTHON_OBJS and LINK_PYTHON_DEPS variable
AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
[Emscripten/browser], [LIBRARY_DEPS='$(PY3LIBRARY) $(WASM_STDLIB)'],
[Emscripten/browser*], [LIBRARY_DEPS='$(PY3LIBRARY) $(WASM_STDLIB)'],
[LIBRARY_DEPS='$(PY3LIBRARY) $(EXPORTSYMS)']
)
LINK_PYTHON_DEPS='$(LIBRARY_DEPS)'
Expand Down Expand Up @@ -1888,28 +1894,28 @@ fi
# The option disables code elimination, which increases code size of main
# binary. All objects must be built with -fPIC.
AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
[Emscripten/browser], [
[Emscripten/browser*], [
LDFLAGS_NODIST="$LDFLAGS_NODIST -s ALLOW_MEMORY_GROWTH=1"
LINKFORSHARED="--preload-file \$(WASM_ASSETS_DIR)"
WASM_ASSETS_DIR=".\$(prefix)"
WASM_STDLIB="\$(WASM_ASSETS_DIR)/local/lib/python\$(VERSION)/os.py"
dnl separate-dwarf does not seem to work in Chrome DevTools Support.
if test "$Py_DEBUG" = 'true'; then
if test "$Py_DEBUG" = 'true' -o "$ac_sys_emscripten_target" = "browser-debug"; then
LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1"
LINKFORSHARED="$LINKFORSHARED -gsource-map --emit-symbol-map"
else
LINKFORSHARED="$LINKFORSHARED -O2 -g0"
fi
],
[Emscripten/node], [
[Emscripten/node*], [
LDFLAGS_NODIST="$LDFLAGS_NODIST -s ALLOW_MEMORY_GROWTH=1 -s NODERAWFS=1 -s USE_PTHREADS=1"
LINKFORSHARED="-s PROXY_TO_PTHREAD=1 -s EXIT_RUNTIME=1"
CFLAGS_NODIST="$CFLAGS_NODIST -pthread"
if test "$Py_DEBUG" = 'true'; then
if test "$Py_DEBUG" = 'true' -o "$ac_sys_emscripten_target" = "node-debug"; then
LDFLAGS_NODIST="$LDFLAGS_NODIST -s ASSERTIONS=1"
LINKFORSHARED="$LINKFORSHARED -gseparate-dwarf --emit-symbol-map"
else
LINKFORSHARED="$LINKFORSHARED -O2 -gseparate-dwarf"
LINKFORSHARED="$LINKFORSHARED -O2 -g0"
fi
],
[WASI/*], [
Expand Down Expand Up @@ -6453,7 +6459,7 @@ if test "$enable_test_modules" = no; then
TEST_MODULES=no
else
AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
[Emscripten/browser], [TEST_MODULES=no],
[Emscripten/browser*], [TEST_MODULES=no],
[TEST_MODULES=yes]
)
fi
Expand All @@ -6478,7 +6484,7 @@ AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
[CYGWIN*/*], [PY_STDLIB_MOD_SET_NA([_scproxy], [nis])],
[QNX*/*], [PY_STDLIB_MOD_SET_NA([_scproxy], [nis])],
[FreeBSD*/*], [PY_STDLIB_MOD_SET_NA([_scproxy], [spwd])],
[Emscripten/browser], [
[Emscripten/browser*], [
PY_STDLIB_MOD_SET_NA(
[_ctypes],
[_curses],
Expand All @@ -6505,7 +6511,7 @@ AS_CASE([$ac_sys_system/$ac_sys_emscripten_target],
],
dnl Some modules like _posixsubprocess do not work. We build them anyway
dnl so imports in tests do not fail.
[Emscripten/node], [
[Emscripten/node*], [
PY_STDLIB_MOD_SET_NA(
[_ctypes],
[_curses],
Expand Down