安装 Jekyll 时出错:无法构建本机扩展 | macOS BigSur

问题描述

也许有人可以帮助我。 我按照 https://jekyllrb.com/docs/installation/macos/ 上的说明操作 我已经通过自制软件安装了 Ruby 3.0.1 并设置了所有路径。

ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x86_64-darwin20]


- EXECUTABLE DIRECTORY: /usr/local/lib/ruby/gems/3.0.0/bin

- GEM PATHS:
     - /usr/local/lib/ruby/gems/3.0.0
     - /Users/tgermer/.gem/ruby/3.0.0
     - /usr/local/Cellar/ruby/3.0.1/lib/ruby/gems/3.0.0

在终端中的 gem install --user-install bundler jekyll 之后是以下内容

    tgermer@HM02283GMBP2016 teamclusion % gem install --user-install bundler jekyll
Successfully installed bundler-2.2.15
Parsing documentation for bundler-2.2.15
Done installing documentation for bundler after 3 seconds
Building native extensions. This Could take a while...
ERROR:  Error installing jekyll:
    ERROR: Failed to build gem native extension.

    current directory: /Users/tgermer/.gem/ruby/3.0.0/gems/ffi-1.15.0/ext/ffi_c
/usr/local/opt/ruby/bin/ruby -I /usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0 -r ./siteconf20210408-7443-w0jyji.rb extconf.rb
*** 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
    --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=/usr/local/Cellar/ruby/3.0.1/bin/$(RUBY_BASE_NAME)
    --with-ffi_c-dir
    --without-ffi_c-dir
    --with-ffi_c-include
    --without-ffi_c-include=${ffi_c-dir}/include
    --with-ffi_c-lib
    --without-ffi_c-lib=${ffi_c-dir}/lib
    --enable-system-libffi
    --disable-system-libffi
    --with-libffi-config
    --without-libffi-config
    --with-pkg-config
    --without-pkg-config
/usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/mkmf.rb:471:in `try_do': The compiler Failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/mkmf.rb:564:in `try_link0'
    from /usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/mkmf.rb:582:in `try_link'
    from /usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/mkmf.rb:684:in `try_ldflags'
    from /usr/local/Cellar/ruby/3.0.1/lib/ruby/3.0.0/mkmf.rb:1851:in `pkg_config'
    from extconf.rb:9:in `system_libffi_usable?'
    from extconf.rb:42:in `<main>'

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

  /Users/tgermer/.gem/ruby/3.0.0/extensions/x86_64-darwin-20/3.0.0/ffi-1.15.0/mkmf.log

extconf Failed,exit code 1

Gem files will remain installed in /Users/tgermer/.gem/ruby/3.0.0/gems/ffi-1.15.0 for inspection.
Results logged to /Users/tgermer/.gem/ruby/3.0.0/extensions/x86_64-darwin-20/3.0.0/ffi-1.15.0/gem_make.out
1 gem installed

/Users/tgermer/.gem/ruby/3.0.0/extensions/x86_64-darwin-20/3.0.0/ffi-1.15.0/mkmf.log

"pkg-config --exists libffi"
| pkg-config --libs libffi
=> "-lffi\n"
"clang -fdeclspec -o conftest -I/usr/local/Cellar/ruby/3.0.1/include/ruby-3.0.0$

You have not agreed to the Xcode license agreements,please run 'sudo xcodebuil$
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc,char **argv)
4: {
5:   return !!argv[argc];
6: }
/* end */

谁能帮忙解决这个问题? 谢谢

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)