rustyrussell / secp256k1-py

Python FFI bindings for libsecp256k1 (maintained)
MIT License
56 stars 12 forks source link

Can't build on macOS 14.2.1 - ld: archive member '/' not a mach-o file #15

Open jooray opened 9 months ago

jooray commented 9 months ago

Trying pip install secp256k1

Tried with homebrew python 3.10, 3.11 and 3.12.1

Collecting secp256k1
  Using cached secp256k1-0.14.0.tar.gz (2.4 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting cffi>=1.3.0 (from secp256k1)
  Using cached cffi-1.16.0-cp312-cp312-macosx_11_0_arm64.whl.metadata (1.5 kB)
Collecting pycparser (from cffi>=1.3.0->secp256k1)
  Using cached pycparser-2.21-py2.py3-none-any.whl (118 kB)
Using cached cffi-1.16.0-cp312-cp312-macosx_11_0_arm64.whl (177 kB)
Building wheels for collected packages: secp256k1
  Building wheel for secp256k1 (pyproject.toml): started
  Building wheel for secp256k1 (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error

  × Building wheel for secp256k1 (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [234 lines of output]
      0.29.2
      Using bundled libsecp256k1
      running bdist_wheel
      The [wheel] section is deprecated. Use [bdist_wheel] instead.
      running build
      running build_py
      creating build
      creating build/lib.macosx-14-arm64-cpython-312
      creating build/lib.macosx-14-arm64-cpython-312/secp256k1
      copying secp256k1/__init__.py -> build/lib.macosx-14-arm64-cpython-312/secp256k1
      copying secp256k1/__main__.py -> build/lib.macosx-14-arm64-cpython-312/secp256k1
      running build_clib
      Building experimental
      checking build system type... arm-apple-darwin23.2.0
      checking host system type... arm-apple-darwin23.2.0
      checking for a BSD-compatible install... /opt/homebrew/bin/ginstall -c
      checking whether build environment is sane... yes
      checking for a thread-safe mkdir -p... /opt/homebrew/bin/gmkdir -p
      checking for gawk... no
      checking for mawk... no
      checking for nawk... no
      checking for awk... awk
      checking whether make sets $(MAKE)... yes
      checking whether make supports nested variables... yes
      checking how to print strings... printf
      checking whether make supports the include directive... yes (GNU style)
      checking for gcc... gcc
      checking whether the C compiler works... yes
      checking for C compiler default output file name... a.out
      checking for suffix of executables...
      checking whether we are cross compiling... no
      checking for suffix of object files... o
      checking whether we are using the GNU C compiler... yes
      checking whether gcc accepts -g... yes
      checking for gcc option to accept ISO C89... none needed
      checking whether gcc understands -c and -o together... yes
      checking dependency style of gcc... none
      checking for a sed that does not truncate output... /opt/homebrew/bin/gsed
      checking for grep that handles long lines and -e... /opt/homebrew/bin/ggrep
      checking for egrep... /opt/homebrew/bin/ggrep -E
      checking for fgrep... /opt/homebrew/bin/ggrep -F
      checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
      checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
      checking for BSD- or MS-compatible name lister (nm)... /opt/homebrew/bin/nm -B
      checking the name lister (/opt/homebrew/bin/nm -B) interface... BSD nm
      checking whether ln -s works... yes
      checking the maximum length of command line arguments... 786432
      checking how to convert arm-apple-darwin23.2.0 file names to arm-apple-darwin23.2.0 format... func_convert_file_noop
      checking how to convert arm-apple-darwin23.2.0 file names to toolchain format... func_convert_file_noop
      checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
      checking for objdump... objdump
      checking how to recognize dependent libraries... pass_all
      checking for dlltool... dlltool
      checking how to associate runtime and link libraries... printf %s\n
      checking for ar... ar
      checking for archiver @FILE support... @
      checking for strip... strip
      checking for ranlib... ranlib
      checking command to parse /opt/homebrew/bin/nm -B output from gcc object... ok
      checking for sysroot... no
      checking for a working dd... /bin/dd
      checking how to truncate binary pipes... /bin/dd bs=4096 count=1
      checking for mt... no
      checking if : is a manifest tool... no
      checking for dsymutil... dsymutil
      checking for nmedit... nmedit
      checking for lipo... lipo
      checking for otool... otool
      checking for otool64... no
      checking for -single_module linker flag... ld: warning: -single_module is obsolete
      no
      checking for -exported_symbols_list linker flag... yes
      checking for -force_load linker flag... no
      checking how to run the C preprocessor... gcc -E
      checking for ANSI C header files... yes
      checking for sys/types.h... yes
      checking for sys/stat.h... yes
      checking for stdlib.h... yes
      checking for string.h... yes
      checking for memory.h... yes
      checking for strings.h... yes
      checking for inttypes.h... yes
      checking for stdint.h... yes
      checking for unistd.h... yes
      checking for dlfcn.h... yes
      checking for objdir... .libs
      checking if gcc supports -fno-rtti -fno-exceptions... yes
      checking for gcc option to produce PIC... -fno-common -DPIC
      checking if gcc PIC flag -fno-common -DPIC works... yes
      checking if gcc static flag -static works... no
      checking if gcc supports -c -o file.o... yes
      checking if gcc supports -c -o file.o... (cached) yes
      checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
      checking dynamic linker characteristics... darwin23.2.0 dyld
      checking how to hardcode library paths into programs... immediate
      checking whether stripping libraries is possible... yes
      checking if libtool supports shared libraries... yes
      checking whether to build shared libraries... no
      checking whether to build static libraries... yes
      checking whether make supports nested variables... (cached) yes
      checking for pkg-config... /opt/homebrew/bin/pkg-config
      checking pkg-config is at least version 0.9.0... yes
      checking for ar... /opt/homebrew/bin/ar
      checking for ranlib... /opt/homebrew/bin/ranlib
      checking for strip... /opt/homebrew/bin/strip
      checking for gcc option to accept ISO C89... (cached) none needed
      checking dependency style of gcc... none
      checking for brew... brew
      checking if gcc supports -Werror=unknown-warning-option... yes
      checking if gcc supports -std=c89 -pedantic -Wno-long-long -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef... yes
      checking if gcc supports -Wno-overlength-strings... yes
      checking if gcc supports -Wall... yes
      checking if gcc supports -Wno-unused-function... yes
      checking if gcc supports -Wextra... yes
      checking if gcc supports -Wcast-align... yes
      checking if gcc supports -Wcast-align=strict... no
      checking if gcc supports -Wconditional-uninitialized... yes
      checking if gcc supports -fvisibility=hidden... yes
      checking valgrind/memcheck.h usability... no
      checking valgrind/memcheck.h presence... no
      checking for valgrind/memcheck.h... no
      checking for x86_64 assembly availability... no
      configure: ******
      configure: WARNING: experimental build
      configure: Experimental features do not have stable APIs or properties, and may not be safe for production use.
      configure: Building extrakeys module: yes
      configure: Building schnorrsig module: yes
      configure: ******
      checking that generated files are newer than configure... done
      configure: creating ./config.status
      config.status: creating Makefile
      config.status: creating libsecp256k1.pc
      config.status: creating src/libsecp256k1-config.h
      config.status: executing depfiles commands
      config.status: executing libtool commands

      Build Options:
        with ecmult precomp     = yes
        with external callbacks = no
        with benchmarks         = yes
        with tests              = yes
        with coverage           = no
        module ecdh             = yes
        module recovery         = yes
        module extrakeys        = yes
        module schnorrsig       = yes

        asm                     = no
        ecmult window size      = 15
        ecmult gen prec. bits   = 4

        valgrind                = no
        CC                      = gcc
        CPPFLAGS                = -I/opt/homebrew/opt/valgrind/include
        SECP_CFLAGS             = -O2  -std=c89 -pedantic -Wno-long-long -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef -Wno-overlength-strings -Wall -Wno-unused-function -Wextra -Wcast-align -Wconditional-uninitialized -fvisibility=hidden
        CFLAGS                  = -g -O2
        LDFLAGS                 =

        CC_FOR_BUILD            = gcc
        CPPFLAGS_FOR_BUILD      = -I/opt/homebrew/opt/valgrind/include
        SECP_CFLAGS_FOR_BUILD   = -O2  -std=c89 -pedantic -Wno-long-long -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef -Wno-overlength-strings -Wall -Wno-unused-function -Wextra -Wcast-align -Wconditional-uninitialized -fvisibility=hidden
        CFLAGS_FOR_BUILD        = -g -O2
        LDFLAGS_FOR_BUILD       =
        CC       src/bench_verify.o
      gcc -DHAVE_CONFIG_H -I/opt/homebrew/opt/valgrind/include  -I/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-install-4_r9ygti/secp256k1_bf6af5ed5498493dacf2b8690bff935f/libsecp256k1 -I./src -O2  -std=c89 -pedantic -Wno-long-long -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef -Wno-overlength-strings -Wall -Wno-unused-function -Wextra -Wcast-align -Wconditional-uninitialized -fvisibility=hidden  -g -O2 -c /private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-install-4_r9ygti/secp256k1_bf6af5ed5498493dacf2b8690bff935f/libsecp256k1/src/gen_context.c -o gen_context.o
      gcc -O2  -std=c89 -pedantic -Wno-long-long -Wnested-externs -Wshadow -Wstrict-prototypes -Wundef -Wno-overlength-strings -Wall -Wno-unused-function -Wextra -Wcast-align -Wconditional-uninitialized -fvisibility=hidden  -g -O2  gen_context.o -o gen_context
      ./gen_context
        CC       src/libsecp256k1_la-secp256k1.lo
      In file included from /private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-install-4_r9ygti/secp256k1_bf6af5ed5498493dacf2b8690bff935f/libsecp256k1/src/secp256k1.c:20:
      /private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-install-4_r9ygti/secp256k1_bf6af5ed5498493dacf2b8690bff935f/libsecp256k1/src/ecdsa_impl.h:312:12: warning: use of bitwise '&' with boolean operands [-Wbitwise-instead-of-logical]
          return !secp256k1_scalar_is_zero(sigr) & !secp256k1_scalar_is_zero(sigs);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                                 &&
      /private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-install-4_r9ygti/secp256k1_bf6af5ed5498493dacf2b8690bff935f/libsecp256k1/src/ecdsa_impl.h:312:12: note: cast one or both operands to int to silence this warning
      1 warning generated.
        CCLD     libsecp256k1.la
        CCLD     bench_verify
      ld: archive member '/' not a mach-o file in '/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/tmp9fad39x0/.libs/libsecp256k1.a'
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      make: *** [bench_verify] Error 1
      Traceback (most recent call last):
        File "/Users/user/projects/cashu/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/user/projects/cashu/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/user/projects/cashu/venv/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 404, in build_wheel
          return self._build_with_temp_dir(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 389, in _build_with_temp_dir
          self.run_setup()
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 480, in run_setup
          super(_BuildMetaLegacyBackend, self).run_setup(setup_script=setup_script)
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
          exec(code, locals())
        File "<string>", line 265, in <module>
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup
          return distutils.core.setup(**attrs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
                 ^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 963, in run_command
          super().run_command(command)
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 112, in run
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/wheel/bdist_wheel.py", line 368, in run
          self.run_command("build")
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 963, in run_command
          super().run_command(command)
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/dist.py", line 963, in run_command
          super().run_command(command)
        File "/private/var/folders/79/vj3tpl0x40v10jwzbhvkw61c0000gp/T/pip-build-env-b0b90mkt/overlay/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "<string>", line 219, in run
        File "/opt/homebrew/Cellar/python@3.12/3.12.1/Frameworks/Python.framework/Versions/3.12/lib/python3.12/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['make']' returned non-zero exit status 2.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for secp256k1
Failed to build secp256k1