toxcore icon indicating copy to clipboard operation
toxcore copied to clipboard

If sodium is installed, then it uses this...

Open cnngimenez opened this issue 10 years ago • 7 comments

... But if not uses the one included.

For some reason, on Fedora, compiling toxcore gives this error:

  CC       ../toxav/libtoxav_la-rtp.lo
../toxencryptsave/toxencryptsave.c:40:2: error: #error TOX_PASS_SALT_LENGTH is assumed to be equal to crypto_pwhash_scryptsalsa208sha256_SALTBYTES
 #error TOX_PASS_SALT_LENGTH is assumed to be equal to crypto_pwhash_scryptsalsa208sha256_SALTBYTES
  ^
../toxencryptsave/toxencryptsave.c:48:2: error: #error TOX_PASS_ENCRYPTION_EXTRA_LENGTH is assumed to be equal to (crypto_box_MACBYTES + crypto_box_NONCEBYTES + crypto_pwhash_scryptsalsa208sha256_SALTBYTES + TOX_ENC_SAVE_MAGIC_LENGTH)
 #error TOX_PASS_ENCRYPTION_EXTRA_LENGTH is assumed to be equal to (crypto_box_MACBYTES + crypto_box_NONCEBYTES + crypto_pwhash_scryptsalsa208sha256_SALTBYTES + TOX_ENC_SAVE_MAGIC_LENGT
  ^
../toxencryptsave/toxencryptsave.c: In function 'tox_get_salt':
../toxencryptsave/toxencryptsave.c:70:24: error: 'crypto_pwhash_scryptsalsa208sha256_SALTBYTES' undeclared (first use in this function)
     memcpy(salt, data, crypto_pwhash_scryptsalsa208sha256_SALTBYTES);
                        ^
../toxencryptsave/toxencryptsave.c:70:24: note: each undeclared identifier is reported only once for each function it appears in
../toxencryptsave/toxencryptsave.c: In function 'tox_derive_key_from_pass':
../toxencryptsave/toxencryptsave.c:88:18: error: 'crypto_pwhash_scryptsalsa208sha256_SALTBYTES' undeclared (first use in this function)
     uint8_t salt[crypto_pwhash_scryptsalsa208sha256_SALTBYTES];

This means that sodium's definitions are not included, so I added these lines and it worked fine.

cnngimenez avatar Sep 01 '15 03:09 cnngimenez

check the path libsodium builds fine as does toxcore on my Fedora 22

linux-modder avatar Sep 01 '15 16:09 linux-modder

I didn't build sodium from sources, I have it already from my repos(version 1.0.3)... But the precompiler doesn't add it anywhere: there's no #include <sodium.h>.

I understand that the VANILLA_NACL macro is defined when you don't have sodium installed at the ./configure step so the precompiler adds the one you downloaded and compiled by yourself (as says at the INSTALL.md here ).

But what happen when ./configure locate your system sodium and saves this undefined? the code says: just nothing... so I added the #else ... #include. I don't know if this is fine... but did the job.

If there's something I missed from the INSTALL.md, please tell me.

Maybe I should change the title: "If sodium is installed on your repos, just add it."

cnngimenez avatar Sep 01 '15 19:09 cnngimenez

@cnngimenez if you're still having this build issue, let me know and I'll track down the issue and decide what to do with this.

GrayHatter avatar Jan 02 '16 21:01 GrayHatter

@GrayHatter still having this issue. I have clonned the latest master b9ef24875ce1d9bf5f04f0164ae95f729330a295 and have the same error messages.

DNF says that libsodium is installed and:

Nombre      : libsodium
Arquitectur : x86_64
Epoch       : 0
Versión     : 1.0.5
Lanzamiento : 1.fc22

@linux-modder what did you do for compiling succesfully? I did this:

git clone --depth 1 https://github.com/irungentoo/toxcore.git toxcore2
cd toxcore2/
autoreconf -i
./configure 
make -j2

I tried even with make -j2 -I /usr/local/include/ (where sodium include files are) and the same error appear.

cnngimenez avatar Jan 15 '16 03:01 cnngimenez

Is this PR correct? Why is it only required on Fedora?

iphydf avatar Sep 22 '16 20:09 iphydf

@cnngimenez is this PR still required?

iphydf avatar Sep 29 '16 14:09 iphydf

I was getting the same error message when trying to compile tox 0.1.10 here in Gentoo land. Adding those three #include lines fixed things for me. (I have libsodium 1.0.16 installed.)

dennisnez avatar Mar 11 '18 22:03 dennisnez