Something to look into:
Building Swift 5.1 on a RHEL 8 box with clang-7.0.1 I keep running into a strange issue where it fails about 3/4 of the way through the build with the error:
FAILED: src/swiftDispatch.dir/Dispatch.swift.o src/swiftDispatch.dir/Dispatch.swift.swiftmodule src/swiftDispatch.dir/Dispatch.swift.swiftdoc cd /home/rolson/rpmbuild/BUILD/swift-source/build/buildbot_linux/libdispatch-linux-x86_64/src && /home/rolson/rpmbuild/BUILD/swift-source/build/buildbot_linux/swift-linux-x86_64/bin/swiftc -frontend -module-name Dispatch -module-link-name swiftDispatch -I /home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch -O -Xcc -fblocks -Xcc -fmodule-map-file=/home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch/dispatch/module.modulemap -emit-module-path /home/rolson/rpmbuild/BUILD/swift-source/build/buildbot_linux/libdispatch-linux-x86_64/src/swiftDispatch.dir/Dispatch.swift.swiftmodule -emit-module-doc-path /home/rolson/rpmbuild/BUILD/swift-source/build/buildbot_linux/libdispatch-linux-x86_64/src/swiftDispatch.dir/Dispatch.swift.swiftdoc -o /home/rolson/rpmbuild/BUILD/swift-source/build/buildbot_linux/libdispatch-linux-x86_64/src/swiftDispatch.dir/Dispatch.swift.o -c /home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch/src/swift/Block.swift /home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch/src/swift/Data.swift -primary-file /home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch/src/swift/Dispatch.swift /home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch/src/swift/IO.swift /home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch/src/swift/Private.swift /home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch/src/swift/Queue.swift /home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch/src/swift/Source.swift /home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch/src/swift/Time.swift /home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch/src/swift/Wrapper.swift <unknown>:0: warning: missing submodule 'CDispatch' /home/rolson/rpmbuild/BUILD/swift-source/swift-corelibs-libdispatch/src/swift/Block.swift:13:8: error: no such module 'CDispatch' import CDispatch ^ [60/91][ 65%][5.922s] Generating swiftDispatch.dir/Time.swift.o, swiftDispatch.dir/Time.swift.swiftmodule, swiftDispatch.dir/Time.swift.swiftdoc [61/91][ 67%][6.216s] Generating swiftDispatch.dir/Data.swift.o, swiftDispatch.dir/Data.swift.swiftmodule, swiftDispatch.dir/Data.swift.swiftdoc [62/91][ 68%][6.360s] Generating swiftDispatch.dir/Wrapper.swift.o, swiftDispatch.dir/Wrapper.swift.swiftmodule, swiftDispatch.dir/Wrapper.swift.swiftdoc [63/91][ 69%][6.724s] Generating swiftDispatch.dir/Source.swift.o, swiftDispatch.dir/Source.swift.swiftmodule, swiftDispatch.dir/Source.swift.swiftdoc [64/91][ 70%][6.967s] Generating swiftDispatch.dir/IO.swift.o, swiftDispatch.dir/IO.swift.swiftmodule, swiftDispatch.dir/IO.swift.swiftdoc[65/91][ 71%][7.313s] Generating swiftDispatch.dir/Block.swift.o, swiftDispatch.dir/Block.swift.swiftmodule, swiftDispatch.dir/Block.swift.swiftdoc [66/91][ 72%][9.094s] Generating swiftDispatch.dir/Queue.swift.o, swiftDispatch.dir/Queue.swift.swiftmodule, swiftDispatch.dir/Queue.swift.swiftdoc ninja: build stopped: subcommand failed. Building the standard library for: swift-stdlib-linux-x86_64 Running Swift tests for: check-swift-all-linux-x86_64 check-swift-all-optimize-linux-x86_64 swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting swift/utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting error: Bad exit status from /var/tmp/rpm-tmp.Ffec07 (%build)
The funny thing is that if I go to ~/rpmbuild/SPECS/
and type rpm build -bc --short-circuit ./swift-lang.spec
then it will pick up from where it left off, and finish completely! The problem is that does not finish building the RPM file, it just validates that the issue seems to be something weird with the version of Clang that ships with RHEL8; I haven't seen the problem on any Fedora machine and mock builds with EPEL8 seem to be fine (crosses-fingers).