Skip to content

Swift 6 and static Linux cross compiling. #515

@zaneenders

Description

@zaneenders

Hi,

I know this is getting ahead of things but hoping the heads up helps.

I tried compiling hummingbird using Swift 6 and the static Linux sdx using these instructions.

I got the following errors. Though I'm not sure how to fix them just yet.

.../hummingbird/Sources/Hummingbird/Environment.swift:113:27: error: value of optional type 'UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?' (aka 'Optional<UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>>') must be unwrapped to refer to member 'advanced' of wrapped base type 'UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>' (aka 'UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>')
111 |         var idx = 0
112 | 
113 |         while let entry = envp.advanced(by: idx).pointee {
    |                           |- error: value of optional type 'UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>?' (aka 'Optional<UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>>') must be unwrapped to refer to member 'advanced' of wrapped base type 'UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>' (aka 'UnsafeMutablePointer<Optional<UnsafeMutablePointer<Int8>>>')
    |                           |- note: chain the optional using '?' to access member 'advanced' only for non-'nil' base values
    |                           `- note: force-unwrap using '!' to abort execution if the optional value contains 'nil'
114 |             let entry = String(cString: entry)
115 |             if let i = entry.firstIndex(of: equalSign) {
hummingbird/Sources/Hummingbird/Environment.swift:110:20: warning: reference to var 'environ' is not concurrency-safe because it involves shared mutable state; this is an error in the Swift 6 language mode
108 |         var values: [String: String] = [:]
109 |         let equalSign = Character("=")
110 |         let envp = environ
    |                    `- warning: reference to var 'environ' is not concurrency-safe because it involves shared mutable state; this is an error in the Swift 6 language mode
111 |         var idx = 0
112 | 

posix_unistd.environ:1:12: note: var declared here
1 | public var environ: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>!
  |            `- note: var declared here
[552/555] Compiling Hummingbird Application.swift

This is on the main branch of hummingbird a1028d2 and compiling the project using swift build --swift-sdk x86_64-swift-linux-musl -c release

Compiler and SDK
swift-6.0-DEVELOPMENT-SNAPSHOT-2024-07-21-a-osx.pkg
swift-6.0-DEVELOPMENT-SNAPSHOT-2024-07-02-a_static-linux-0.0.1.artifactbundle.tar

Thanks,
Zane

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions