-
Notifications
You must be signed in to change notification settings - Fork 285
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing required module '_FoundationCollections' when building with the Static Linux SDK #420
Comments
@etcwilde @al45tair any chance you have any insight on what's going on here? For reference, in the standard Linux toolchain we have:
(in the non-static build, but in the static swift Linux SDK, I don't see
Do we have an issue of the packaging of the static SDK where we're missing these files, or is there an issue on the CMake side with swift-collections (that CMake file is at https://github.com/apple/swift-collections/blob/main/Sources/CMakeLists.txt and |
I can reproduce with the just-released static linux SDK 6.0 when simply trying to build
Simply building with the regular glibc-based static stdlib works fine though, Looking at Evan's last change to the static linux SDK build script to add support for this Foundation rewrite, he added two CMake flags for this, but Jeremy previously added a couple more to the official @jmschonfeld, is the |
I think @etcwilde is looking at this, but my guess is that the static SDK build script needs tweaking slightly to get CMake to install the additional library files. |
Foundation needs some copy of swift-collections to build, but the parameters determine where that source copy comes from. With |
Right, but that wasn't the question, ie is it "required for these files to be installed" in the final static SDK? I figured it's somehow getting the source and building it, otherwise the dependency wouldn't be fulfilled and you'd get a compilation failure, but perhaps the variable has to be set for CMake to then finally install that static library and modules? |
No, the variable strictly defines the location of the source checkout for swift-collections |
Having said that I thought @etcwilde was working on it, I went looking. The problem is that I'll have some PRs up tomorrow my time to fix that and a couple of other things I found along the way. |
Yes, this probably should be on |
Linux static builds are broken in the release version: apple/swift-collections#420 This reverts commit d574262.
Lowercasing `CMAKE_SYSTEM_NAME` to find the name Swift uses for a platform is not guaranteed to work. Instead, use the `SWIFT_SYSTEM_NAME` variable, which lets us override the name when building the Static SDK for Linux. Fixes apple#420.
Lowercasing `CMAKE_SYSTEM_NAME` to find the name Swift uses for a platform is not guaranteed to work. Instead, use the `SWIFT_SYSTEM_NAME` variable, which lets us override the name when building the Static SDK for Linux. Fixes apple#420.
@al45tair, others are reporting more errors like You may also want to update the doc to use the 6.0 release SDK and add a doc step so they can check and make sure they're not using the Xcode toolchain inadvertently. |
The warning is a known issue with the modulewrap program (rdar://115918181); it's harmless, but annoying. (Update: I just raised a PR to get rid of it) The missing |
The thing I had was that I overlooked the line on https://www.swift.org/documentation/articles/static-linux-getting-started.html
So you have to follow the instructions to build using the toolchain downloaded and not build xcode. That is indeed what solved the But importing Foundation is an issue. It does not work as documented like stated in this post https://forums.swift.org/t/using-swift-foundation-with-linux-static-sdk/74642 Also doing So also the docs on apple/swift-foundation that state it should be included are wrong. Any help why foundation is missing? |
Foundation itself is not missing, but |
Hmm, that is new. Can you try something like the following two commands on your linux toolchain and report the results?
|
Swift 6.0 Nightly should resolve this issue with temporary workaround in the build script. We would like to hear feedback if this resolves the issue for you. Toolchain: https://download.swift.org/swift-6.0-branch/xcode/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-09-17-a/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-09-17-a-osx.pkg Note: We should not close this issue until the proper fix is merged into swift-collections repo. |
Not sure I understand the find, this does not fin anything but the swift --version gives this |
@shahmishal will try with the de
will try using those now and report back ... |
I think I'm mixing 2 issues that should be separated.
This is for a very simple executable project that I mention in the ticket in Foundation. That has been closed since it seams to be a darwin related issue the reproducable code to try is
This both with with release and the swift-6.0-DEVELOPMENT-SNAPSHOT-2024-09-17-a.xctoolchain |
Correct there are two issues:
|
When building a Swift package using the September 11, 2024 Swift 6 toolchain and matching Static Linux SDK, compilation fails with
error: missing required module '_FoundationCollections'
System info
OS: macOS 14.6.1
Xcode: 16.0 public release, 16.0 release candidate, 15.4
Swift: Apple Swift version 6.0-dev (LLVM fc1036139c5e562, Swift 5bbf725fd958d34) Target: arm64-apple-macosx14.0
Static Linux SDK swift-6.0-DEVELOPMENT-SNAPSHOT-2024-09-11-a_static-linux-0.0.1
Package
Package.swift
Sources/FoundationTest/FoundationTest.swift
The text was updated successfully, but these errors were encountered: