pypi2nix icon indicating copy to clipboard operation
pypi2nix copied to clipboard

pypi 'cryptography': pypi2nix builds, but requirements.nix not working

Open DavHau opened this issue 5 years ago • 1 comments

version: 2.0.2.dev10+ge0d70c5

The cryptography python library builds into a requirements.nix with this command: pypi2nix -V python37 -v -e cryptography -E "openssl" But running the requirements.nix fails:

$ nix run -f requirements.nix 
builder for '/nix/store/dq1c1i707smj3nfvs5zv2wcc3qplhn66-python3.7-cffi-1.13.2.drv' failed with exit code 1; last 10 log lines:
  running build_ext
  building '_cffi_backend' extension
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/c
  gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/nix/store/4c3z5r6yxsf2cxwwyazhdn92xixn4j5b-python3-3.7.5/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-x86_64-3.7/c/_cffi_backend.o
  c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
   #include <ffi.h>
            ^~~~~~~
  compilation terminated.
  error: command 'gcc' failed with exit status 1
cannot build derivation '/nix/store/hm86gj1nsm9armlmxz3ayvv8ziw614qf-python3.7-python37-interpreter.drv': 1 dependencies couldn't be built
[0 built (1 failed)]
error: build of '/nix/store/hm86gj1nsm9armlmxz3ayvv8ziw614qf-python3.7-python37-interpreter.drv' failed

It can be fixed by appending 'libffi' to the extra-build-inputs before building the requirements.nix. I'm not quite sure if this is considered an issue or not. Maybe I'm wrong but i would expect pypi2nix to fail during the generation of the requirements.nix if something was missing. I have some more examples of python libraries which are processed successfully by pypi2nix even though some required extra build inputs are missing. But i will await your response here first because I'm not sure if this is expected or not.

DavHau avatar Nov 18 '19 08:11 DavHau

Unfortunately there is no mechanism in place to catch scenarios like this, but I am open to suggestions or PRs addressing the issue with missing build inputs.

seppeljordan avatar Dec 08 '19 15:12 seppeljordan