Closed jakepetroules closed 3 months ago
@swift-ci please smoke test
@swift-ci please test
Can you create an issue for the Windows symbol count issue so we can track it and gather ideas? Thanks!
Can you create an issue for the Windows symbol count issue so we can track it and gather ideas? Thanks!
I don't think that the issue is gathering ideas. In fact, I believe a radar exists for the issue. It is caused by SPM not knowing how too build libraries. A static and dynamic libraries are not products, but targets. The output type changes the required compiler flags, the generated code, and cannot be used interchangeably. The current model of building everything for a shared library, using it as an object library is fundamentally incorrect and results in the over-exported symbol list. The idea here is to simply do what CMake does and model the build properly, tracking the linkage type across each dependency edge and building the dependency appropriately.
https://github.com/swiftlang/swift-package-manager/issues/5597 contains some previous discussion
@swift-ci please test windows
5597 contains some previous discussion
Cool. I think that's definitely the root of the problem. In the Windows world, DLLs are usually the default. I want to see if that solves the symbol count issue.
I want to see if that solves the symbol count issue.
We know that it does - see the CMake build.
I want to see if that solves the symbol count issue.
We know that it does - see the CMake build.
Ah, I see :)
option(BUILD_SHARED_LIBS "Build shared libraries by default" YES)
Yes, we default to shared libraries and then selectively convert to static where it is profitable (the changes to make them static usually give stats on the size reduction).
This continues from the support added in #7866.
While we can't build on Windows as-is due to exceeding the 65k exported symbol limit, in turn due to limitations in the build system, we can apply -static to all of the library targets which are known to be linked statically, in order to get that symbol count down.
Note that this uses unsafeFlags, which is normally not recommended, however given that we are already using unsafeFlags elsewhere in the manifest, this seems reasonable enough for now until we can improve support for static linking on Windows.
Building the test targets still exceeds the symbol count though.