SwiftDiscord icon indicating copy to clipboard operation
SwiftDiscord copied to clipboard

Compiling fails with error

Open iComputerfreak opened this issue 6 years ago • 3 comments

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.

iComputerfreak avatar Jan 30 '19 14:01 iComputerfreak

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.

nuclearace avatar Jan 30 '19 15:01 nuclearace

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 avatar Jan 30 '19 15:01 iComputerfreak

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

iComputerfreak avatar Jan 30 '19 15:01 iComputerfreak