ofek/coincurve

libsecp256k1.dll on a non-Windows system

nixbitcoin opened this issue · 19 comments

I'm getting

gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/nix/store/mylvss4yxf3ljsyxh3wbyx2liy6x7gbr-python3-3.7.4/include/python3.7m -Ibuild/temp.linux-x86_64-3.7/include -c build/temp.linux-x86_64-3.7/_libsecp256k1.c -o build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o
gcc -pthread -shared -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.7/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.4/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.2.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.28.0/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.1-20190112/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.0.2s/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.7/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.4/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.2.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.28.0/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.1-20190112/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.0.2s/lib build/temp.linux-x86_64-3.7/build/temp.linux-x86_64-3.7/_libsecp256k1.o -Lbuild/temp.linux-x86_64-3.7/lib -L/nix/store/mylvss4yxf3ljsyxh3wbyx2liy6x7gbr-python3-3.7.4/lib -Lbuild/temp.linux-x86_64-3.7 -lsecp256k1 -lpython3.7m -lsecp256k1 -o /tmp/nix-build-python3.7-coincurve-12.0.0.drv-0/coincurve-12.0.0/coincurve/_libsecp256k1.cpython-37m-x86_64-linux-gnu.so
error: cannot load library '/tmp/nix-build-python3.7-coincurve-12.0.0.drv-0/coincurve-12.0.0/coincurve/libsecp256k1.dll': /tmp/nix-build-python3.7-coincurve-12.0.0.drv-0/coincurve-12.0.0/coincurve/libsecp256k1.dll: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/tmp/nix-build-python3.7-coincurve-12.0.0.drv-0/coincurve-12.0.0/coincurve/libsecp256k1.dll'
builder for '/nix/store/3yqppzk28422x8gb83azzb7skg9f8g61-python3.7-coincurve-12.0.0.drv' failed with exit code 1
cannot build derivation '/nix/store/hbhmdzqjmh4iba8nxa92jswjzxy9ji2b-python3.7-joinmarketbitcoin-0.5.4.drv': 1 dependencies couldn't be built
error: build of '/nix/store/hbhmdzqjmh4iba8nxa92jswjzxy9ji2b-python3.7-joinmarketbitcoin-0.5.4.drv' failed

While trying to package coincurve for NixOS. Why would coincurve need a libsecp256k1.dll on a non-Windows system?

This is my nix expression currently

{ lib, buildPythonPackage, fetchPypi, asn1crypto, cffi, pkg-config, libtool, libffi, requests }:

buildPythonPackage rec {
  pname = "coincurve";
  version = "12.0.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "901009df491ff042e666f0b1afa9b40ffd9db0608be7ced4f5572e068d933dbb";
  };

  checkInputs = [ pkg-config ];

  propagatedBuildInputs = [ asn1crypto cffi pkg-config libtool libffi requests ];

}

I'm facing the same issue.

I ran into this issue independently while trying to package bitcash which depends on coincurve.

ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.33.0/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1h/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-configd-osx-10.8.5/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.33.0/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1h/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-configd-osx-10.8.5/lib'
error: cannot load library '/private/tmp/nix-build-python3.8-coincurve-13.0.0.drv-0/coincurve-13.0.0/coincurve/libsecp256k1.dll': dlopen(/private/tmp/nix-build-python3.8-coincurve-13.0.0.drv-0/coincurve-13.0.0/coincurve/libsecp256k1.dll, 2): image not found.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/private/tmp/nix-build-python3.8-coincurve-13.0.0.drv-0/coincurve-13.0.0/coincurve/libsecp256k1.dll'
builder for '/nix/store/3l724riwwkxbqw1d35zb0bpqwpscf8x4-python3.8-coincurve-13.0.0.drv' failed with exit code 1
error: build of '/nix/store/3l724riwwkxbqw1d35zb0bpqwpscf8x4-python3.8-coincurve-13.0.0.drv' failed
ofek commented

Can someone please give me an easy way to reproduce the error?

@ofek It involves the package failing to find libraries when being built with Nix. To replicate,

Install the Nix package manager, save the following file into default.nix in a folder somewhere. Navigate to the folder and run nix-build.

{ pkgs ? import <nixpkgs> { }}:
with pkgs;

python3Packages.callPackage
({ lib, buildPythonPackage, fetchPypi, asn1crypto, cffi, pkg-config, libtool, libffi, requests }:

buildPythonPackage rec {
  pname = "coincurve";
  version = "13.0.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "1x8dpbq6bwswfyi1g4r421hnswp904l435rf7n6fj7y8q1yn51cr";
  };

  checkInputs = [ pkg-config ];

  propagatedBuildInputs = [ asn1crypto cffi pkg-config libtool libffi requests ];
}) {}

@ofek were you able to replicate the error?

ofek commented

Yup, dunno why yet

building '_libsecp256k1' extension
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/nix/store/2wwb85hrvvfzkhrlwcj3pqi60nlbi9cq-python3-3.8.7/include/python3.8 -Ibuild/temp.linux-x86_64-3.8/include -c build/temp.linux-x86_64-3.8/_libsecp256k1.c -o build/temp.linux-x86_64-3.8/build/temp.linux-x86_64-3.8/_libsecp256k1.o
gcc -shared -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.19/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.34.0/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1i/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.19/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.34.0/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1i/lib build/temp.linux-x86_64-3.8/build/temp.linux-x86_64-3.8/_libsecp256k1.o -Lbuild/temp.linux-x86_64-3.8/lib -L/nix/store/2wwb85hrvvfzkhrlwcj3pqi60nlbi9cq-python3-3.8.7/lib -Lbuild/temp.linux-x86_64-3.8 -lsecp256k1 -lsecp256k1 -o /build/coincurve-13.0.0/coincurve/_libsecp256k1.cpython-38-x86_64-linux-gnu.so
error: cannot load library '/build/coincurve-13.0.0/coincurve/libsecp256k1.dll': /build/coincurve-13.0.0/coincurve/libsecp256k1.dll: cannot open shared object file: No such file or directory.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/build/coincurve-13.0.0/coincurve/libsecp256k1.dll'
builder for '/nix/store/6ns1b60a3x5pkfsnmlxmzfcfc6mf8slm-python3.8-coincurve-13.0.0.drv' failed with exit code 1
error: build of '/nix/store/6ns1b60a3x5pkfsnmlxmzfcfc6mf8slm-python3.8-coincurve-13.0.0.drv' failed
ofek commented

@siraben can you try with 14.0.0?

The expression changes a bit because of the introduction of autoconf and automake, but the error is the same

{ pkgs ? import <nixpkgs> { }}:
with pkgs;

python3Packages.callPackage
({ lib, buildPythonPackage, fetchPypi, asn1crypto, cffi, pkgconfig, autoconf, automake, libtool, libffi, requests }:

buildPythonPackage rec {
  pname = "coincurve";
  version = "14.0.0";

  src = fetchPypi {
    inherit pname version;
    sha256 = "0j3z7p5l14zwdwij3vhpag134d8w1ixjqn3splvicbrcf45czd3v";
  };

  nativeBuildInputs = [ autoconf automake libtool ];
  propagatedBuildInputs = [ asn1crypto pkgconfig cffi libffi requests ];
}) {}
build log
building '_libsecp256k1' extension
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/cf88yvm21kwal2bvgk8pgyjsbw3v0ixj-python3-3.8.6/include/python3.8 -Ibuild/temp.macosx-10.6-x86_64-3.8/include -c build/temp.macosx-10.6-x86_64-3.8/_libsecp256k1.c -o build/temp.macosx-10.6-x86_64-3.8/build/temp.macosx-10.6-x86_64-3.8/_libsecp256k1.o
clang-7: warning: argument unused during compilation: '-fno-strict-overflow' [-Wunused-command-line-argument]
clang -bundle -undefined dynamic_lookup -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.34.0/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1i/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-configd-osx-10.8.5/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.34.0/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1i/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-configd-osx-10.8.5/lib build/temp.macosx-10.6-x86_64-3.8/build/temp.macosx-10.6-x86_64-3.8/_libsecp256k1.o -Lbuild/temp.macosx-10.6-x86_64-3.8/lib -L/nix/store/cf88yvm21kwal2bvgk8pgyjsbw3v0ixj-python3-3.8.6/lib -Lbuild/temp.macosx-10.6-x86_64-3.8 -lsecp256k1 -lsecp256k1 -o /private/tmp/nix-build-python3.8-coincurve-14.0.0.drv-0/coincurve-14.0.0/coincurve/_libsecp256k1.cpython-38-darwin.so
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.34.0/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1i/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-configd-osx-10.8.5/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.34.0/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1i/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-configd-osx-10.8.5/lib'
error: cannot load library '/private/tmp/nix-build-python3.8-coincurve-14.0.0.drv-0/coincurve-14.0.0/coincurve/libsecp256k1.dll': dlopen(/private/tmp/nix-build-python3.8-coincurve-14.0.0.drv-0/coincurve-14.0.0/coincurve/libsecp256k1.dll, 2): image not found.  Additionally, ctypes.util.find_library() did not manage to locate a library called '/private/tmp/nix-build-python3.8-coincurve-14.0.0.drv-0/coincurve-14.0.0/coincurve/libsecp256k1.dll'
builder for '/nix/store/5hnbfm3h59iz7n72lcvcwjzxzk745l42-python3.8-coincurve-14.0.0.drv' failed with exit code 1
error: build of '/nix/store/5hnbfm3h59iz7n72lcvcwjzxzk745l42-python3.8-coincurve-14.0.0.drv' failed
ofek commented

Is there a way to build from a local path rather than from PyPI?

Yes, I can change the source to the GitHub repository.

ofek commented

Can you try removing coincurve/_windows_libsecp256k1.py?

That worked! Here's the final expression

{ pkgs ? import <nixpkgs> { }}:
with pkgs;

python3Packages.callPackage
({ lib, buildPythonPackage, fetchFromGitHub, pytest, asn1crypto, cffi, pkgconfig, autoconf, automake, libtool, libffi, requests }:

  buildPythonPackage rec {
    pname = "coincurve";
    version = "14.0.0";

    src = fetchFromGitHub {
      owner = "ofek";
      repo = "coincurve";
      rev = "v${version}";
      sha256 = "0z765x9vpb82nx9d0kvqknyl5ad4fldha3nqsx1cydghskdd100r";
    };

    postPatch = ''
      rm coincurve/_windows_libsecp256k1.py
    '';

    checkInputs = [ pytest ];
    nativeBuildInputs = [ autoconf automake libtool ];
    propagatedBuildInputs = [ asn1crypto pkgconfig cffi libffi requests ];
    
  }) {}

There should be some conditional logic so that _windows_libsecp256k1.py is not loaded on a non-Windows system.

ofek commented

I don't know why it's happening only with nix

The messages haven't gone all away:

Processing ./coincurve-14.0.0-cp38-cp38-macosx_10_12_x86_64.whl
Requirement already satisfied: cffi>=1.3.0 in /nix/store/5rjbj02vz0yl0pf4qn6gfzg4mfy1s09h-python3.8-cffi-1.14.3/lib/python3.8/site-packages (from coincurve==14.0.0) (1.14.3)
Requirement already satisfied: asn1crypto in /nix/store/qa494prnswxfy0d4fwx55dasm4gc96hc-python3.8-asn1crypto-1.4.0/lib/python3.8/site-packages (from coincurve==14.0.0) (1.4.0)
Requirement already satisfied: pycparser in /nix/store/fvnclblm1mran7flcwfj688i434d6s6p-python3.8-pycparser-2.20/lib/python3.8/site-packages (from cffi>=1.3.0->coincurve==14.0.0) (2.20)
Installing collected packages: coincurve
Successfully installed coincurve-14.0.0
/private/tmp/nix-build-python3.8-coincurve-14.0.0.drv-0/source
Finished executing pipInstallPhase
post-installation fixup
strip is /nix/store/l5707pca91sq99fd5fq4x84302zssyjj-cctools-binutils-darwin-949.0.1/bin/strip
stripping (with command strip and flags -S) in /nix/store/6aac4wrfcpywnnz6rq0jbsyycy33dsfr-python3.8-coincurve-14.0.0/lib 
patching script interpreter paths in /nix/store/6aac4wrfcpywnnz6rq0jbsyycy33dsfr-python3.8-coincurve-14.0.0
Executing pythonRemoveTestsDir
Finished executing pythonRemoveTestsDir
running install tests
no Makefile or custom installCheckPhase, doing nothing
pythonCatchConflictsPhase
pythonRemoveBinBytecodePhase
pythonImportsCheckPhase
Executing pythonImportsCheckPhase
setuptoolsCheckPhase
Executing setuptoolsCheckPhase
running test
WARNING: Testing via this command is deprecated and will be removed in a future version. Users looking for a generic test entry point independent of test runner are encouraged to use tox.
running egg_info
writing coincurve.egg-info/PKG-INFO
writing dependency_links to coincurve.egg-info/dependency_links.txt
writing requirements to coincurve.egg-info/requires.txt
writing top-level names to coincurve.egg-info/top_level.txt
reading manifest file 'coincurve.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'coincurve.egg-info/SOURCES.txt'
running build_ext
generating cffi module 'build/temp.macosx-10.6-x86_64-3.8/_libsecp256k1.c'
already up-to-date
building '_libsecp256k1' extension
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/nix/store/0mabx9absir73mmijrsv0dsyvyya463r-python3-3.8.6/include/python3.8 -Ibuild/temp.macosx-10.6-x86_64-3.8/include -c build/temp.macosx-10.6-x86_64-3.8/_libsecp256k1.c -o build/temp.macosx-10.6-x86_64-3.8/build/temp.macosx-10.6-x86_64-3.8/_libsecp256k1.o
clang-7: warning: argument unused during compilation: '-fno-strict-overflow' [-Wunused-command-line-argument]
clang -bundle -undefined dynamic_lookup -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.33.0/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1h/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-configd-osx-10.8.5/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.33.0/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1h/lib -L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-configd-osx-10.8.5/lib build/temp.macosx-10.6-x86_64-3.8/build/temp.macosx-10.6-x86_64-3.8/_libsecp256k1.o -Lbuild/temp.macosx-10.6-x86_64-3.8/lib -L/nix/store/0mabx9absir73mmijrsv0dsyvyya463r-python3-3.8.6/lib -Lbuild/temp.macosx-10.6-x86_64-3.8 -lsecp256k1 -lsecp256k1 -o /private/tmp/nix-build-python3.8-coincurve-14.0.0.drv-0/source/coincurve/_libsecp256k1.cpython-38-darwin.so
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.33.0/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1h/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-configd-osx-10.8.5/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-zlib-1.2.11/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-bzip2-1.0.6.0.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-expat-2.2.10/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-xz-5.2.5/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-libffi-3.3/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-gdbm-1.18.1/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-sqlite-3.33.0/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-readline-6.3p08/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-ncurses-6.2/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-openssl-1.1.1h/lib'
ld: warning: directory not found for option '-L/nix/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee-configd-osx-10.8.5/lib'

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
Finished executing setuptoolsCheckPhase
pytestcachePhase
/nix/store/6aac4wrfcpywnnz6rq0jbsyycy33dsfr-python3.8-coincurve-14.0.0
ofek commented

Why is anything happening after Successfully installed coincurve-14.0.0?

Nix runs post-installation tasks and checks.

ofek commented

Ah okay. Any recommendations for clearing up those nix warnings?

I'll submit this to Nixpkgs and see if they can be resolved there.