Ruby: Patron のビルドに失敗する

RubyRuby

Ubuntuにおいて下記のようなエラーメッセージが出てPatronのビルドに失敗する場合、libcurlのパッケージが足りていません。次のようにインストールしてください。

sudo apt install libcurl4-openssl-dev

エラーメッセージ

Updating installed gems
Updating faraday-patron
Building native extensions. This could take a while...
ERROR:  Error installing faraday-patron:
        ERROR: Failed to build gem native extension.

    current directory: /home/foobar/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/patron-0.13.3/ext/patron
/home/foobar/.rbenv/versions/3.1.1/bin/ruby -I /home/foobar/.rbenv/versions/3.1.1/lib/ruby/3.1.0 -r ./siteconf00000000-0000000-ohle2r.rb extconf.rb
checking for curl-config... no
checking for -lcurl... no
*** 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=/home/foobar/.rbenv/versions/3.1.1/bin/$(RUBY_BASE_NAME)
        --with-curl-dir
        --without-curl-dir
        --with-curl-include
        --without-curl-include=${curl-dir}/include
        --with-curl-lib
        --without-curl-lib=${curl-dir}/lib
        --with-curl-config
        --without-curl-config
        --with-curllib
        --without-curllib
extconf.rb:10:in `<main>':   Can't find libcurl or curl/curl.h (RuntimeError)

  Try passing --with-curl-config, --with-curl-dir, or --with-curl-lib and --with-curl-include
  options to extconf.

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/foobar/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/patron-0.13.3/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/foobar/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/gems/patron-0.13.3 for inspection.
Results logged to /home/foobar/.rbenv/versions/3.1.1/lib/ruby/gems/3.1.0/extensions/x86_64-linux/3.1.0/patron-0.13.3/gem_make.out
Gems updated: patron
タイトルとURLをコピーしました