Running build script 'swift/utils/build-parser-lib' always fails (Crosspost)

Hey there (again) internet folks. Crossposting this since the other forums are a bit.. well, harder to navigate.

Original link:

Hey there internet people.

The crash:

$ ./swift/utils/build-parser-lib --release --no-assertions --build-dir /tmp/parser-lib-build-ios --host iphoneos --architectures arm64

[ ... many many lines of build information later ...]

[1/2] Linking CXX shared library lib/lib_InternalSwiftSyntaxParser.dylib
FAILED: lib/lib_InternalSwiftSyntaxParser.dylib
: && /Applications/ -arch arm64 -miphoneos-version-min=10.0 -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -Wno-nested-anon-types -Werror=switch -Wdocumentation -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -O2 -g -DNDEBUG -isysroot /Applications/ -dynamiclib -Wl,-headerpad_max_install_names -Wl,-exported_symbols_list,"/tmp/parser-lib-build-ios/arm64/obj/tools/swift/tools/libSwiftSyntaxParser/libSwiftSyntaxParser.exports" -Wl,-dead_strip  -target arm64-apple-ios10.0 -Xlinker -dead_strip -Xlinker -compatibility_version -Xlinker 1 -o lib/lib_InternalSwiftSyntaxParser.dylib -install_name @rpath/lib_InternalSwiftSyntaxParser.dylib tools/swift/tools/libSwiftSyntaxParser/CMakeFiles/libSwiftSyntaxParser.dir/c-include-check.c.o tools/swift/tools/libSwiftSyntaxParser/CMakeFiles/libSwiftSyntaxParser.dir/libSwiftSyntaxParser.cpp.o  lib/libswiftParse.a  lib/libswiftSyntaxParse.a  lib/libswiftParse.a  lib/libswiftSyntaxParse.a  lib/libswiftAST.a  lib/libswiftBasic.a  lib/libLLVMSupport.a  -lm  lib/libLLVMDemangle.a  lib/libswiftDemangling.a  ./lib/libclangBasic.a  lib/libswiftSyntax.a && :
Undefined symbols for architecture arm64:
  "clang::MacroInfo::dump() const", referenced from:
      swift::ClangNode::dump() const in libswiftAST.a(Decl.cpp.o)
  "clang::Type::dump() const", referenced from:
      swift::UnexpectedClangTypeError::dump() in libswiftAST.a(ExtInfo.cpp.o)
  "clang::Decl::dump() const", referenced from:
      swift::ClangNode::dump() const in libswiftAST.a(Decl.cpp.o)
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
ERROR: command terminated with a non-zero exit status 1, aborting

(You can find the full, gorey, exciting log at

** The context:**

I am attempting to build a custom version of lib_InternalSwiftSyntaxParser.dylib to embed in iOS as described in the repositories below:

My configuration is:

# swift-DEVELOPMENT-SNAPSHOT-2020-09-23-a installed at /Library/Developer/Toolchains

$ xcrun --find swift

$ xcrun --toolchain default --find swift

$ xcrun --toolchain swift --find swift

# showing that --toolchain with bad input goes back to default
$ xcrun --toolchain random_string_that_shouldnt_do_anything --find swift

So far, I have successfully built the main swift repository with

$ ./swift/utils/build-script --clean

... and I am using the built .dylib from that effectively in a macOS application.

There are a couple of things I noticed in the build log that have me questioning some kind of cache or local configuration. Specifically, lines that mention build tools from a different toolchain:

-- Found libtool - /Applications/
-- CMake (/usr/local/Cellar/cmake/3.18.2/bin/cmake) Version: 3.18.2
-- CMake Make Program (/usr/local/bin/ninja) Version: 1.10.1
-- C Compiler (/Applications/ Version:
-- C++ Compiler (/Applications/ Version:

I'm guessing I'm doing something wrong with the invoking of this script, but I've also tried a number of path hacks within the actual build script to try to point to a different toolchain or compiler - all of which are things I am completely unfamiliar with and am stabbing at in the dark with print debugging.

I ask you kindly and with great hope in my heart:

pls halp

Terms of Service

Privacy Policy

Cookie Policy