Still can't build the Swift compiler on my MacBook

I couldn't get anywhere because the build kept failing. Now, over a year later and upgrading to Sonoma on my M1 MacBook Air, the build still fails at some point. If this is the right group (I've forgotten), I'll post the stdout from my last try, but after the first fail (so it still fails, but the output isn't as large).

From the suggestions at the right to the post input, I posted about my previous failures to the sub-group too.

This is an appropriate place to post, though as John notes in your previous thread it seems you were able to get the compiler building, you were just encountering some test failures.

1 Like

But so many changes have happened (on both sides) since then. It looks like it's currently a compiler issue:

daryle@Daryle-MacBookAir-3 swift % utils/build-script --skip-build-benchmarks \
  --skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
  --sccache --release-debuginfo --swift-disable-dead-stripping --xctest
[utils/build-script] NOTE: Using toolchain default
+ /usr/libexec/PlistBuddy -c 'Print :SupportedTargets:macosx:Archs' /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/SDKSettings.plist
Ensuring the sccache server is running...
+ /opt/homebrew/bin/sccache --show-stats
+ mkdir -p /Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert
--- Building earlyswiftdriver ---
+ /Users/daryle/projects/swift-project/swift-driver/Utilities/build-script-helper.py build --package-path /Users/daryle/projects/swift-project/swift-driver --build-path /Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/earlyswiftdriver-macosx-arm64 --configuration release --toolchain /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr --ninja-bin /opt/homebrew/bin/ninja --cmake-bin /opt/homebrew/bin/cmake --local_compiler_build
Building Swift Driver dependency: llbuild
CMake Warning (dev) at CMakeLists.txt:97 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

Building Swift Driver dependency: Swift System
Building Swift Driver dependency: TSC
Building Swift Driver dependency: Argument Parser
Building Swift Driver dependency: Yams
Building Swift Driver for target: arm64-apple-macosx10.15
--- Building cmark ---
+ mkdir -p /Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/cmark-macosx-arm64
+ env /opt/homebrew/bin/cmake --build /Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/cmark-macosx-arm64 --config RelWithDebInfo -- -j8 all
[0/1][  0%][0.003s] Re-running CMake...
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


CMake Warning (dev) at test/CMakeLists.txt:9 (find_package):
  Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
  are removed.  Run "cmake --help-policy CMP0148" for policy details.  Use
  the cmake_policy command to set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done (0.0s)
-- Generating done (0.0s)
-- Build files have been written to: /Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/cmark-macosx-arm64
[1/47][  2%][0.614s] Building C object src/CMakeFiles/libcmark.dir/cmark.c.o
/Users/daryle/projects/swift-project/cmark/src/cmark.c:9:18: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
int cmark_version() { return CMARK_VERSION; }
                 ^
                  void
/Users/daryle/projects/swift-project/cmark/src/cmark.c:11:33: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
const char *cmark_version_string() { return CMARK_VERSION_STRING; }
                                ^
                                 void
2 warnings generated.
[3/47][  6%][0.633s] Building C object src/CMakeFiles/cmark.dir/main.c.o
/Users/daryle/projects/swift-project/cmark/src/main.c:31:17: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
void print_usage() {
                ^
                 void
1 warning generated.
[18/47][ 38%][1.022s] Building C objec...akeFiles/libcmark_static.dir/cmark.c.o
/Users/daryle/projects/swift-project/cmark/src/cmark.c:9:18: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
int cmark_version() { return CMARK_VERSION; }
                 ^
                  void
/Users/daryle/projects/swift-project/cmark/src/cmark.c:11:33: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
const char *cmark_version_string() { return CMARK_VERSION_STRING; }
                                ^
                                 void
2 warnings generated.
[37/47][ 78%][1.571s] Building C objec...st/CMakeFiles/api_test.dir/harness.c.o
In file included from /Users/daryle/projects/swift-project/cmark/api_test/harness.c:6:
/Users/daryle/projects/swift-project/cmark/api_test/harness.h:15:41: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
test_batch_runner *test_batch_runner_new();
                                        ^
                                         void
/Users/daryle/projects/swift-project/cmark/api_test/harness.c:8:41: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
test_batch_runner *test_batch_runner_new() {
                                        ^
                                         void
2 warnings generated.
[40/47][ 85%][1.631s] Building C objec..._test/CMakeFiles/api_test.dir/main.c.o
In file included from /Users/daryle/projects/swift-project/cmark/api_test/main.c:9:
/Users/daryle/projects/swift-project/cmark/api_test/harness.h:15:41: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
test_batch_runner *test_batch_runner_new();
                                        ^
                                         void
/Users/daryle/projects/swift-project/cmark/api_test/main.c:1039:9: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
int main() {
        ^
         void
2 warnings generated.
[47/47][100%][1.866s] Linking C executable src/cmark
--- Building llvm ---
+ env /opt/homebrew/bin/cmake --build /Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-arm64 --config RelWithDebInfo -- -j8 all
[0/3][  0%][0.488s] Performing build step for 'compiler-rt'
[6/2269][  0%][0.167s] Building CXX ob.../sanitizer_platform_limits_posix.cpp.o
FAILED: lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_platform_limits_posix.cpp.o 
/Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-arm64/./bin/clang++ -DHAVE_RPC_XDR_H=1 -I/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/.. -Wall -std=c++14 -Wno-unused-parameter -O2 -g -DNDEBUG -arch arm64 -arch x86_64 -arch x86_64h -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk  -stdlib=libc++ -mmacosx-version-min=10.10 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -fPIC -fno-builtin -fno-exceptions -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -fno-lto -Werror=thread-safety -Werror=thread-safety-reference -Werror=thread-safety-beta -O3 -g -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -nostdinc++ -fno-rtti -Wframe-larger-than=570 -Wglobal-constructors -MD -MT lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_platform_limits_posix.cpp.o -MF lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_platform_limits_posix.cpp.o.d -o lib/sanitizer_common/CMakeFiles/RTSanitizerCommon.osx.dir/sanitizer_platform_limits_posix.cpp.o -c /Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1234:1: error: unknown type name '__sanitizer_XDR'; did you mean '__sanitizer_tm'?
CHECK_TYPE_SIZE(XDR);
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1425:25: note: expanded from macro 'CHECK_TYPE_SIZE'
  COMPILER_CHECK(sizeof(__sanitizer_##TYPE) == sizeof(TYPE))
                        ^
<scratch space>:20:1: note: expanded from here
__sanitizer_XDR
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:399:8: note: '__sanitizer_tm' declared here
struct __sanitizer_tm {
       ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1234:17: error: use of undeclared identifier 'XDR'
CHECK_TYPE_SIZE(XDR);
                ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1235:1: error: use of undeclared identifier '__sanitizer_XDR'; did you mean '__sanitizer'?
CHECK_SIZE_AND_OFFSET(XDR, x_op);
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1428:27: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
                          ^
<scratch space>:21:1: note: expanded from here
__sanitizer_XDR
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:176:11: note: '__sanitizer' declared here
namespace __sanitizer {
          ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1235:1: error: unexpected namespace name '__sanitizer': expected expression
CHECK_SIZE_AND_OFFSET(XDR, x_op);
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1428:27: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
                          ^
<scratch space>:21:1: note: expanded from here
__sanitizer_XDR
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1235:1: error: expected expression
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1428:48: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
                                               ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1235:23: error: use of undeclared identifier 'XDR'
CHECK_SIZE_AND_OFFSET(XDR, x_op);
                      ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1235:1: error: expected expression
CHECK_SIZE_AND_OFFSET(XDR, x_op);
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1429:34: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
                 sizeof(((CLASS *)NULL)->MEMBER));                \
                                 ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1235:1: error: unknown type name '__sanitizer_XDR'; did you mean '__sanitizer_tm'?
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1430:27: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) ==         \
                          ^
<scratch space>:22:1: note: expanded from here
__sanitizer_XDR
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:399:8: note: '__sanitizer_tm' declared here
struct __sanitizer_tm {
       ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1235:1: error: no member named 'x_op' in '__sanitizer_tm'
CHECK_SIZE_AND_OFFSET(XDR, x_op);
^                          ~~~~
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1430:18: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) ==         \
                 ^                             ~~~~~~
/Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-arm64/lib/clang/15.0.0/include/stddef.h:104:24: note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^                     ~
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:332:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^~~~
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1235:23: error: unknown type name 'XDR'
CHECK_SIZE_AND_OFFSET(XDR, x_op);
                      ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1236:1: error: use of undeclared identifier '__sanitizer_XDR'; did you mean '__sanitizer'?
CHECK_SIZE_AND_OFFSET(XDR, x_ops);
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1428:27: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
                          ^
<scratch space>:23:1: note: expanded from here
__sanitizer_XDR
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:176:11: note: '__sanitizer' declared here
namespace __sanitizer {
          ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1236:1: error: unexpected namespace name '__sanitizer': expected expression
CHECK_SIZE_AND_OFFSET(XDR, x_ops);
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1428:27: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
                          ^
<scratch space>:23:1: note: expanded from here
__sanitizer_XDR
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1236:1: error: expected expression
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1428:48: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
                                               ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1236:23: error: use of undeclared identifier 'XDR'
CHECK_SIZE_AND_OFFSET(XDR, x_ops);
                      ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1236:1: error: expected expression
CHECK_SIZE_AND_OFFSET(XDR, x_ops);
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1429:34: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
                 sizeof(((CLASS *)NULL)->MEMBER));                \
                                 ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1236:1: error: unknown type name '__sanitizer_XDR'; did you mean '__sanitizer_tm'?
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1430:27: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) ==         \
                          ^
<scratch space>:24:1: note: expanded from here
__sanitizer_XDR
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:399:8: note: '__sanitizer_tm' declared here
struct __sanitizer_tm {
       ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1236:1: error: no member named 'x_ops' in '__sanitizer_tm'
CHECK_SIZE_AND_OFFSET(XDR, x_ops);
^                          ~~~~~
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1430:18: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(offsetof(__sanitizer_##CLASS, MEMBER) ==         \
                 ^                             ~~~~~~
/Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-arm64/lib/clang/15.0.0/include/stddef.h:104:24: note: expanded from macro 'offsetof'
#define offsetof(t, d) __builtin_offsetof(t, d)
                       ^                     ~
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_internal_defs.h:332:44: note: expanded from macro 'COMPILER_CHECK'
#define COMPILER_CHECK(pred) static_assert(pred, "")
                                           ^~~~
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1236:23: error: unknown type name 'XDR'
CHECK_SIZE_AND_OFFSET(XDR, x_ops);
                      ^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:1237:1: error: use of undeclared identifier '__sanitizer_XDR'; did you mean '__sanitizer'?
CHECK_SIZE_AND_OFFSET(XDR, x_public);
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h:1428:27: note: expanded from macro 'CHECK_SIZE_AND_OFFSET'
  COMPILER_CHECK(sizeof(((__sanitizer_##CLASS *)NULL)->MEMBER) == \
                          ^
<scratch space>:25:1: note: expanded from here
__sanitizer_XDR
^
/Users/daryle/projects/swift-project/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp:176:11: note: '__sanitizer' declared here
namespace __sanitizer {
          ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
[15/2269][  0%][0.879s] Building CXX o...tion.osx.dir/sanitizer_allocator.cpp.o
ninja: build stopped: subcommand failed.
FAILED: tools/clang/runtime/compiler-rt-stamps/compiler-rt-build /Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-arm64/tools/clang/runtime/compiler-rt-stamps/compiler-rt-build 
cd /Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/llvm-macosx-arm64/tools/clang/runtime/compiler-rt-bins && /opt/homebrew/Cellar/cmake/3.27.7/bin/cmake --build .
ninja: build stopped: subcommand failed.
ERROR: command terminated with a non-zero exit status 1, aborting

daryle@Daryle-MacBookAir-3 swift %                                             

Is this with a fresh clone of all the repos? If not, have you run utils/update-checkout (and/or re-cloned everything) to make sure things are all up-to-date from a year ago?

I kept all the old files and ran utils/update-checkout on top of them. Should I just trash it all then re-start/download?

I'm using just-installed Sonoma and Xcode 15. Am I supposed to use an older compiler?

As far as I know that shouldn’t be necessary if update-checkout succeeded for all repos, but it can’t hurt to start from a clean slate. I’ve successfully built on Sonoma with Xcode 15 from top-of-tree just today.

Took over 2 years to notice that the optional "--xctest " build argument is Linux-only. Compiled just fine with the default Sonoma/Xcode-15 setup. Still have to try proper tests and the Xcode project version.

Now running the tests, they ended with:

: 'RUN: at line 4';   env SWIFT_BINARY_COMPATIBILITY_VERSION=0x050700 /usr/bin/env DYLD_LIBRARY_PATH='/Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/lib/swift/macosx'  /Users/daryle/projects/swift-project/build/Ninja-RelWithDebInfoAssert/swift-macosx-arm64/test-macosx-arm64/stdlib/Output/StringIndex.swift.tmp/StringIndex /Users/daryle/projects/swift-project/swift/test/stdlib/Inputs/
--
Exit Code: 1

Command Output (stderr):
--
/Users/daryle/projects/swift-project/swift/test/stdlib/StringIndex.swift:16:8: error: no such module 'StdlibUnicodeUnittest'
import StdlibUnicodeUnittest
       ^

--

********************
********************
Failed Tests (6):
  Swift(macosx-arm64) :: ClangImporter/Dispatch_test.swift
  Swift(macosx-arm64) :: Concurrency/dispatch_inference.swift
  Swift(macosx-arm64) :: Python/python_lint.swift
  Swift(macosx-arm64) :: Reflection/capture_descriptors.sil
  Swift(macosx-arm64) :: stdlib/CharacterRecognizer.swift
  Swift(macosx-arm64) :: stdlib/StringIndex.swift


Testing Time: 946.85s
  Unsupported      :  548
  Passed           : 9576
  Expectedly Failed:   35
  Failed           :    6

3 warning(s) in tests
ERROR: command terminated with a non-zero exit status 1, aborting

daryle@Daryle-MacBookAir-3 swift % 

I would recommend you to update to the latest main branch of the swift compiler, run the update-checkout, and then run build-script. These instructions can be found on GettingStarted.md

cd swift
git checkout main
git pull origin main
utils/update-checkout --clone ...
utils/build-script ...

Let us know where you fail and we would be able to help you

1 Like

Surprisingly, I built the compiler in release mode and it failed 1 test: python_lint.swift

swift/utils/build-script -R -t

FAIL: Swift(macosx-arm64) :: Python/python_lint.swift (5029 of 9669)
******************** TEST 'Swift(macosx-arm64) :: Python/python_lint.swift' FAILED ********************
Script:
--
: 'RUN: at line 8';   /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Volumes/compiler/apple/swift/utils/python_lint.py
--
Exit Code: 1

Command Output (stdout):
--
./utils/cmpcodesize/cmpcodesize/main.py:20:71: E231 missing whitespace after ','
./utils/round-trip-syntax-test:20:20: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`
./utils/round-trip-syntax-test:21:16: E721 do not compare types, for exact checks use `is` / `is not`, for instance checks use `isinstance()`

--

********************
********************
Failed Tests (1):
  Swift(macosx-arm64) :: Python/python_lint.swift


Testing Time: 582.95s
  Unsupported      :  531
  Passed           : 9569
  Expectedly Failed:   35
  Failed           :    1
2 warning(s) in tests
FAILED: test/CMakeFiles/check-swift-macosx-arm64 /Volumes/compiler/apple/build/Ninja-ReleaseAssert/swift-macosx-arm64/test/CMakeFiles/check-swift-macosx-arm64 
cd /Volumes/compiler/apple/build/Ninja-ReleaseAssert/swift-macosx-arm64/test && /Applications/CMake.app/Contents/bin/cmake -E remove_directory /Volumes/compiler/apple/build/Ninja-ReleaseAssert/swift-macosx-arm64/./swift-test-results/arm64-apple-macosx10.13 && /Applications/CMake.app/Contents/bin/cmake -E make_directory /Volumes/compiler/apple/build/Ninja-ReleaseAssert/swift-macosx-arm64/./swift-test-results/arm64-apple-macosx10.13 && /Applications/CMake.app/Contents/bin/cmake -E env /Applications/Xcode.app/Contents/Developer/usr/bin/python3 /Volumes/compiler/apple/llvm-project/llvm/utils/lit/lit.py -sv -j 10 --xunit-xml-output=/Volumes/compiler/apple/build/Ninja-ReleaseAssert/swift-macosx-arm64/./swift-test-results/arm64-apple-macosx10.13/lit-tests.xml --param differentiable_programming --param concurrency --param distributed --param string_processing --param backtracing --param observation --param threading=darwin --param backtrace_on_crash --param swift_test_subset=primary --param swift_test_mode=optimize_none /Volumes/compiler/apple/build/Ninja-ReleaseAssert/swift-macosx-arm64/test-macosx-arm64
ninja: build stopped: subcommand failed.
ERROR: command terminated with a non-zero exit status 1, aborting

I ran the test suite with lit.py and it failed 3 tests

./swift/llvm-project/llvm/utils/lit/lit.py -sv build/Ninja-ReleaseAssert/swift-macosx-arm64/test-macosx-arm64/ --show-xfail

Failed Tests (3):
  Swift(macosx-arm64) :: Parse/structure_no_overflow.swift
  Swift(macosx-arm64) :: Parse/structure_overflow.swift
  Swift(macosx-arm64) :: Python/python_lint.swift


Testing Time: 484.69s
  Unsupported      :  547
  Passed           : 9551
  Expectedly Failed:   35
  Failed           :    3

Tests on main don't always pass in all configurations, as the main branch reflects current work in progress, and PR testing runs on PR branches but not on the main branch itself.

Even when with a given PR 100% of all tests pass, by the time it's merged a different combination of merges may lead to a test regression, and by that time the combination of commits from all projects participating in a build and test run (compiler, LLVM, core libraries, the driver, the syntax library etc) has changed. Besides, to merge a PR on main you only need smoke tests to pass, not the whole test suite. Integration tests usually run only for full toolchain builds.

If you want a higher chance of all of the tests passing, I recommend trying the release/* branches, which move more slowly, especially the already released 5.8 branch. There's still ongoing work on 5.9 patch releases though.

Overall, if you're looking to contribute there's no need to make 100% of all the tests pass locally on your machine. Just make sure that tests don't regress after making your changes, and you'll most likely get much better test coverage on CI when you submit a PR.

1 Like