Skip to content

Compile errors out of the box due to WebSocket.swift dependencies #45

Description

@rtyh12

I want to make a bot using DiscordKitBot. I'm on Ubuntu 24.04.

Adding DiscordKit as a dependency via SPM does not compile with the following error:

/path/to/project/.build/checkouts/swift-nio-ssl/Sources/NIOSSL/PosixPort.swift:42:64: error: cannot convert value of type '(UnsafeMutablePointer<FILE>) -> Int32' (aka '(UnsafeMutablePointer<_IO_FILE>) -> Int32') to specified type '@convention(c) (FILEPointer?) -> CInt' (aka '@convention(c) (Optional<UnsafeMutablePointer<_IO_FILE>>) -> Int32')
 40 | private let sysMlock: @convention(c) (UnsafeRawPointer?, size_t) -> CInt = mlock
 41 | private let sysMunlock: @convention(c) (UnsafeRawPointer?, size_t) -> CInt = munlock
 42 | private let sysFclose: @convention(c) (FILEPointer?) -> CInt = fclose
    |                                                                `- error: cannot convert value of type '(UnsafeMutablePointer<FILE>) -> Int32' (aka '(UnsafeMutablePointer<_IO_FILE>) -> Int32') to specified type '@convention(c) (FILEPointer?) -> CInt' (aka '@convention(c) (Optional<UnsafeMutablePointer<_IO_FILE>>) -> Int32')
 43 |
 44 | // Sadly, stat, lstat, and readlink have different signatures with glibc and macOS libc.

Something seems to go wrong when compiling swift-nio-ssl, which is an indirect dependency of DiscordKit (WebSocket.swift depends on swift-nio-ssl).

I cloned WebSocket.swift and updated the versions of both swift-nio and swift-nio-ssl in its Package.swift to the current latest versions (2.72.0 and 2.27.0 respectively) and now my bot compiles :D

Note that the same issue occurs when adding WebSocket.swift as a dependency by itself without DiscordKit. So this appears to be an issue with WebSocket.swift and I also opened an issue on their repo, but I think it's worth pointing out here too.

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