Ruby 尝试在macOS Catalina上安装Jekyll时,在构建libffi gem本机扩展时出现问题

Ruby 尝试在macOS Catalina上安装Jekyll时,在构建libffi gem本机扩展时出现问题,ruby,rubygems,jekyll,macos-catalina,libffi,Ruby,Rubygems,Jekyll,Macos Catalina,Libffi,编辑:如果你想完成所有步骤,我在博客上写了一个更详细的解决方案 我正试图通过gem install Jekyll在macOS Catalina上安装Jekyll,使用Ruby install via homebrew,位于/usr/local/opt/Ruby/bin/Ruby,我遇到了以下错误 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /Users/foobar/

编辑:如果你想完成所有步骤,我在博客上写了一个更详细的解决方案

我正试图通过
gem install Jekyll
在macOS Catalina上安装Jekyll,使用Ruby install via homebrew,位于
/usr/local/opt/Ruby/bin/Ruby
,我遇到了以下错误

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

current directory:
/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.9.21/ext/ffi_c
/Users/foobar/.rbenv/versions/2.5.1/bin/ruby -r ./siteconf20181118-49440-k8mjki.rb
extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi... no
checking for shlwapi.h... no
checking for rb_thread_blocking_region()... no
checking for rb_thread_call_with_gvl()... yes
checking for rb_thread_call_without_gvl()... yes
creating extconf.h
creating Makefile

current directory:
/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.9.21/ext/ffi_c
make "DESTDIR=" clean

current directory:
/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.9.21/ext/ffi_c
make "DESTDIR="
Running autoreconf for libffi
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I m4 --output=aclocal.m4t
Can't exec "aclocal": No such file or directory at
/usr/local/Cellar/autoconf/2.69/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory
make: ***
["/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.9.21/ext/ffi_c/libffi-x86_64-darwin18"/.libs/libffi_convenience.a]
Error 1

make failed, exit code 2

Gem files will remain installed in
/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/gems/ffi-1.9.21 for inspection.
Results logged to
/Users/foobar/.rbenv/versions/2.5.1/lib/ruby/gems/2.5.0/extensions/x86_64-darwin-18/2.5.0-static/ffi-1.9.21/gem_make.out

An error occurred while installing ffi (1.9.21), and Bundler cannot continue.
我已经尝试过通过
Xcode-select--install
更新我的Xcode命令行工具,但我收到了以下消息:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

有人知道我如何在我的机器上构建
libffi
,这样我就可以把它作为一个依赖项使用了吗?

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa!归功于@ffleming。以下是您需要做的:

  • 使用
    brew在brew上重新安装libffi重新安装libffi
  • 将新brew安装的libffi标志添加到shell实例,例如
  • 运行
    gem install jekyll
    ,您应该会被排序
    export LDFLAGS="-L/usr/local/opt/libffi/lib"
    export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"