swiftlang / swift

The Swift Programming Language
https://swift.org
Apache License 2.0
67.58k stars 10.36k forks source link

swift compile error (custom toolchain) #69987

Open codetronik opened 11 months ago

codetronik commented 11 months ago

When I try to build an ios app on Xcode, I get the error below. Could not parse Swift versions from: Swift version 5.9 (swift-5.9-RELEASE)

I checked the version of custom toolchain.

% /Library/Developer/Toolchains/My.xctoolchain/usr/bin/swift --version
Swift version 5.9 (swift-5.9-RELEASE)
Target: arm64-apple-macosx13.0

Below is the version of the Xcode's original toolchain.

% swift --version
swift-driver version: 1.87.1 Apple Swift version 5.9 (swiftlang-5.9.0.128.108 clang-1500.0.40.1)
Target: arm64-apple-macosx13.0

The options for compiling the toolchain are as follows.

utils/build-script --skip-build-benchmarks --skip-watchos --skip-tvos --swift-darwin-supported-arch=arm64 --sccache --release-debuginfo --swift-disable-dead-stripping --install-destdir=/Users/kei/111/swift/utils/swift-nightly-install --install-llvm --install-swift --install-lldb --install-llbuild --install-swiftpm --install-swift-driver --install-swiftsyntax --install-playgroundsupport --install-sourcekit-lsp --install-swiftformat --install-swiftdocc --build-swift-static-sdk-overlay --darwin-toolchain-display-name=CodeLabyrinth --darwin-toolchain-display-name-short=CodeLabyrinth --darwin-toolchain-name=CodeLabyrinth --darwin-toolchain-version=1.0 --darwin-toolchain-alias=Local --darwin-toolchain-bundle-identifier=CodeLabyrinth --darwin-toolchain-require-use-os-runtime=0 --install-prefix=/Library/Developer/Toolchains/CodeLabyrinth.xctoolchain/usr --install-symroot=/Users/kei/111/swift/utils/swift-nightly-symroot --darwin-install-extract-symbols ‘--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-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;dsymutil;LTO;clang-features-file’ --swift-primary-variant-sdk=IOS --installable-package=/Users/kei/111/swift/utils/CodeLabyrinth.tar.gz --symbols-package=/Users/kei/111/swift/utils/CodeLabyrinth-symbols.tar.gz --build-subdir=buildbot_osx  --ios --tvos --watchos --swift-stdlib-build-type=Release ‘--llvm-targets-to-build=X86;ARM;AArch64’ --swift-darwin-supported-arch “$(uname -m)”

Am I missing something?

WindowsMEMZ commented 11 months ago

Maybe you can try utils/build-toolchain script.

FengDeng commented 8 months ago

if you use build-script , add "Apple" in version string. image

Naville commented 6 months ago

Maybe you can try utils/build-toolchain script.

@WindowsMEMZ Do you happen to know which command in build-toolchain is responsible? We use custom build-script based buildsystem and encountered the exact same issue

grepping through Swift sourcecode doesn't seem to show where that error comes from or the regex used for the version detection

Naville commented 6 months ago

complier-vendor=apple is the reason

WindowsMEMZ commented 6 months ago

Maybe you can try utils/build-toolchain script.

@WindowsMEMZ Do you happen to know which command in build-toolchain is responsible? We use custom build-script based buildsystem and encountered the exact same issue

grepping through Swift sourcecode doesn't seem to show where that error comes from or the regex used for the version detection

build-toolchain actually calls the build-script inside. You can open this script by text editor to see how it works.