FedericoCeratto / nim-libsodium

Nim wrapper for the libsodium library

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The sample test is searching for libsodium.so.18, I have libsodium.18.dylib

bobgus opened this issue · comments

I am using the sample test shown in the documentation.

import libsodium.sodium
import libsodium.sodium_sizes
let
msg = "hello and goodbye"
(pk, sk) = crypto_box_keypair()
nonce = randombytes(crypto_box_NONCEBYTES())
ciphertext = crypto_box_easy(msg, nonce, pk, sk)

Hmm, leading spaces get stripped..

I installed libsodium using brew install libsodium
This installation seemed to be a success.

On my Mac, I can see the pointers to the library:

air:Nim bobgus$ ls -l /usr/local/lib/libsodium.dylib
lrwxr-xr-x 1 bobgus admin 46 Nov 30 15:00 /usr/local/lib/libsodium.dylib -> ../Cellar/libsodium/1.0.11/lib/libsodium.dylib

air:Nim bobgus$ ls -l /usr/local/Cellar/libsodium/1.0.11/lib/libsodium.dylib
lrwxr-xr-x 1 bobgus admin 18 Nov 30 15:15 /usr/local/Cellar/libsodium/1.0.11/lib/libsodium.dylib -> libsodium.18.dylib

The error output is

air:Nim bobgus$ nim c -r -d:nimDebugDlOpen libsodium_test.nim
Hint: used config file '/Users/bobgus/Nim/config/nim.cfg' [Conf]
libsodium_test.nim(8, 3) Hint: 'ciphertext' is declared but not used [XDeclaredButNotUsed]
CC: stdlib_system
Hint: [Link]
Hint: operation successful (15188 lines compiled; 0.627 sec total; 21.504MiB; Debug Build) [SuccessX]
Hint: /Users/bobgus/Nim/libsodium_test [Exec]
dlopen(libsodium.so.18, 2): image not found
could not load: libsodium.so.18


I think I'm pretty close, but need some hints. Thanks much

Thanks for the bug report @bobgus - can you please try now?

@bobgus as you can probably imagine I don't have a mac os host at hand and I'm relying on TravisCI. The imports are fixed but one of the tests is failing: https://travis-ci.org/FedericoCeratto/nim-libsodium/builds/180682943 Can please test?

Looks good - seems to get the correct library for macosx. The little test runs with no errors (and no output, but none was requested)