Open remko opened 1 year ago
Sounds as if -entry-point-function-name
is maybe not working correctly on Windows? We could disable the feature via BuildParameters.canRenameEntrypointFunctionName
if it doesn't work there.
cc @compnerd
@neonichu that definitely works: https://github.com/compnerd/swift-win32-application/blob/main/Package.swift even has an example. The problem is that you cannot alias functions using the linker on Windows and this needs to be done in SPM.
I think that I have a solution to this that is cross-platform as long as we are reliant on LLVM! The symbol rewriter should do this properly on all file formats!
Oof; I should have searched for this before creating the minimal reproducer. But there it is in case it helps! Be sure you get the spm-bug-windows-test-executable-dependency tag.
@MaxDesiatov Do you think this issue would be resolved now with your cross-compilation macros work?
I'm still seeing it recently with swift-foundation at least.
Description
I have a package with an executable target, and a test target. The tests in the test target do a
@testable import
of the executable target. The main target has a@main struct ...
.Running
swift test
works on macOS and Linux. Runningswift test
on Windows fails.Expected behavior
When running
swift test
on Windows, the tests run.Actual behavior
When running
swift test
on windows, it fails with an error at link time:Steps to reproduce
No response
Swift Package Manager version/commit hash
version included in the official Swift download for Windows
Swift & OS version (output of
swift --version && uname -a
)Swift: 5.8 OS: Microsoft Windows Server 2022
(also happens on other versions of swift and OS).