Build error for SwiftSyntax iOS

I've build SwiftSyntax many times for iOS (simulator and device) and I've never gotten this error. Any ideas?

Admins-MacBook-Pro:swift-source jhinkle$ ./swift/utils/build-parser-lib --release --no-assertions --build-dir /tmp/parser-lib-build-iossim --host iphonesimulator --architectures x86_64
+ mkdir -p /tmp/parser-lib-build-iossim/x86_64-tblgen
+ pushd /tmp/parser-lib-build-iossim/x86_64-tblgen
-- clang project is enabled
-- clang-tools-extra project is disabled
-- compiler-rt project is disabled
-- debuginfo-tests project is disabled
-- libc project is disabled
-- libclc project is disabled
-- libcxx project is disabled
-- libcxxabi project is disabled
-- libunwind project is disabled
-- lld project is disabled
-- lldb project is disabled
-- mlir project is disabled
-- openmp project is disabled
-- parallel-libs project is disabled
-- polly project is disabled
-- pstl project is disabled
-- flang project is disabled
-- swift project is enabled
-- Found libtool - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool
-- Native target architecture is X86
-- Threads enabled.
-- Doxygen disabled.
-- Go bindings enabled.
-- Ninja version: 1.10.1
-- Found ld64 - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- Could NOT find OCaml (missing: OCAMLFIND OCAML_VERSION OCAML_STDLIB_PATH) 
-- OCaml bindings disabled.
-- LLVM host triple: x86_64-apple-macosx10.12
-- LLVM default target triple: x86_64-apple-macosx10.12
-- Building with -fPIC
-- Constructing LLVMBuild project information
-- Targeting X86
CMake Error at cmake/modules/AddLLVM.cmake:1328 (add_subdirectory):
  The source directory

    /Users/jhinkle/swift-source/clang

  does not contain a CMakeLists.txt file.
Call Stack (most recent call first):
  cmake/modules/AddLLVM.cmake:1342 (add_llvm_subdirectory)
  tools/CMakeLists.txt:36 (add_llvm_external_project)


CMake Deprecation Warning at /Users/jhinkle/swift-source/swift/CMakeLists.txt:7 (cmake_policy):
  The OLD behavior for policy CMP0068 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- CMake (/usr/local/Cellar/cmake/3.18.3/bin/cmake) Version: 3.18.3
-- CMake Make Program (/usr/local/bin/ninja) Version: 1.10.1
-- C Compiler (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc) Version: 12.0.0.12000032
-- C++ Compiler (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++) Version: 12.0.0.12000032
-- 
-- Xcode 12.0, Build version 12A7209
-- 
-- OS X SDK at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk does not support architecture arm64
-- OS X SDK at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk does not support architecture arm64e
-- OS X SDK:
--   Object File Format: MACHO
--   Swift Standard Library Path: macosx
--   Version: 10.15.6
--   Build number: 19G68
--   Deployment version: 10.12
--   Version min name: macosx
--   Triple name: macosx
--   Simulator: FALSE
--   Architectures: x86_64
--   x86_64 triple: x86_64-apple-macosx
--   Module triple: x86_64-apple-macos
--   x86_64 Path: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
-- 
-- Building host Swift tools for OSX x86_64
--   Build type:     Release
--   Assertions:     OFF
--   LTO:            OFF
-- 
-- Not building Swift standard library, SDK overlays, and runtime
-- 
CMake Error at /Users/jhinkle/swift-source/swift/stdlib/public/SwiftShims/CMakeLists.txt:172 (message):
  Unable to determine clang resource headers target in unified build


CMake Error at /Users/jhinkle/swift-source/swift/stdlib/public/SwiftShims/CMakeLists.txt:181 (add_dependencies):
  add_dependencies called with incorrect number of arguments


CMake Error at /Users/jhinkle/swift-source/swift/stdlib/public/SwiftShims/CMakeLists.txt:181 (add_dependencies):
  add_dependencies called with incorrect number of arguments


CMake Error at /Users/jhinkle/swift-source/swift/stdlib/public/SwiftShims/CMakeLists.txt:181 (add_dependencies):
  add_dependencies called with incorrect number of arguments


CMake Error at /Users/jhinkle/swift-source/swift/stdlib/public/SwiftShims/CMakeLists.txt:181 (add_dependencies):
  add_dependencies called with incorrect number of arguments


-- Swift version: 5.3
-- Swift vendor: 
-- Swift compiler version: 
-- Embedded clang compiler version: 
-- Registering Bye as a pass plugin (static build: OFF)
Traceback (most recent call last):
  File "<string>", line 22, in <module>
IndexError: list index out of range
-- Failed to find LLVM FileCheck
-- Version: 0.0.0
-- Performing Test HAVE_THREAD_SAFETY_ATTRIBUTES -- failed to compile
-- Performing Test HAVE_GNU_POSIX_REGEX -- failed to compile
-- Performing Test HAVE_POSIX_REGEX -- success
-- Performing Test HAVE_STEADY_CLOCK -- success
-- Configuring incomplete, errors occurred!
See also "/tmp/parser-lib-build-iossim/x86_64-tblgen/CMakeFiles/CMakeOutput.log".
See also "/tmp/parser-lib-build-iossim/x86_64-tblgen/CMakeFiles/CMakeError.log".
ERROR: command terminated with a non-zero exit status 1, aborting

I'm going to play with it tonight some more.

Thanks for reporting this. I'll take a look into this soon(ish).

Cool. Another weird thing about it is that I managed to get a successful build a week ago for the Swift 5.3 tag. But because the artifacts were in /tmp they disappeared after I restarted my computer. So when I went to rebuild, I first resynced everything under swift-sources to the same tag and I got the same error above.

The error above was when I built after trying to sync it with master.

And some more info...

After running swift/utils/build-script --swiftsyntax --swiftpm --llbuild I got:

[1677/1677][100%][5295.929s] Running utility command for swift-benchmark-macosx-x86_64
+ mkdir -p /Users/jhinkle/swift-source/build/Ninja-DebugAssert/llbuild-macosx-x86_64
+ mkdir -p /Users/jhinkle/swift-source/build/Ninja-DebugAssert/llbuild-macosx-x86_64/.cmake/api/v1/query
+ touch /Users/jhinkle/swift-source/build/Ninja-DebugAssert/llbuild-macosx-x86_64/.cmake/api/v1/query/codemodel-v2 /Users/jhinkle/swift-source/build/Ninja-DebugAssert/llbuild-macosx-x86_64/.cmake/api/v1/query/cache-v2
+ pushd /Users/jhinkle/swift-source/build/Ninja-DebugAssert/llbuild-macosx-x86_64
~/swift-source/build/Ninja-DebugAssert/llbuild-macosx-x86_64 ~/swift-source
+ env /usr/local/bin/cmake -G Ninja -DCMAKE_C_COMPILER:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -DCMAKE_CXX_COMPILER:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -DCMAKE_LIBTOOL:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -DLLVM_VERSION_MAJOR:STRING=10 -DLLVM_VERSION_MINOR:STRING=0 -DLLVM_VERSION_PATCH:STRING=0 -DCLANG_VERSION_MAJOR:STRING=10 -DCLANG_VERSION_MINOR:STRING=0 -DCLANG_VERSION_PATCH:STRING=0 -DCMAKE_MAKE_PROGRAM=/usr/local/bin/ninja -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:PATH=/Users/jhinkle/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64/bin/clang -DCMAKE_CXX_COMPILER:PATH=/Users/jhinkle/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64/bin/clang++ -DCMAKE_INSTALL_PREFIX:PATH=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/ -DCMAKE_Swift_COMPILER:PATH=/Users/jhinkle/swift-source/build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swiftc -DLLBUILD_ENABLE_ASSERTIONS:BOOL=TRUE -DLLBUILD_SUPPORT_BINDINGS:=Swift -DLIT_EXECUTABLE:PATH=/Users/jhinkle/swift-source/llvm-project/llvm/utils/lit/lit.py -DFILECHECK_EXECUTABLE:PATH=/Users/jhinkle/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64/bin/FileCheck -DSWIFTC_EXECUTABLE:PATH=/Users/jhinkle/swift-source/build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swiftc -DFOUNDATION_BUILD_DIR:PATH=/Users/jhinkle/swift-source/build/Ninja-DebugAssert/foundation-macosx-x86_64 -DLIBDISPATCH_BUILD_DIR:PATH=/Users/jhinkle/swift-source/build/Ninja-DebugAssert/libdispatch-macosx-x86_64 -DLIBDISPATCH_SOURCE_DIR:PATH=/Users/jhinkle/swift-source/swift-corelibs-libdispatch -Ddispatch_DIR:PATH=/Users/jhinkle/swift-source/build/Ninja-DebugAssert/libdispatch-macosx-x86_64/cmake/modules -DFoundation_DIR:PATH=/Users/jhinkle/swift-source/build/Ninja-DebugAssert/foundation-macosx-x86_64/cmake/modules -DSQLite3_INCLUDE_DIR:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include '-DCMAKE_IGNORE_PATH=/usr/lib;/usr/local/lib;/lib' -DPKG_CONFIG_EXECUTABLE=/usr/bin/false /Users/jhinkle/swift-source/llbuild
-- The CXX compiler identification is Clang 10.0.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Users/jhinkle/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64/bin/clang++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found SQLite3: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include (found version "3.28.0") 
-- Found Lit: /Users/jhinkle/swift-source/llvm-project/llvm/utils/lit/lit.py  
-- Found FileCheck: /Users/jhinkle/swift-source/build/Ninja-DebugAssert/llvm-macosx-x86_64/bin/FileCheck  
-- Found PythonInterp: /usr/bin/python (found version "2.7.16") 
-- Performing Test CXX_SUPPORTS_UNREACHABLE_CODE_FLAG
-- Performing Test CXX_SUPPORTS_UNREACHABLE_CODE_FLAG - Success
-- The Swift compiler identification is Apple 5.3
-- Check for working Swift compiler: /Users/jhinkle/swift-source/build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swiftc
-- Check for working Swift compiler: /Users/jhinkle/swift-source/build/Ninja-DebugAssert/swift-macosx-x86_64/bin/swiftc - works
CMake Deprecation Warning at tests/CMakeLists.txt:50 (cmake_policy):
  The OLD behavior for policy CMP0037 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.


-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    CLANG_VERSION_MAJOR
    CLANG_VERSION_MINOR
    CLANG_VERSION_PATCH
    CMAKE_LIBTOOL
    FOUNDATION_BUILD_DIR
    Foundation_DIR
    LIBDISPATCH_BUILD_DIR
    LIBDISPATCH_SOURCE_DIR
    LLVM_VERSION_MAJOR
    LLVM_VERSION_MINOR
    LLVM_VERSION_PATCH
    PKG_CONFIG_EXECUTABLE
    SWIFTC_EXECUTABLE
    dispatch_DIR


-- Build files have been written to: /Users/jhinkle/swift-source/build/Ninja-DebugAssert/llbuild-macosx-x86_64
+ popd
~/swift-source
+ /usr/local/bin/cmake --build /Users/jhinkle/swift-source/build/Ninja-DebugAssert/llbuild-macosx-x86_64 -- -j8 all
[53/170][ 31%][130.168s] Building CXX object lib/Basic/CMakeFiles/llbuildBasic.dir/FileInfo.cpp.o
/Users/jhinkle/swift-source/llbuild/lib/Basic/FileInfo.cpp:30:12: warning: parameter 'info_out' not found in the function declaration [-Wdocumentation]
/// \param info_out [out] On success, the important path information.
           ^~~~~~~~
1 warning generated.
[142/170][ 83%][493.888s] Linking Swift shared library lib/libllbuildSwift.dylib
ld: warning: dylib (lib/libllbuild.dylib) was built for newer macOS version (10.15) than being linked (10.10)
[170/170][100%][576.748s] Fixing up XcodePerfTests.xctest CFBundleExecutable...
--- Cleaning swiftpm ---
+ /Users/jhinkle/swift-source/swiftpm/Utilities/bootstrap clean --build-dir /Users/jhinkle/swift-source/build/Ninja-DebugAssert/swiftpm-macosx-x86_64
--- bootstrap: note: Cleaning
--- Building swiftpm ---
+ /Users/jhinkle/swift-source/swiftpm/Utilities/bootstrap build --swiftc-path /Users/jhinkle/swift-source/build/Ninja-DebugAssert/toolchain-macosx-x86_64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc --clang-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang --cmake-path /usr/local/bin/cmake --ninja-path /usr/local/bin/ninja --build-dir /Users/jhinkle/swift-source/build/Ninja-DebugAssert/swiftpm-macosx-x86_64 --llbuild-build-dir /Users/jhinkle/swift-source/build/Ninja-DebugAssert/llbuild-macosx-x86_64 --reconfigure
--- bootstrap: error: unable to find swiftc at /Users/jhinkle/swift-source/build/Ninja-DebugAssert/toolchain-macosx-x86_64/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc
ERROR: command terminated with a non-zero exit status 1, aborting

Note: I didn't copy the whole output as it was fairly large

Building swiftpm depends on installing swift. You could try adding the new --infer option to build-script, which should infer any dependencies, including the install step for swift.

Alternatively, you could use one of the presets that our CI uses, so you know it's getting tested:

  • macOS: build-script --preset=buildbot_swiftsyntax_macos
  • Linux: build-script --preset=buildbot_swiftsyntax_linux
1 Like