elixirapple-m1secp256k1

Run blockscout on M1 chip


I'm trying to run blockscout on my local machine (M1 chip). Following this guide, I'm getting this error:

Generated mix_erlang_tasks app
c_src/build_deps.sh
Cloning into 'secp256k1'...
remote: Enumerating objects: 8569, done.
remote: Counting objects: 100% (120/120), done.
remote: Compressing objects: 100% (75/75), done.
remote: Total 8569 (delta 62), reused 87 (delta 45), pack-reused 8449
Receiving objects: 100% (8569/8569), 9.43 MiB | 9.54 MiB/s, done.
Resolving deltas: 100% (5969/5969), done.
HEAD is now at d333521 Merge #494: Support OpenSSL versions >= 1.1 for ENABLE_OPENSSL_TESTS
glibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'.
glibtoolize: copying file 'build-aux/ltmain.sh'
glibtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build-aux/m4'.
glibtoolize: copying file 'build-aux/m4/libtool.m4'
glibtoolize: copying file 'build-aux/m4/ltoptions.m4'
glibtoolize: copying file 'build-aux/m4/ltsugar.m4'
glibtoolize: copying file 'build-aux/m4/ltversion.m4'
glibtoolize: copying file 'build-aux/m4/lt~obsolete.m4'
configure.ac:28: warning: The macro `AC_PROG_CC_C89' is obsolete.
configure.ac:28: You should run autoupdate.
./lib/autoconf/c.m4:1652: AC_PROG_CC_C89 is expanded from...
configure.ac:28: the top level
configure.ac:10: installing 'build-aux/compile'
configure.ac:5: installing 'build-aux/config.guess'
configure.ac:5: installing 'build-aux/config.sub'
configure.ac:9: installing 'build-aux/install-sh'
configure.ac:9: installing 'build-aux/missing'
Makefile.am: installing 'build-aux/depcomp'
parallel-tests: installing 'build-aux/test-driver'
checking build system type... aarch64-apple-darwin22.3.0
checking host system type... aarch64-apple-darwin22.3.0
checking for a BSD-compatible install... /opt/homebrew/bin/ginstall -c
checking whether build environment is sane... yes
checking for a race-free 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... /usr/local/opt/llvm/bin/clang
checking whether the C compiler works... no
configure: error: in `/blockscout/deps/libsecp256k1/c_src/secp256k1':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** [priv/libsecp256k1_nif.so] Error 77
==> libsecp256k1
warning: Mix compiler :make_bindings was supposed to return {:ok | :noop | :error, [diagnostic]} but it returned :error
Compiling 1 file (.erl)
src/libsecp256k1.erl:146:1: Warning: function not_loaded/1 is unused
%  146| not_loaded(Line) ->
%     | ^

Generated libsecp256k1 app
==> con_cache
Compiling 8 files (.ex)
warning: use Bitwise is deprecated. import Bitwise instead
  lib/con_cache/owner.ex:5: ConCache.Owner

I tried using gcc from homebrew, but it didn't work. How I can fix this?

My Environment

Elixir & Erlang/OTP versions (elixir -version): elixir 1.14.3 (compiled with Erlang/OTP 25)

Operating System: macOS 13.2

Erlang: v25.2.1

gcc --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin22.3.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Solution

  • Few actions helped me

    1. Change in mix.exs
    {:libsecp256k1, "~> 0.1.10"}
    

    to

    {:libsecp256k1, "~> 0.1.12", hex: :libsecp256k1_diode_fork}
    
    1. Use stable rust version, before that I had nightly build