Build Failure (Ninja)

I am running into this error when I try to build the compiler for ninja:

FAILED: test/CMakeFiles/check-swift-macosx-arm64

Earlier, I also see this, but unsure if it's related:

<unknown>:0: error: cannot find Swift module with name MyModule

FileCheck error: '<stdin>' is empty.

Here is a full gist.

I'm running this on an M1 and the Xcode build is working w/o issue. Any ideas? I have not seen this before.

Since you are running on a M1 Mac I think the reason for why it is failing is because test is hard coded to target x86_64 for example // RUN: %target-swift-api-extract -target x86_64-apple-macos11.0 -o - -pretty-print %t/MyModule.swiftinterface -module-name MyModule -module-cache-path %t | %FileCheck %s. So test will try to find an link against a x86_64 stdlib and fail.
We could test locally a couple of options:

  1. Since this seems not to be a target specific test, replacing all -target x86_64-apple-macos11.0 with -target %target-cpu-apple-macos11.0.
  2. Only run this test on x86_64 by adding a // REQUIRES: CPU=x86_64

I believe any of the options should "solve" it =]

1 Like
  • Since this seems not to be a target specific test, replacing all -target x86_64-apple-macos11.0 with -target %target-cpu-apple-macos11.0 .
  • Only run this test on x86_64 by adding a // REQUIRES: CPU=x86_64

How should I do either of these? Do I add these when I re-run the build script with reconfigure and clean flags?

From the logs the test failing is Failed Tests (1): Swift(macosx-arm64) :: APIJSON/access.swift, so you just have to change the file and run the config script again. It does not need to be a clean build, in fact maybe we don't even need to re-build anything, just re-run the tests, but the simpler way is just to re-run the script :)
For an example, see [tests] Make some tests that are x86_64 hardcode that are failing on arm64 run with %target-cpu by LucianoPAlmeida · Pull Request #39676 · apple/swift · GitHub

1 Like