Closed
Description
Description
Ubuntu 23.04 + Swift 5.8: Fails to compile bootstrap1 modules due to possible module map issues with CXX interop
When compiling Swift from source with --bootstrapping=bootstrapping
, compilation fails during generation of modules. Specifically on the Basic module.
Steps to reproduce
- Download Ubuntu 23.04, which is currently in beta but also in feature freeze so its ABI stable at this point.
- Install Swift dependencies as listed in the documentation
- Construct a swift source root by running:
./swift/utils/update-checkout --clone --tag swift-5.8-RELEASE
- Invoke the
build-script
as follows:
export SCCACHE_CACHE_SIZE="50G" && ./swift/utils/build-script -R --swift-install-components="autolink-driver;compiler;clang-resource-dir-symlink;stdlib;swift-remote-mirror;sdk-overlay;static-mirror-lib;toolchain-tools;license;sourcekit-inproc" --llvm-install-components="llvm-ar;llvm-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;lld;LTO;clang-features-file" --lldb --build-lld=1 --build-ninja=1 --llbuild=1 --libcxx=1 --swiftpm=1 --foundation=1 --libdispatch=1 --indexstore-db=1 --libicu=1 --install-swiftpm=1 --build-swift-static-stdlib --build-swift-static-sdk-overlay --install-llvm=1 --install-swift=1 --install-foundation --install-libdispatch --swiftdocc=1 -j=8 --sccache=1 --skip-test-linux=1 --skip-build-benchmarks --skip-early-swift-driver --skip-early-swiftsyntax --bootstrapping=bootstrapping --install-destdir=/home/jjones/swift-install
Expected behavior
Bootstrap compilation should succeed, however a failure occurs when swiftc
is invoked and has to deal with cxx-interop
.
Build Failure
[1216/1439][ 84%][321.279s] Building swift module Basic
FAILED: bootstrapping1/SwiftCompilerSources/Basic.o /home/jjones/swift-source-root/build/Ninja-ReleaseAssert/swift-linux-x86_64/bootstrapping1/SwiftCompilerSources/Basic.o
cd /home/jjones/swift-source-root/swift/SwiftCompilerSources && /home/jjones/swift-source-root/build/Ninja-ReleaseAssert/swift-linux-x86_64/bootstrapping0/bin/swiftc -c -o /home/jjones/swift-source-root/build/Ninja-ReleaseAssert/swift-linux-x86_64/bootstrapping1/SwiftCompilerSources/Basic.o -I /home/jjones/swift-source-root/build/Ninja-ReleaseAssert/swift-linux-x86_64/bootstrapping0/bin/../lib -I /usr/lib -target x86_64-unknown-linux-gnu -module-name Basic -emit-module -emit-module-path /home/jjones/swift-source-root/build/Ninja-ReleaseAssert/swift-linux-x86_64/bootstrapping1/SwiftCompilerSources/Basic.swiftmodule -parse-as-library /home/jjones/swift-source-root/swift/SwiftCompilerSources/Sources/Basic/SourceLoc.swift /home/jjones/swift-source-root/swift/SwiftCompilerSources/Sources/Basic/Utils.swift -wmo -Xfrontend -validate-tbd-against-ir=none -Xfrontend -enable-experimental-cxx-interop -Xcc -UIBOutlet -Xcc -UIBAction -Xcc -UIBInspectable -Xfrontend -disable-implicit-string-processing-module-import -O -cross-module-optimization -Xcc -I -Xcc /home/jjones/swift-source-root/llvm-project/llvm/include -Xcc -I -Xcc /home/jjones/swift-source-root/build/Ninja-ReleaseAssert/llvm-linux-x86_64/include -Xcc -I -Xcc /home/jjones/swift-source-root/llvm-project/clang/include -Xcc -I -Xcc /home/jjones/swift-source-root/build/Ninja-ReleaseAssert/llvm-linux-x86_64/tools/clang/include -Xcc -I -Xcc /home/jjones/swift-source-root/swift/include -Xcc -I -Xcc /home/jjones/swift-source-root/build/Ninja-ReleaseAssert/swift-linux-x86_64/SwiftCompilerSources/../include -I /home/jjones/swift-source-root/build/Ninja-ReleaseAssert/swift-linux-x86_64/bootstrapping1/SwiftCompilerSources
<unknown>:0: warning: unable to perform implicit import of "_Concurrency" module: no such module found
/home/jjones/swift-source-root/swift/include/swift/AST/ClangModuleLoader.h:19:10: note: while building module 'Clang_AST' imported from /home/jjones/swift-source-root/swift/include/swift/AST/ClangModuleLoader.h:19:
#include "clang/AST/DeclTemplate.h"
^
/home/jjones/swift-source-root/llvm-project/clang/include/clang/AST/APValue.h:16:10: note: while building module 'Clang_Basic' imported from /home/jjones/swift-source-root/llvm-project/clang/include/clang/AST/APValue.h:16:
#include "clang/Basic/LLVM.h"
^
/home/jjones/swift-source-root/llvm-project/clang/include/clang/Basic/Sanitizers.h:20:10: note: while building module 'LLVM_Transforms' imported from /home/jjones/swift-source-root/llvm-project/clang/include/clang/Basic/Sanitizers.h:20:
#include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h"
^
/home/jjones/swift-source-root/llvm-project/llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h:20:10: note: while building module 'LLVM_intrinsic_gen' imported from /home/jjones/swift-source-root/llvm-project/llvm/include/llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h:20:
#include "llvm/IR/PassManager.h"
^
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "IR/Argument.h"
^
/home/jjones/swift-source-root/llvm-project/llvm/include/llvm/IR/Argument.h:17:10: note: in file included from /home/jjones/swift-source-root/llvm-project/llvm/include/llvm/IR/Argument.h:17:
#include "llvm/IR/Attributes.h"
^
/home/jjones/swift-source-root/llvm-project/llvm/include/llvm/IR/Attributes.h:31:10: note: in file included from /home/jjones/swift-source-root/llvm-project/llvm/include/llvm/IR/Attributes.h:31:
#include <set>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/set:60:10: note: in file included from /usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/set:60:
#include <bits/stl_tree.h>
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_tree.h:2008:5: error: missing '#include "gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_pair.h"'; 'pair' must be declared before it is used
pair<typename _Rb_tree<_Key, _Val, _KeyOfValue,
^
/usr/lib/gcc/x86_64-linux-gnu/12/../../../../include/c++/12/bits/stl_pair.h:185:12: note: declaration here is not visible
struct pair
Environment
- Swift compiler: swift-5.8-RELEASE
- OS: Ubuntu 23.04
The full build-log is attached.
swift_build_failure.txt