Skip to content
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

Disable building test modules that require dlopen() under WASI SDK 21 #115983

Closed
brettcannon opened this issue Feb 27, 2024 · 4 comments
Closed
Labels
build The build process and cross-build OS-wasi

Comments

@brettcannon
Copy link
Member

brettcannon commented Feb 27, 2024

_testimportmultiple, _testmultiphase, _testsinglephase, xxlimited, xxlimited_35 all get built under WASI SDK 21 thanks to dlopen(), but since that function doesn't work normally under WASI we should skip building them.

cpython/configure.ac

Lines 7582 to 7593 in 6087315

PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
PY_STDLIB_MOD([xxsubtype], [test "$TEST_MODULES" = yes])
PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes])
PY_STDLIB_MOD([_ctypes_test],
[test "$TEST_MODULES" = yes], [test "$have_libffi" = yes -a "$ac_cv_func_dlopen" = yes],
[], [$LIBM])
dnl Limited API template modules.
dnl Emscripten does not support shared libraries yet.
PY_STDLIB_MOD([xxlimited], [], [test "$ac_cv_func_dlopen" = yes])
PY_STDLIB_MOD([xxlimited_35], [], [test "$ac_cv_func_dlopen" = yes])

We could either update Tools/wasm/wasi.py to disable test modules, update configure.ac so they don't get compiled under WASI, or see if we can get them compiled in statically.

Linked PRs

@brettcannon brettcannon added build The build process and cross-build OS-wasi labels Feb 27, 2024
@brettcannon
Copy link
Member Author

Might be easiest to set --disable-test-modules, otherwise for the other modules we need to statically compile the modules.

@erlend-aasland
Copy link
Contributor

Might be easiest to set --disable-test-modules, otherwise for the other modules we need to statically compile the modules.

Related:

@brettcannon
Copy link
Member Author

Maybe add a test for WASI?

diff --git a/configure.ac b/configure.ac
index e615259dcb..6a5b5839e8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -7626,9 +7626,9 @@ PY_STDLIB_MOD([_testclinic_limited], [test "$TEST_MODULES" = yes])
 PY_STDLIB_MOD([_testlimitedcapi], [test "$TEST_MODULES" = yes])
 PY_STDLIB_MOD([_testinternalcapi], [test "$TEST_MODULES" = yes])
 PY_STDLIB_MOD([_testbuffer], [test "$TEST_MODULES" = yes])
-PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
-PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
-PY_STDLIB_MOD([_testsinglephase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes])
+PY_STDLIB_MOD([_testimportmultiple], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes -a "$ac_sys_system" != "WASI"])
+PY_STDLIB_MOD([_testmultiphase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes  -a "$ac_sys_system" != "WASI"])
+PY_STDLIB_MOD([_testsinglephase], [test "$TEST_MODULES" = yes], [test "$ac_cv_func_dlopen" = yes  -a "$ac_sys_system" != "WASI"])
 PY_STDLIB_MOD([_testexternalinspection], [test "$TEST_MODULES" = yes])
 PY_STDLIB_MOD([xxsubtype], [test "$TEST_MODULES" = yes])
 PY_STDLIB_MOD([_xxtestfuzz], [test "$TEST_MODULES" = yes])
@@ -7638,8 +7638,8 @@ PY_STDLIB_MOD([_ctypes_test],
 
 dnl Limited API template modules.
 dnl Emscripten does not support shared libraries yet.
-PY_STDLIB_MOD([xxlimited], [], [test "$ac_cv_func_dlopen" = yes])
-PY_STDLIB_MOD([xxlimited_35], [], [test "$ac_cv_func_dlopen" = yes])
+PY_STDLIB_MOD([xxlimited], [], [test "$ac_cv_func_dlopen" = yes -a "$ac_sys_system" != "WASI"])
+PY_STDLIB_MOD([xxlimited_35], [], [test "$ac_cv_func_dlopen" = yes -a "$ac_sys_system" != "WASI"])
 
 # substitute multiline block, must come after last PY_STDLIB_MOD()
 AC_SUBST([MODULE_BLOCK])

@brettcannon
Copy link
Member Author

The modules we should probably skip building under WASI as they must be built as shared modules:

# Some testing modules MUST be built as shared libraries.
*shared*
@MODULE__TESTIMPORTMULTIPLE_TRUE@_testimportmultiple _testimportmultiple.c
@MODULE__TESTMULTIPHASE_TRUE@_testmultiphase _testmultiphase.c
@MODULE__TESTSINGLEPHASE_TRUE@_testsinglephase _testsinglephase.c
@MODULE__TESTEXTERNALINSPECTION_TRUE@_testexternalinspection _testexternalinspection.c
@MODULE__CTYPES_TEST_TRUE@_ctypes_test _ctypes/_ctypes_test.c
# Limited API template modules; must be built as shared modules.
@MODULE_XXLIMITED_TRUE@xxlimited xxlimited.c
@MODULE_XXLIMITED_35_TRUE@xxlimited_35 xxlimited_35.c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build The build process and cross-build OS-wasi
Projects
None yet
Development

No branches or pull requests

2 participants