Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

undefined symbol: crypto_generichash_blake2b_salt_personal #281

Closed
JosephTico opened this issue Mar 28, 2017 · 17 comments
Closed

undefined symbol: crypto_generichash_blake2b_salt_personal #281

JosephTico opened this issue Mar 28, 2017 · 17 comments

Comments

@JosephTico
Copy link

JosephTico commented Mar 28, 2017

After installing PyNaCl with pip3.5 on Centos 6 and trying to import nacl.secret from a Python script, I get the following error:

Traceback (most recent call last):
  File "test.py", line 1, in <module>
    import nacl.secret
  File "/usr/lib64/python3.5/site-packages/nacl/secret.py", line 17, in <module>
    import nacl.bindings
  File "/usr/lib64/python3.5/site-packages/nacl/bindings/__init__.py", line 17, in <module>
    from nacl.bindings.crypto_box import (
  File "/usr/lib64/python3.5/site-packages/nacl/bindings/crypto_box.py", line 18, in <module>
    from nacl._sodium import ffi, lib
ImportError: /usr/lib64/python3.5/site-packages/nacl/_sodium.cpython-35m-x86_64-linux-gnu.so: undefined symbol: crypto_generichash_blake2b_salt_personal
@lmctv
Copy link
Contributor

lmctv commented Mar 28, 2017

Would you mind trying to execute the

$ ldd /usr/lib64/python3.5/site-packages/nacl/_sodium.cpython-35m-x86_64-linux-gnu.so

command on that system, to try and see which version of the sodium library is getting dynamically linked to pynacl bindings?

In as much as I know, recent versions of pynacl should statically link the vendored version of libsodium at build time, unless you specifically set the environment variable SODIUM_INSTALL=system while building.

@JosephTico
Copy link
Author

This is what I'm getting:

ldd /usr/lib64/python3.5/site-packages/nacl/_sodium.cpython-35m-x86_64-linux-gnu.so

    linux-vdso.so.1 =>  (0x000069d830b69000)
    libsodium.so.4 => /usr/lib64/libsodium.so.4 (0x000069d8306d0000)
    libpython3.5m.so.1.0 => /usr/lib64/libpython3.5m.so.1.0 (0x000069d830200000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x000069d82ffe0000)
    libc.so.6 => /lib64/libc.so.6 (0x000069d82fc48000)
    libm.so.6 => /lib64/libm.so.6 (0x000069d82f9c0000)
    librt.so.1 => /lib64/librt.so.1 (0x000069d82f7b8000)
    libdl.so.2 => /lib64/libdl.so.2 (0x000069d82f5b0000)
    libutil.so.1 => /lib64/libutil.so.1 (0x000069d82f3a8000)
    /lib64/ld-linux-x86-64.so.2 (0x000069d830b48000)

Looks like it's binding to the system /usr/lib64/libsodium.so? And I'm using the latest 1.1.1 version without any environment variables. Could this be related to #179?

@lmctv
Copy link
Contributor

lmctv commented Mar 28, 2017

Yes, for some reason, the module is linked to the system's libsodium. Did you save the output from pip install, or can you repeat the installation with

$ pip uninstall pynacl
$ pip install --log /tmp/nacl_install.log pynacl

If you're in a hurry, you could just uninstall the system's libsodium-devel package to force building with the bundled version.

@JosephTico
Copy link
Author

This is the output I get from the log: https://pastebin.com/dMugw5Nw

@lmctv
Copy link
Contributor

lmctv commented Mar 28, 2017

Could you try to swap the library path order by manually doing a

gcc -pthread -shared build/temp.linux-x86_64-3.5/build/temp.linux-x86_64-3.5/_sodium.o -Lbuild/temp.linux-x86_64-3.5/lib -Lbuild/temp.linux-x86_64-3.5.  -L/usr/lib64  -lsodium -lpython3.5m -lsodium -o build/lib.linux-x86_64-3.5/nacl/_sodium.cpython-35m-x86_64-linux-gnu.so

Inside the build directory, if it hasn't been already removed?

@JosephTico
Copy link
Author

I didn't find a way to keep pip build files after finishing installing, so I went away and renamed the system libsodium.so before installing PyNaCl and it finally worked.

@lmctv
Copy link
Contributor

lmctv commented Mar 29, 2017

OK, thank you for you patience; if you don't mind, I'll contact you in some days to try and test if a patch I've in mind would solve this problem.

@lmctv
Copy link
Contributor

lmctv commented Mar 29, 2017

@Josephvb10 I'd be grateful if you could try and rebuild the changed "release" available at https://github.com/lmctv/pynacl/archive/v1.2.a0.reorder.zip
after fixing the installation of libsodium-devel package renaming back the system libsodium.so to its correct name.

You could just download the zip or tar.gz compressed file from https://github.com/lmctv/pynacl/releases/tag/v1.2.a0.reorder , extract its contents and then do a

$ pip install .

from within the extracted directory.

Thank you very much.

@lmctv
Copy link
Contributor

lmctv commented Mar 30, 2017

@yurivict would you mind verifying if https://github.com/lmctv/pynacl/archive/v1.2.a0.reorder.zip solves issue #179 on freebsd?

@yurivict
Copy link

@lmctv Yes, it solves the issue on freebsd.

@JosephTico
Copy link
Author

Yup, can confirm this fixes the issue.

@lmctv
Copy link
Contributor

lmctv commented Mar 30, 2017

Thank you very much for your help.

@lmctv
Copy link
Contributor

lmctv commented Mar 31, 2017

@yurivict @Josephvb10 would you mind trying to do a simple

pip install pynacl 

to check the just released 1.1.2 solves the problems you were experiencing (after making sure the system libsodium.so is still present) and if so close your respective bugs?

@yurivict
Copy link

@lmctv 1.1.2 builds, but tests fail ( #286 ) so I couldn't verify that it works.

@lmctv
Copy link
Contributor

lmctv commented Mar 31, 2017

@yurivict since I know next to nothing about freebsd build system, I'd be grateful if you could try and see if the expected artifacts have been left inside the build subdirectory. If so, please try to manually run the tests with pytest, adding build/lib... to PYTHONPATH. If at all possible, and you are so inclined, I could send you an ephemeral ssh public key, which you could authorize to login to the build system to try and take a look at the artifacts myself.

P.S. from the path I'm seeing, it seems you are not building a "traditional" package, but you are dealing with a ports Makefile instead.

@yurivict
Copy link

@lmctv It builds fine now in build/, and passes tests too.
The only problem is that due to #286 tests use the installed version, not the freshly built one. IMO, this is a bug.

You can close this bug now IMO.

@lmctv
Copy link
Contributor

lmctv commented Apr 7, 2017

@Josephvb10 could you please retry the pip install on the affected system, and close this issue if all is well?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants