“由于某种原因无法创建Makefile,...”我尝试安装gem

时间:2017-08-09 20:17:26

标签: ruby makefile

当我尝试下载ruby gem时,我收到此错误

RaviAir:~ ravi$ gem install squib
Building native extensions.  This could take a while...
ERROR:  Error installing squib:
    ERROR: Failed to build gem native extension.

    current directory: /Users/ravi/.rvm/gems/ruby-2.4.0/gems/cairo-1.15.9/ext/cairo
/Users/ravi/.rvm/rubies/ruby-2.4.0/bin/ruby -r ./siteconf20170809-20153-okwab6.rb extconf.rb
checking for GCC... yes
checking for Win32 OS... no
checking for cairo version (>= 1.2.0)... yes
*** 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=/Users/ravi/.rvm/rubies/ruby-2.4.0/bin/$(RUBY_BASE_NAME)
    --with-pkg-config
    --without-pkg-config
    --with-override-variables
    --without-override-variables
/Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:299:in `parse_pc': .pc for zlib doesn't exist. (RuntimeError)
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:196:in `declaration'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:210:in `collect_cflags'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:145:in `cflags'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:212:in `block in collect_cflags'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:211:in `collect'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:211:in `collect_cflags'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:145:in `cflags'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:215:in `block in collect_cflags'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:214:in `collect'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:214:in `collect_cflags'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:154:in `cflags_only_other'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:452:in `cflags_only_other'
    from /Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:499:in `have_package'
    from extconf.rb:52:in `required_pkg_config_package'
    from extconf.rb:60:in `<main>'

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

  /Users/ravi/.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-14/2.4.0/cairo-1.15.9/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/ravi/.rvm/gems/ruby-2.4.0/gems/cairo-1.15.9 for inspection.
Results logged to /Users/ravi/.rvm/gems/ruby-2.4.0/extensions/x86_64-darwin-14/2.4.0/cairo-1.15.9/gem_make.out

然后我检查了日志文件并说:

checking for GCC... -------------------- yes

"gcc -o conftest -I/Users/ravi/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/x86_64-darwin14 -I/Users/ravi/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/backward -I/Users/ravi/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0 -I.  -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl@1.1/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/Users/ravi/.rvm/rubies/ruby-2.4.0/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib -L. -fstack-protector -L/usr/local/lib -L/usr/local/opt/libyaml/lib -L/usr/local/opt/readline/lib -L/usr/local/opt/libksba/lib -L/usr/local/opt/openssl@1.1/lib     -lruby.2.4.0  -lpthread -lgmp -ldl -lobjc "
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: int main(int argc, char **argv)
4: {
5:   return 0;
6: }
/* end */

"gcc -I/Users/ravi/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/x86_64-darwin14 -I/Users/ravi/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0/ruby/backward -I/Users/ravi/.rvm/rubies/ruby-2.4.0/include/ruby-2.4.0 -I.  -I/usr/local/opt/libyaml/include -I/usr/local/opt/readline/include -I/usr/local/opt/libksba/include -I/usr/local/opt/openssl@1.1/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   -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2: 
3: /*top*/
4: #ifndef __GNUC__
5: # error
6: |:/ === __GNUC__ undefined === /:|
7: #endif
/* end */

--------------------

checking for Win32 OS... -------------------- no

--------------------

have_package: checking for cairo version (>= 1.2.0)... -------------------- yes

--------------------

我已经确定安装了Xcode命令,但我认为我没有安装Xcode应用程序(不确定是否有意义),我已经下载并更新了自制程序。

我认为错误是

/Users/ravi/.rvm/gems/ruby-2.4.0/gems/pkg-config-1.2.4/lib/pkg-config.rb:299:in `parse_pc': .pc for zlib doesn't exist.

我使用文本编辑器“sublime”打开它。 但我不知道如何解决这个问题。请帮忙。

更多细节:我使用ruby 2.4,我有OS X优胜美地版本10.10.5。

1 个答案:

答案 0 :(得分:1)