swift-sdk-generator
swift-sdk-generator copied to clipboard
glibc warnings compiling for 5.9-RELEASE_ubuntu_jammy_aarch64
I've created a simple helloworld tool, and compiling it generates warning messages that seem to be spurious. Here's the project structure:
./Package.swift
./Sources/helloworld/main.swift
./Tests/LinuxMain.swift
./Tests/helloworldTests/helloworldTests.swift
./Tests/helloworldTests/XCTestManifests.swift
Package consists of:
// swift-tools-version:5.9
import PackageDescription
let package = Package(
name: "helloworld",
dependencies: [],
targets: [
.executableTarget(
name: "helloworld",
dependencies: []
),
.testTarget(
name: "helloworldTests",
dependencies: ["helloworld"]
),
]
)
main.swift consists of:
print("Successful launch!")
This produces the following output:
swift build --experimental-swift-sdk 5.9-RELEASE_ubuntu_jammy_aarch64
Building for debugging...
warning: Could not read SDKSettings.json for SDK at: /Users/rvs/Library/org.swift.swiftpm/swift-sdks/5.9-RELEASE_ubuntu_jammy_aarch64.artifactbundle/5.9-RELEASE_ubuntu_jammy_aarch64/aarch64-unknown-linux-gnu/ubuntu-jammy.sdk
<unknown>:0: warning: glibc not found for 'aarch64-unknown-linux-gnu'; C stdlib may be unavailable
<unknown>:0: warning: glibc not found for 'aarch64-unknown-linux-gnu'; C stdlib may be unavailable
warning: Could not read SDKSettings.json for SDK at: /Users/rvs/Library/org.swift.swiftpm/swift-sdks/5.9-RELEASE_ubuntu_jammy_aarch64.artifactbundle/5.9-RELEASE_ubuntu_jammy_aarch64/aarch64-unknown-linux-gnu/ubuntu-jammy.sdk
[5/5] Linking helloworld
Build complete! (9.02s)
The glibc warnings seem to be spurious.
Did you mean main.c or was that a typo?
sorry main.swift. will fix
Also tracked as rdar://115492638
I've been having similar issues with my manually configured cross-compilation build where
swift build --sdk <path/to/sysroot>
no longer works as expected in 5.9. Swift neither seems to find libc nor any other libraries in the sysroot. For a full log, see e.g. this failed build (I prepare a sysroot in the first Docker stage, then copy it over into /usr/local/<targetarch>-ubuntu-jammy and point --sdk to this sysroot, along with some flags for the C/C++ compilers).
Would of course be nice to migrate over to the new SDK bundles once the Ubuntu host -> Ubuntu target scenario is properly supported, but I assume this is still a regression.
This has gotten much worse in 5.9.1, now I get a ton of the following warnings:
clang-13: warning: -Z-reserved-lib-stdc++: 'linker' input unused [-Wunused-command-line-argument]
warning: Could not read SDKSettings.json for SDK at: /Users/____/Library/org.swift.swiftpm/swift-sdks/5.9.1-RELEASE_ubuntu_jammy_x86_64.artifactbundle/5.9.1-RELEASE_ubuntu_jammy_x86_64/x86_64-unknown-linux-gnu/ubuntu-jammy.sdk
<unknown>:0: warning: glibc not found for 'x86_64-unknown-linux-gnu'; C stdlib may be unavailable
The good news is that then after dozens of each of the above, I get:
[798/798] Linking echoserver
Build complete! (19.56s)