我正在尝试使用以下版本和安装了ruby 2.4.0p0和gem 2.6.10的xcode命令行工具在macOS上安装jekyll
安装jekyll和bundler
gem install jekyll bundler
命令的结果是
Fetching: public_suffix-2.0.5.gem (100%)
Successfully installed public_suffix-2.0.5
Fetching: addressable-2.5.0.gem (100%)
Successfully installed addressable-2.5.0
Fetching: colorator-1.1.0.gem (100%)
Successfully installed colorator-1.1.0
Fetching: sass-3.4.23.gem (100%)
Successfully installed sass-3.4.23
Fetching: jekyll-sass-converter-1.5.0.gem (100%)
Successfully installed jekyll-sass-converter-1.5.0
Fetching: rb-fsevent-0.9.8.gem (100%)
Successfully installed rb-fsevent-0.9.8
Fetching: ffi-1.9.17.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /usr/local/lib/ruby/gems/2.4.0/gems/ffi-1.9.17/ext/ffi_c
/usr/local/opt/ruby/bin/ruby -r ./siteconf20170303-1307-1slrb61.rb extconf.rb
checking for ffi.h... *** 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/2.4.0/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
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:457:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:588:in `try_cpp'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:1095:in `block in have_header'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:945:in `block in checking_for'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:321:in `open'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:351:in `block in postpone'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:321:in `open'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:347:in `postpone'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:944:in `checking_for'
from /usr/local/Cellar/ruby/2.4.0/lib/ruby/2.4.0/mkmf.rb:1094:in `have_header'
from extconf.rb:16:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/ffi-1.9.17/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /usr/local/lib/ruby/gems/2.4.0/gems/ffi-1.9.17 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.4.0/extensions/x86_64-darwin-16/2.4.0/ffi-1.9.17/gem_make.out
Fetching: bundler-1.14.5.gem (100%)
Successfully installed bundler-1.14.5
Parsing documentation for bundler-1.14.5
Installing ri documentation for bundler-1.14.5
Done installing documentation for bundler after 4 seconds
1 gem installed
日志文件mkmf.log的内容
package configuration for libffi is not found
"clang -o conftest -I/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/x86_64-darwin16 -I/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0/ruby/backward -I/usr/local/Cellar/ruby/2.4.0/include/ruby-2.4.0 -I. -I/usr/local/opt/libyaml/include -I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wno-tautological-compare -Wno-parentheses-equality -Wno-constant-logical-operand -Wno-self-assign -Wunused-variable -Wimplicit-int -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens -fno-common -pipe conftest.c -L. -L/usr/local/Cellar/ruby/2.4.0/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib -lruby.2.4.0 -lpthread -ldl -lobjc "
2017-03-03 09:09 xcodebuild[1311] (FSEvents.framework) FSEventStreamStart: ERROR: FSEvents_connect() => (ipc/send) invalid destination port (268435459)
2017-03-03 09:09 xcodebuild[1311] (FSEvents.framework) FSEventStreamInvalidate(): failed assertion 'streamRef != NULL'
2017-03-03 09:09 xcodebuild[1311] (FSEvents.framework) FSEventStreamRelease(): failed assertion 'streamRef != NULL'
2017-03-03 09:09:01.029 xcodebuild[1311:92957] DVTFilePathFSEvents: Failed to start fs event stream.
sh: line 1: 1313 Abort trap: 6 /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -sdk / -find clang 2> /dev/null
clang: error: unable to find utility "clang", not a developer tool or in PATH
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
答案 0 :(得分:0)
我寻找解决方案来修复clang: error: unable to find utility "clang", not a developer tool or in PATH
并发现Xcode无法找到自己的命令行工具。 这link为我修好了。