I'm starting to wonder if the Swift compiler is expected to build to completion or if that is a rare event.
Here is my build script:
#!/bin/bash
mkdir swift-source
cd swift-source
git clone https://github.com/apple/swift.git
cd swift
git checkout swift-5.7.3-RELEASE
cd ..
./swift/utils/update-checkout --clone
time nice swift/utils/build-script -j2 --preset=buildbot_linux,no_test \
install_destdir=~/swift-install installable_package=~/swift.tgz
Here is the error that I see:
[243/1486][ 16%][387.201s] Building CXX object lib/Demangling/CMakeFiles/swiftDemangling.dir/OldDemangler.cpp.o
FAILED: lib/Demangling/CMakeFiles/swiftDemangling.dir/OldDemangler.cpp.o
/usr/bin/clang++ -DCMARK_STATIC_DEFINE -DGTEST_HAS_RTTI=0 -DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1 -DSWIFT_STDLIB_HAS_TYPE_PRINTING=1 -DSWIFT_SUPPORT_OLD_MANGLING=1 -DSWIFT_THREADING_LINUX -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Ilib/Demangling -I/home/me/swift-source/swift/lib/Demangling -I/home/me/swift-source/swift/stdlib/public/SwiftShims -Iinclude -I/home/me/swift-source/swift/include -I/home/me/swift-source/llvm-project/llvm/include -I/home/me/swift-source/build/buildbot_linux/llvm-linux-aarch64/include -I/home/me/swift-source/llvm-project/clang/include -I/home/me/swift-source/build/buildbot_linux/llvm-linux-aarch64/tools/clang/include -I/home/me/swift-source/cmark/src/include -I/home/me/swift-source/build/buildbot_linux/cmark-linux-aarch64/src -I/home/me/swift-source/swift-corelibs-libdispatch/src/BlocksRuntime -I/home/me/swift-source/swift-corelibs-libdispatch -Wno-unknown-warning-option -Werror=unguarded-availability-new -fno-stack-protector -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-class-memaccess -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -fdiagnostics-color -ffunction-sections -fdata-sections -Werror=switch -Wdocumentation -Wimplicit-fallthrough -Wunreachable-code -Woverloaded-virtual -DOBJC_OLD_DISPATCH_PROTOTYPES=0 -O3 -DNDEBUG -fno-exceptions -fno-rtti -Werror=gnu -Werror=c++98-compat-extra-semi -UNDEBUG -target aarch64-unknown-linux-gnu -O2 -g0 -funwind-tables -std=c++14 -MD -MT lib/Demangling/CMakeFiles/swiftDemangling.dir/OldDemangler.cpp.o -MF lib/Demangling/CMakeFiles/swiftDemangling.dir/OldDemangler.cpp.o.d -o lib/Demangling/CMakeFiles/swiftDemangling.dir/OldDemangler.cpp.o -c /home/me/swift-source/swift/lib/Demangling/OldDemangler.cpp
/home/me/swift-source/swift/lib/Demangling/OldDemangler.cpp:154:40: error: no member named 'value' in 'llvm::Optional<char>'
while (!isEmpty() && (c2 = peek()).value() != c) {
~~~~~~~~~~~~~ ^
/home/me/swift-source/swift/lib/Demangling/OldDemangler.cpp:155:27: error: no member named 'value' in 'llvm::Optional<char>'
result.push_back(c2.value());
~~ ^
/home/me/swift-source/swift/lib/Demangling/OldDemangler.cpp:158:33: error: no member named 'value' in 'llvm::Optional<char>'
return c2.has_value() && c2.value() == c;
~~ ^
/home/me/swift-source/swift/lib/Demangling/OldDemangler.cpp:158:15: error: no member named 'has_value' in 'llvm::Optional<char>'; did you mean 'hasValue'?
return c2.has_value() && c2.value() == c;
^~~~~~~~~
hasValue
/home/me/swift-source/llvm-project/llvm/include/llvm/ADT/Optional.h:288:18: note: 'hasValue' declared here
constexpr bool hasValue() const { return Storage.hasValue(); }
^
/home/me/swift-source/swift/lib/Demangling/OldDemangler.cpp:380:14: error: no member named 'has_value' in 'llvm::Optional<swift::Demangle::ValueWitnessKind>'; did you mean 'hasValue'?
if (!w.has_value())
^~~~~~~~~
hasValue
/home/me/swift-source/llvm-project/llvm/include/llvm/ADT/Optional.h:288:18: note: 'hasValue' declared here
constexpr bool hasValue() const { return Storage.hasValue(); }
^
/home/me/swift-source/swift/lib/Demangling/OldDemangler.cpp:385:55: error: no member named 'value' in 'llvm::Optional<swift::Demangle::ValueWitnessKind>'
unsigned(w.value()));
~ ^
/home/me/swift-source/swift/lib/Demangling/OldDemangler.cpp:400:9: error: no member named 'has_value' in 'llvm::Optional<swift::Demangle::Directness>'; did you mean 'hasValue'?
DEMANGLE_CHILD_AS_NODE_OR_RETURN(fieldOffset, Directness, depth + 1);
^
/home/me/swift-source/swift/lib/Demangling/OldDemangler.cpp:189:16: note: expanded from macro 'DEMANGLE_CHILD_AS_NODE_OR_RETURN'
if (!_kind.has_value()) \
^
/home/me/swift-source/llvm-project/llvm/include/llvm/ADT/Optional.h:288:18: note: 'hasValue' declared here
constexpr bool hasValue() const { return Storage.hasValue(); }
^
/home/me/swift-source/swift/lib/Demangling/OldDemangler.cpp:792:16: error: no member named 'has_value' in 'llvm::Optional<swift::Demangle::Node::Kind>'; did you mean 'hasValue'?
if (kind.has_value()) return nullptr;
^~~~~~~~~
hasValue
/home/me/swift-source/llvm-project/llvm/include/llvm/ADT/Optional.h:288:18: note: 'hasValue' declared here
constexpr bool hasValue() const { return Storage.hasValue(); }
^
/home/me/swift-source/swift/lib/Demangling/OldDemangler.cpp:810:15: error: no member named 'has_value' in 'llvm::Optional<swift::Demangle::Node::Kind>'; did you mean 'hasValue'?
if (!kind.has_value()) kind = Node::Kind::Identifier;
^~~~~~~~~
hasValue
/home/me/swift-source/llvm-project/llvm/include/llvm/ADT/Optional.h:288:18: note: 'hasValue' declared here
constexpr bool hasValue() const { return Storage.hasValue(); }
^
9 errors generated.
[244/1486][ 16%][456.251s] Building CXX object stdlib/public/SwiftRemot.../CMakeFiles/swiftRemoteMirror-linux-aarch64.dir/SwiftRemoteMirror.cpp.o
ninja: build stopped: subcommand failed.
ERROR: command terminated with a non-zero exit status 1, aborting
ERROR: command terminated with a non-zero exit status 1, aborting
Most likely you don't have the right tag of LLVM checked out, as update-checkout has the flag --tag to check out the right version. You can check with cd llvm-project and git status or git log. If not the 5.7.3 tag, check it out now with ./swift/utils/update-checkout --tag swift-5.7.3-RELEASE (I don't think the checkout script can clone and check out a tag at once, so you will need to add this second command to your build script).
Check what tag you have swift-crypto checked out at, it should be 1.1.5, not 2.2.3 as in current trunk.
If so, you may be better off checking out the 5.7 branch with --scheme release/5.7, rather than a tag, which may not work for repos that follow their own numbered tagging scheme. If you don't want to restart your whole build, you can just update all repos with numbered tags in this link instead.
If you don't detail what error you got this time or what swift-crypto version you had checked out, we can't help you figure it out. The build must work, else there wouldn't be a shipping 5.7.3 compiler for several linux distros now.
Can you provide a build script that you know to be correct?
I've tried using --scheme, --tag, and even checking out each subdirectory manually e.g. release/5.4, but each time the build fails.
I think the one you provided initially should work, provided you clone trunk in your first checkout command, then check out the 5.7 branch with the scheme flag I gave you by running checkout again.
What went wrong when you tried that? You got pretty far if you were building the package manager before you got that crypto error last week. Once you made sure all those dependencies were checked out to the right tag, you still got the same error?
update-checkout has to succeed before you start building, otherwise you'd be building an inconsistent checkout, which is almost certainly a cause of the build issues that you mentioned.