q9f / eth.rb

a straightforward library to build, sign, and broadcast ethereum transactions anywhere you can run ruby.
https://q9f.github.io/eth.rb
Apache License 2.0
200 stars 86 forks source link

Bundle install fails on rbsecp256k1 dependency #139

Closed septerr closed 1 year ago

septerr commented 2 years ago

Added to Gemfile of a rails project and ran bundle install on Apple silicon macbook. Error:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    current directory: /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbsecp256k1-5.1.0/ext/rbsecp256k1
/Users/septerr/.rbenv/versions/3.1.0/bin/ruby -I /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/3.1.0 -r
./siteconf20220721-90352-w4zhtr.rb extconf.rb
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Downloading libsecp256k1.zip
Running 'chmod' for libsecp256k1 0.0.0... OK
Running 'autogen' for libsecp256k1 0.0.0... ERROR, review
'/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbsecp256k1-5.1.0/ext/rbsecp256k1/tmp/arm64-apple-darwin21.3.0/ports/libsecp256k1/0.0.0/autogen.log'
to see what happened. Last lines are:
========================================================================
Can't exec "aclocal": No such file or directory at
/opt/homebrew/Cellar/autoconf/2.71/share/autoconf/Autom4te/FileUtils.pm line 274.
autoreconf: error: aclocal failed with exit status: 2
========================================================================
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/Users/septerr/.rbenv/versions/3.1.0/bin/$(RUBY_BASE_NAME)
    --with-system-library
    --without-system-library
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:460:in
`block in execute': Failed to complete autogen task (RuntimeError)
from
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:426:in
`chdir'
from
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:426:in
`execute'
    from extconf.rb:42:in `configure'
from
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/mini_portile2-2.8.0/lib/mini_portile2/mini_portile.rb:186:in
`cook'
    from extconf.rb:83:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/rbsecp256k1-5.1.0 for
inspection.
Results logged to
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/extensions/arm64-darwin-21/3.1.0/rbsecp256k1-5.1.0/gem_make.out

  /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:95:in `run'
  /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:47:in `block in build'
  /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/3.1.0/tempfile.rb:317:in `open'
  /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/3.1.0/rubygems/ext/ext_conf_builder.rb:26:in `build'
  /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:161:in `build_extension'
  /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:195:in `block in build_extensions'
  /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `each'
  /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/3.1.0/rubygems/ext/builder.rb:192:in `build_extensions'
  /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/3.1.0/rubygems/installer.rb:847:in `build_extensions'
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/rubygems_gem_installer.rb:71:in
`build_extensions'
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/rubygems_gem_installer.rb:28:in
`install'
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/source/rubygems.rb:207:in
`install'
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/installer/gem_installer.rb:54:in
`install'
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/installer/parallel_installer.rb:186:in
`do_install'
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/installer/parallel_installer.rb:177:in
`block in worker_pool'
  /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/worker.rb:62:in `apply_func'
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/worker.rb:57:in `block in
process_queue'
  /Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/worker.rb:54:in `loop'
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/worker.rb:54:in
`process_queue'
/Users/septerr/.rbenv/versions/3.1.0/lib/ruby/gems/3.1.0/gems/bundler-2.3.18/lib/bundler/worker.rb:91:in `block (2
levels) in create_threads'

An error occurred while installing rbsecp256k1 (5.1.0), and Bundler cannot continue.

In Gemfile:
  eth was resolved to 0.5.6, which depends on
    rbsecp256k1
septerr commented 2 years ago

I was able to resolve this by installing automake:

brew install automake openssl libtool pkg-config gmp libffi

See instructions for other operating systems here: https://github.com/etscrivner/rbsecp256k1/blob/master/README.md