pyca / pynacl

Python binding to the Networking and Cryptography (NaCl) library
https://pynacl.readthedocs.io/
Apache License 2.0
1.05k stars 228 forks source link

Pip installation fails on Debian Jessie. #473

Closed ecsumed closed 5 years ago

ecsumed commented 5 years ago

Pip installation fails on Debian Jessie.

The stack trace shows it to fail the following tests:

Testsuite summary for libsodium 1.0.15
============================================================================
# TOTAL: 70
# PASS:  68
# SKIP:  0
# XFAIL: 0
# FAIL:  2
# XPASS: 0
# ERROR: 0
/tmp/pip-build-Ml5ccI/pynacl/src/libsodium/build-aux/test-driver: line 107:  9118 Illegal instruction     "$@" > $log_file 2>&1
FAIL: pwhash_argon2i
/tmp/pip-build-Ml5ccI/pynacl/src/libsodium/build-aux/test-driver: line 107:  9124 Illegal instruction     "$@" > $log_file 2>&1
FAIL: pwhash_argon2id

Complete log here: https://gist.github.com/ecsumed/fab732e65d2c298be206a9f5ebd83424 Command: pip install pynacl

libsodium13:amd64                 1.0.0-1     
cffi==1.11.5
lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.11 (jessie)
Release:    8.11
Codename:   jessie
reaperhulk commented 5 years ago

I can't replicate this in a Jessie docker container locally. All the pynacl installer does is run ./configure && make && make check so if this is reproducible you should be able to download https://download.libsodium.org/libsodium/releases/libsodium-1.0.15.tar.gz and run that set of commands and see the same failure.

You can also get a precompiled binary that will work on your platform by upgrading your pip to the latest version (it is highly recommended that you do that in a virtualenv and leave the system packages alone)

ChristianUlbrich commented 5 years ago

Same here in a totally different environment (Alpine). It looks like a recent change in libsodium's ` build, namely testing needs some arcane shell magic, that only bash can accomplish and not dash. Dash is the default shell in Debian:Jessie.

Strangely enough I can only reproduce the error manually in Docker:

Will let tests pwhash_argon2i and pwhash_argon2id fail. The impact of this issue is bigger - a lot of packages depend on PyNacl - I had this error when building a Docker image for Ansible.

Nonetheless I think the error is upstream with libsodium. I am investigating further...

lmctv commented 5 years ago

Thanks for the update; please keep us posted.

ChristianUlbrich commented 5 years ago

I have filed an issue upstream -> https://github.com/jedisct1/libsodium/issues/776 although it seems, that the problem is not dash vs. bash, but the combination of CPU + BuildChain, because I cannot reproduce the error with docker on another machine (with the same Docker + macOS version).

@ecsumed What was your build environment? "Bare metal" or Docker? What CPU do you have?

lmctv commented 5 years ago

@ecsumed , @ChristianUlbrich is the docker container running on bare-metal, or in a virtual machine? In the latter case, which emulator is running the VM, and what kind of CPU is emulated? Is it possible there is some mismatch between the emulated CPU declared features, and their real runtime availability?

lmctv commented 5 years ago

@ecsumed @ChristianUlbrich if this is happening on a linux system, it is possible you can gain a bit more informations about the trapped instruction by executing dmesg just after the crash. @pyca/pynacl-core I'm inclined to close the bug here, since this happens before ever attempting to build the bindings.

reaperhulk commented 5 years ago

Agreed, this occurs in the test phase of libsodium so it's out of our scope for now.

ecsumed commented 5 years ago

@lmctv @ChristianUlbrich FYI In my case the build env was an AWS EC2 instance with Inter Xeon and without docker. I eventually switched to a local (Intel i3) docker based setup and it worked.