Skip to content

Command to build _testexternalinspection.o gets truncated when building under WASI #116229

Closed

Description

@brettcannon

Bug description:

The output from make is:

z stack-size=524288 -Wl,--stack-first -Wl,--initial-memory=10485760   Modules/_testexternalinspection.o   -o Modules/_testexternalinspection.cpython-313d-wasm32-wasi.so
/bin/sh: 1: z: not found

It seems like the command is partially from CONFIGURE_LDFLAGS_NODIST= -z stack-size=524288 -Wl,--stack-first -Wl,--initial-memory=10485760.

And the Makefile line is:

Modules/_testexternalinspection$(EXT_SUFFIX):  Modules/_testexternalinspection.o; $(BLDSHARED)  Modules/_testexternalinspection.o $(MODULE__TESTEXTERNALINSPECTION_LDFLAGS) $(MODULE_LDFLAGS) -o Modules/_testexternalinspection$(EXT_SUFFIX)

But BLDSHARED is BLDSHARED= $(PY_CORE_LDFLAGS) in Makefile. That suggests there's some expansion failing.

CPython versions tested on:

CPython main branch

Operating systems tested on:

Other

Activity

  1. erlend-aasland commented on Mar 2, 2024

    @erlend-aasland
    Contributor
  2. mhsmith commented on Mar 2, 2024

    @mhsmith
    Member

    I'm not sure what's going on here, but I don't think it's caused by any of the things I've changed recently.

  3. erlend-aasland commented on Mar 2, 2024

    @erlend-aasland
    Contributor

    @brettcannon, how can I reproduce? I tried following the instructions in Tools/wasm/README.md but got no build failure.

  4. brettcannon commented on Mar 4, 2024

    @brettcannon
    MemberAuthor

    @brettcannon, how can I reproduce? I tried following the instructions in Tools/wasm/README.md but got no build failure.

    @erlend-aasland the overall build will succeed, but _testexternalinspection won't be kept due to not being imported. I only noticed this because I had another build failure related to that module that I have fixed.

  5. mhsmith commented on Mar 6, 2024

    @mhsmith
    Member

    If I understand correctly, WASI doesn't actually support building shared library modules at all, so it doesn't set BLDSHARED. But _testexternalinspection was added to a small list of test modules at the bottom of Setup.stdlib.in which "MUST be built as shared libraries". The reason this has never caused a problem for WASI before is that all the other modules in the list are skipped due to WASI not supporting dlopen.

  6. brettcannon commented on Mar 7, 2024

    @brettcannon
    MemberAuthor

    @mhsmith Correct, but all the other modules fail due to not being importable (I have #115983 to track turning off building them in the first place). For some reason with _testkexternalinspection I see this odd situation where the command run gets truncated down to z and causes the compilation to fail.

  7. brettcannon commented on Mar 8, 2024

    @brettcannon
    MemberAuthor

    The list of modules that @mhsmith referred to:

    # 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

    If we don't want to bother trying to figure out why the truncation is occurring I can just turn off trying to build this module under WASI (and all the other ones listed there).

  8. sobolevn commented on Mar 9, 2024

    @sobolevn
    Member

    I just tried the whole thing on my mac, I got expected result: BLDSHARED= $(CC) -bundle -undefined dynamic_lookup $(PY_CORE_LDFLAGS)

    No warning happened when running make.

  9. mhsmith commented on Mar 11, 2024

    @mhsmith
    Member

    @sobolevn: From that command line, it looks like you were building for macOS, not WASI.

  10. brettcannon commented on Mar 13, 2024

    @brettcannon
    MemberAuthor

    I turned off building _testexternalinspection under WASI in #116528 . I'm going to close this as indirectly fixed, but if someone wanted to continue to dig into why the command is getting truncated I can open it again.

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