Skip to content

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

Description

@brettcannon

_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

Activity

  1. brettcannon commented on Mar 5, 2024

    @brettcannon
    MemberAuthor

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

  2. erlend-aasland commented on Mar 5, 2024

    @erlend-aasland
    Contributor

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

    Related:

  3. brettcannon commented on Mar 8, 2024

    @brettcannon
    MemberAuthor

    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])
  4. brettcannon commented on Mar 8, 2024

    @brettcannon
    MemberAuthor

    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

  5. added 2 commits that reference this issue on Mar 9, 2024
  6. added a commit that references this issue on Mar 20, 2024
  7. added a commit that references this issue on Mar 25, 2024
  8. added a commit that references this issue on Apr 17, 2024
  9. added a commit that references this issue on Jun 10, 2024
  10. added a commit that references this issue on Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-wasibuildThe build process and cross-build

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions