nuclearace / SwiftDiscord

Discord API Client for Swift
MIT License
120 stars 25 forks source link

Compiling fails with error #75

Open iComputerfreak opened 5 years ago

iComputerfreak commented 5 years ago

When compiling a new SwiftPM project with your library it fails with the following errors

<ProjectPath>/.build/checkouts/SwiftDiscord--7968038837483286921/Sources/SwiftDiscord/Voice/DiscordVoiceEngine.swift:235:96: error: cannot convert value of type '[UInt8]' to expected argument type 'UInt8'
        let success = crypto_secretbox_easy(encrypted, &buf, UInt64(buf.count), &nonce, &secret!)
                                                                                         ~~~~~~^
<ProjectPath>/.build/checkouts/SwiftDiscord--7968038837483286921/Sources/SwiftDiscord/Voice/DiscordVoiceEngine.swift:255:114: error: cannot convert value of type '[UInt8]' to expected argument type 'UInt8'
        let success = crypto_secretbox_open_easy(unencrypted, voiceData, UInt64(data.count - 12), &nonce, &secret!)
                                                                                                           ~~~~~~^
error: terminated(1): /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f '<ProjectPath>/.build/debug.yaml' main output:

Here is my full output when I run the compile command: https://pastebin.com/vUrpzfQS

My main.swift only contains this:

import SwiftDiscord

print("Hello, world!")

First I used version 6.0.0 of your library, like suggested in the README.md, but now I tried 9.0.0, which doesn't work either. I am using Swift 4 on macOS, but I tried it on Linux Ubuntu 16.04 too.

nuclearace commented 5 years ago

What version of sodium got installed?

Also FYI, this project has been a bit lacking in maintenance recently since I've been busy with work, but I'm hoping to start back into it soon. In the meantime, you might want to also check out https://github.com/azoy/sword.

iComputerfreak commented 5 years ago

According to Package.resolved, Sodium version 2.0.0.

{
  "package": "Sodium",
  "repositoryURL": "https://github.com/nuclearace/Sodium",
  "state": {
    "branch": null,
    "revision": "5812a3d879b77aae0fdfbd62d0e8354e914d15ae",
    "version": "2.0.0"
  }
}

But brew installed version 1.0.17 and on Ubuntu I used the libsodium-stable-2019-01-30.tar.gz (which seems to be 1.0.17 as well)

iComputerfreak commented 5 years ago

I will check out Sword, but I would prefer to use your library, since it has a much better documentation.