Link error when building in command line
Kyle-Ye opened this issue · 3 comments
Description
> swift test
...
protocol descriptor for SwiftCompilerPlugin.CompilerPlugin, referenced from:
l_got.$s19SwiftCompilerPlugin0bC0Mp in TestingMacrosMain.swift.o
static (extension in SwiftCompilerPlugin):SwiftCompilerPlugin.CompilerPlugin.main() throws -> (), referenced from:
static TestingMacros.TestingMacrosMain.$main() throws -> () in TestingMacrosMain.swift.o
protocol conformance descriptor for Swift.String : SwiftSyntaxBuilder.ExpressibleByLiteralSyntax in SwiftSyntaxBuilder, referenced from:
lazy protocol witness table accessor for type Swift.String and conformance Swift.String : SwiftSyntaxBuilder.ExpressibleByLiteralSyntax in SwiftSyntaxBuilder in AvailabilityGuards.swift.o
protocol conformance descriptor for Swift.UInt64 : SwiftSyntaxBuilder.ExpressibleByLiteralSyntax in SwiftSyntaxBuilder, referenced from:
lazy protocol witness table accessor for type Swift.UInt64 and conformance Swift.UInt64 : SwiftSyntaxBuilder.ExpressibleByLiteralSyntax in SwiftSyntaxBuilder in AvailabilityGuards.swift.o
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: fatalError
Build fine with Xcode GUI locally and CLI on CI. However recently I just can't build locally with CLI by running swift test
. It will give me some strange link error.
Expected behavior
No response
Actual behavior
No response
Steps to reproduce
No response
swift-testing version/commit hash
0.2.0
Swift & OS version (output of swift --version ; uname -a
)
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-macosx14.0
uname -a
Darwin <redacted> 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:18 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T6000 arm64
The 5.9 toolchain is not supported. If you are having trouble while using a main branch development toolchain, please reopen.
A duplicated one as apple/swift-package-manager#6940
The upstream SwiftPM team has fixed it on latest 5.9 release (5.9.2). In our case, just update the local Xcode version from Xcode 15.0 to Xcode 15.1 would fix the issue.
My CI is always using Xcode 15.1
The 5.9 toolchain is not supported. If you are having trouble while using a main branch development toolchain, please reopen.
I have run some runtime crash on Linux after converting another framework to swift-tesing.
Since I still use 5.9 + 0.3.0 (There is no Swift 5.10 release toolchain yet on Linux), I'll report an issue if it was still there after the version bump.
For now I just comment the 2 crash test file out and limit to Darwin only.
// *** Program crashed: Bad pointer dereference at 0x0000000ffff9400a ***
// swift-testing framework will crash here on Linux
// Report to upstream for investigation when we bump to 5.10
#if canImport(Darwin)
final class ExternalTests: TestBase {
@Test
func example() throws { }
}
#endif
class TestBase {
init() { ... }
deinit { ... }
}