1

いくつかの gem をインストールしようとしていますが、そのうちのいくつかはネイティブ拡張をビルドする必要があります。

自動生成された Makefile が何らかの理由で正常に動作しません。結果のエラーは次のとおりです。

$ gem install ffi-yajl --verbose
 -IC:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/include -march=x86-64 -mtune=generic -O2 -pipe -I/mingw64/include/ncurses -IC:/building/msys64/mingw64/lib/libffi-3.2.1/include
 -LC:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/libyajl2-1.2.0/lib/libyajl2/vendored-libyajl2/lib -L. -pipe
creating Makefile
generating encoder-x64-mingw32.def
make: *** No rule to make target '/C/msys64/mingw64/include/ruby-2.3.0/ruby.h', needed by 'encoder.o'.  Stop.
ERROR:  Error installing ffi-yajl:
        ERROR: Failed to build gem native extension.

    Building has failed. See above output for more information on the failure.
make failed, exit code 2

Gem files will remain installed in C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3 for inspection.
Results logged to C:/msys64/mingw64/lib/ruby/gems/2.3.0/extensions/x64-mingw32/2.3.0/ffi-yajl-2.2.3/gem_make.out
HEAD https://api.rubygems.org/api/v1/dependencies
200 OK
GET https://api.rubygems.org/api/v1/dependencies?gems=ffi-yajl
200 OK
Getting SRV record failed: DNS result has no information for _rubygems._tcp.api.rubygems.org
GET https://api.rubygems.org/api/v1/dependencies?gems=libyajl2
200 OK
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/LICENSE
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/README.md
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/Rakefile
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/bin/ffi-yajl-bench
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/dlopen/dlopen.c
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/dlopen/extconf.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/encoder/encoder.c
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/encoder/extconf.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/parser/extconf.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/parser/parser.c
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/MIT-LICENSE
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/encode.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/encode_json_and_marshal.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/encode_json_and_yaml.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/encode_profile.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/http.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/parse.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/parse_json_and_marshal.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/parse_json_and_yaml.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/parse_profile.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/parse_profile_ruby_prof.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/parse_stream.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/subjects/item.json
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/subjects/ohai.json
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/subjects/ohai.marshal_dump
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/subjects/ohai.yml
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/subjects/twitter_search.json
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/subjects/twitter_stream.json
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/benchmark/subjects/unicode.json
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/encoder.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/ext.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/ext/.keep
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/ffi.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/ffi/encoder.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/ffi/parser.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/map_library_name.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/parser.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/platform.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/lib/ffi_yajl/version.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/spec/ffi_yajl/encoder_spec.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/spec/ffi_yajl/map_library_name_spec.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/spec/ffi_yajl/parser_spec.rb
C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/spec/spec_helper.rb
Building native extensions.  This could take a while...
current directory: C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/encoder
C:/msys64/mingw64/bin/ruby.exe -r ./siteconf20160616-3960-1kb305r.rb extconf.rb
current directory: C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/encoder
make "DESTDIR=" clean
current directory: C:/msys64/mingw64/lib/ruby/gems/2.3.0/gems/ffi-yajl-2.2.3/ext/ffi_yajl/ext/encoder
make "DESTDIR="

このフォルダーに足を踏み入れて手動でメイクを実行すると:

$ make
make: *** No rule to make target '/C/msys64/mingw64/include/ruby-2.3.0/ruby.h', needed by 'encoder.o'.  Stop.

問題をさらに詳しく調べます。

$ ls -l /C/msys64/mingw64/include/ruby-2.3.0/ruby.h
-rw-r--r-- 1 User None 868 Jul 11  2012 /C/msys64/mingw64/include/ruby-2.3.0/ruby.h

Makefile を少し変更すると (オブジェクトのヘッダーへの依存関係を削除します)、明らかなことが起こります。

$ make
compiling encoder.c
encoder.c:1:18: fatal error: ruby.h: No such file or directory
compilation terminated.
Makefile:238: recipe for target 'encoder.o' failed
make: *** [encoder.o] Error 1

(によって生成された) コマンドを手動で実行してmake -nも、エラーは発生せず、正常にコンパイルされます。残念ながら、このハッカーを使用して宝石を構築することはできません。

問題は、make で実行するとシステムがヘッダーを検出しないのに、gcc を直接使用すると検出されるのはなぜですか? 何を変更する必要がありますか?

4

0 に答える 0