Родные расширения ruby gem под msys2 не удалось
Я пытаюсь установить несколько гемов, некоторые из которых должны создавать собственные расширения.
Автоматически сгенерированный 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
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? Что мне нужно изменить?