I'm building a distributable Swift toolchain using build-toolchain, with updated presets to drop cross-compilation (we're fully on Apple Silicon).
The toolchain builds fine, installs cleanly in Xcode, and works. However, I hit a linker error for iOS simulator builds:
libclang_rt.profile_iossim.a not found
As a workaround, I’ve been copying libclang_rt.profile_iossim.a
from Xcode’s default toolchain and that gives me a successful build.
Questions:
-
How can I ensure
libclang_rt.profile_iossim.a
is bundled as part of the toolchain build?
compiler-rt
is already included ininstall_components
, but it seems additional configuration might be needed to include this runtime archive. -
Are there other presets or install components needed to more closely match Xcode’s default toolchain? I’m aiming for a fully distributable toolchain - any guidance on additional config/presets to align more closely with what Xcode toolchains provide out of the box would be super helpful.
apple_silicon_production_presets.ini
[preset: apple_silicon_production]
swift-install-components=autolink-driver;back-deployment;compiler;clang-resource-dir-symlink;libexec;stdlib;sdk-overlay;static-mirror-lib;toolchain-tools;license;sourcekit-xpc-service;swift-remote-mirror;swift-remote-mirror-headers
llvm-install-components=llvm-ar;llvm-ranlib;llvm-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;dsymutil;LTO;clang-features-file;lld
lit-args=-v
build-ninja
no-assertions
swift-stdlib-build-type=RelWithDebInfo
swift-stdlib-enable-assertions=false
swift-darwin-supported-archs=arm64
stdlib-deployment-targets=macosx-arm64
swift-primary-variant-sdk=OSX
swift-primary-variant-arch=arm64
ios
tvos
watchos
xros
libcxx
lldb
llbuild
swiftpm
swift-driver
swift-inspect
swiftsyntax
swift-testing
swiftformat
playgroundsupport
indexstore-db
sourcekit-lsp
swiftdocc
release-debuginfo
lldb-use-system-debugserver
lldb-build-type=Release
build-swift-stdlib-unittest-extra
# When building for an Xcode toolchain, don't copy the Swift Resource/ directory
# into the LLDB.framework. LLDB.framework will be installed alongside a Swift
# compiler, so LLDB should use its resource directory directly.
# Also, to reduce the size of the final toolchain, limit debug info to be
# line-tables only.
extra-cmake-options=
-DLLDB_FRAMEWORK_COPY_SWIFT_RESOURCES=0
-DCMAKE_C_FLAGS="-gline-tables-only"
-DCMAKE_CXX_FLAGS="-gline-tables-only"
extra-dsymutil-args="--verify-dwarf=none"
install-llvm
install-static-linux-config
install-swift
install-lldb
install-swift-testing-macros
install-llbuild
install-swiftpm
install-swift-driver
install-swiftsyntax
install-swift-testing
install-playgroundsupport
install-sourcekit-lsp
install-swiftformat
install-swiftdocc
darwin-install-extract-symbols
no-swift-stdlib-assertions
skip-test-swift
skip-test-swiftpm
skip-test-swift-driver
skip-test-llbuild
skip-test-lldb
skip-test-cmark
skip-test-playgroundsupport
skip-test-swiftsyntax
skip-test-swiftformat
skip-test-skstresstester
skip-test-swiftdocc
skip-test-osx
skip-build-benchmarks
#Path to the root of the installation filesystem.
install-destdir=%(install_destdir)s
# Path to the .tar.gz package we would create.
installable-package=%(installable_package)s
# Path where debug symbols will be installed.
install-symroot=%(install_symroot)s
# Path where the compiler, the runtime and the standard libraries will be
# installed.
install-prefix=%(install_toolchain_dir)s/usr
# Info.plist
darwin-toolchain-bundle-identifier=%(darwin_toolchain_bundle_identifier)s
darwin-toolchain-display-name=%(darwin_toolchain_display_name)s
darwin-toolchain-display-name-short=%(darwin_toolchain_display_name_short)s
darwin-toolchain-name=%(darwin_toolchain_xctoolchain_name)s
darwin-toolchain-version=%(darwin_toolchain_version)s
darwin-toolchain-alias=%(darwin_toolchain_alias)s
darwin-toolchain-require-use-os-runtime=0