apple / apple/swift-nio-ssh

Unable to cross compiling against MUSL.

Open
#170 1 comment 0 reactions 0 assignees View on GitHub
good first issue
Dominant language
Swift
Stars
515
Forks
85
PR merge metrics
No merged PRs in 30d

Description

SwiftNIO SSH commit hash: e0ad5be6b474d24849b5b6ba8263bdfd0ede2eae

## Context:
Trying to compile `swift-nio-ssh` against MUSL getting the following errors.
```
/Users/zane/Downloads/swift-nio-ssh/Sources/NIOSSH/Keys And Signatures/NIOSSHCertifiedPublicKey.swift:740:17: error: cannot find 'timespec' in scope
738 | extension DispatchWallTime {
739 | init(secondsSinceEpoch: UInt64) {
740 | let t = timespec(tv_sec: time_t(secondsSinceEpoch), tv_nsec: 0)
| `- error: cannot find 'timespec' in scope
741 | self = DispatchWallTime(timespec: t)
742 | }

/Users/zane/Downloads/swift-nio-ssh/Sources/NIOSSH/Keys And Signatures/NIOSSHCertifiedPublicKey.swift:740:34: error: cannot find 'time_t' in scope
738 | extension DispatchWallTime {
739 | init(secondsSinceEpoch: UInt64) {
740 | let t = timespec(tv_sec: time_t(secondsSinceEpoch), tv_nsec: 0)
| `- error: cannot find 'time_t' in scope
741 | self = DispatchWallTime(timespec: t)
742 | }
```

## Steps to reproduce:
```
xcrun --toolchain swift swift build --swift-sdk aarch64-swift-linux-musl
# or
xcrun --toolchain swift swift build --swift-sdk x86_64-swift-linux-musl
```

## Environment
```sh
xcrun --toolchain swift swift --version
Apple Swift version 6.0.1 (swift-6.0.1-RELEASE)
Target: arm64-apple-macosx15.0

xcrun --toolchain swift swift sdk list
swift-6.0.1-RELEASE_static-linux-0.0.1
```
Operating system: 15.0 (24A335)

Contributor guide

Open the contributing guide

Research direction

Start at Sources/NIOSSH/Keys And Signatures/NIOSSHCertifiedPublicKey.swift around line 740 and reproduce the failure with the listed swift build commands for the MUSL SDKs. Check the cross-compilation failure involving DispatchWallTime, timespec, and time_t; done means the project builds successfully for the affected MUSL targets.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
networking, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.