@Benedictus

Как решить проблему ruby с установкой nio4r и json?

Добрый день.

Решил на днях опробовать chef вот по этому туториалу Getting Started with Chef Server. Part 1

Но на этапе bundlа Gemfile-а столкнулся вот с такими ошибками:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /usr/share/gems/gems/nio4r-2.5.7/ext/nio4r
/usr/bin/ruby -r ./siteconf20210607-71504-1hvpr6w.rb extconf.rb --with-cflags=-std=c99
checking for unistd.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
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/ruby/mkmf.rb:590:in `try_cpp'
from /usr/share/ruby/mkmf.rb:1098:in `block in have_header'
from /usr/share/ruby/mkmf.rb:948:in `block in checking_for'
from /usr/share/ruby/mkmf.rb:350:in `block (2 levels) in postpone'
from /usr/share/ruby/mkmf.rb:320:in `open'
from /usr/share/ruby/mkmf.rb:350:in `block in postpone'
from /usr/share/ruby/mkmf.rb:320:in `open'
from /usr/share/ruby/mkmf.rb:346:in `postpone'
from /usr/share/ruby/mkmf.rb:947:in `checking_for'
from /usr/share/ruby/mkmf.rb:1097:in `have_header'
from extconf.rb:15:in `'

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

/usr/lib64/gems/ruby/nio4r-2.5.7/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/share/gems/gems/nio4r-2.5.7 for inspection.
Results logged to /usr/lib64/gems/ruby/nio4r-2.5.7/gem_make.out

An error occurred while installing nio4r (2.5.7), and Bundler cannot continue.
Make sure that `gem install nio4r -v '2.5.7' --source 'rubygems.org'` succeeds before bundling.


In Gemfile:
berkshelf was resolved to 6.1.1, which depends on
berkshelf-api-client was resolved to 3.0.0, which depends on
ridley was resolved to 5.1.1, which depends on
celluloid-io was resolved to 0.16.2, which depends on
nio4r

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory: /usr/share/gems/gems/json-1.7.7/ext/json/ext/generator
/usr/bin/ruby -r ./siteconf20210607-71504-g1ktuv.rb extconf.rb
creating Makefile

current directory: /usr/share/gems/gems/json-1.7.7/ext/json/ext/generator
make "DESTDIR=" clean
sh: make: command not found

current directory: /usr/share/gems/gems/json-1.7.7/ext/json/ext/generator
make "DESTDIR="
sh: make: command not found

make failed, exit code 127

Gem files will remain installed in /usr/share/gems/gems/json-1.7.7 for inspection.
Results logged to /usr/lib64/gems/ruby/json-1.7.7/gem_make.out

An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7' --source 'rubygems.org'` succeeds before bundling.


In Gemfile:
berkshelf was resolved to 6.1.1, which depends on
berkshelf-api-client was resolved to 3.0.0, which depends on
ridley was resolved to 5.1.1, which depends on
json

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

Если я пытаюсь отдельно дернуть gem install nio4r -v '2.5.7' --source 'rubygems.org' и gem install json -v '1.7.7' --source 'rubygems.org'

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

gem install nio4r -v '2.5.7' --source 'rubygems.org'
Building native extensions. This could take a while...
ERROR: Error installing nio4r:
ERROR: Failed to build gem native extension.

current directory: /usr/local/share/gems/gems/nio4r-2.5.7/ext/nio4r
/usr/bin/ruby -r ./siteconf20210607-71576-1qjn5a4.rb extconf.rb
checking for unistd.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
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib64
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/$(RUBY_BASE_NAME)
/usr/share/ruby/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/share/ruby/mkmf.rb:590:in `try_cpp'
from /usr/share/ruby/mkmf.rb:1098:in `block in have_header'
from /usr/share/ruby/mkmf.rb:948:in `block in checking_for'
from /usr/share/ruby/mkmf.rb:350:in `block (2 levels) in postpone'
from /usr/share/ruby/mkmf.rb:320:in `open'
from /usr/share/ruby/mkmf.rb:350:in `block in postpone'
from /usr/share/ruby/mkmf.rb:320:in `open'
from /usr/share/ruby/mkmf.rb:346:in `postpone'
from /usr/share/ruby/mkmf.rb:947:in `checking_for'
from /usr/share/ruby/mkmf.rb:1097:in `have_header'
from extconf.rb:15:in `'

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

/usr/local/lib64/gems/ruby/nio4r-2.5.7/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/share/gems/gems/nio4r-2.5.7 for inspection.
Results logged to /usr/local/lib64/gems/ruby/nio4r-2.5.7/gem_make.out

gem install json -v '1.7.7' --source 'rubygems.org'
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.

current directory: /usr/local/share/gems/gems/json-1.7.7/ext/json/ext/generator
/usr/bin/ruby -r ./siteconf20210607-71587-1rd7fwt.rb extconf.rb
creating Makefile

current directory: /usr/local/share/gems/gems/json-1.7.7/ext/json/ext/generator
make "DESTDIR=" clean
sh: make: command not found

current directory: /usr/local/share/gems/gems/json-1.7.7/ext/json/ext/generator
make "DESTDIR="
sh: make: command not found

make failed, exit code 127

Gem files will remain installed in /usr/local/share/gems/gems/json-1.7.7 for inspection.
Results logged to /usr/local/lib64/gems/ruby/json-1.7.7/gem_make.out

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

Подскажите, как это победить? В Google для себя решения найти не смог, так как почти везде советуют поставить Devkit b gcc, но мне это не помогло
  • Вопрос задан
  • 644 просмотра
Решения вопроса 1
@AVKor
Всё написано в сообщениях:

Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details.
[...]
To see why this extension failed to compile, please check the mkmf.log which can be found here:
[...]
/usr/lib64/gems/ruby/nio4r-2.5.7/mkmf.log
[...]
sh: make: command not found

и т.д. Лог смотрели?

А в статье по ссылке жирненьким в самом верху написано:
WARNING: This article can be outdated.
Ответ написан
Пригласить эксперта
Ответы на вопрос 1
@vsuhachev
Подскажите, как это победить? В Google для себя решения найти не смог, так как почти везде советуют поставить Devkit b gcc, но мне это не помогло


Вам нужно ставить инструменты сборки на целевой машине и это не только компилятор gcc, но и всякие утилиты типа make, autoconf и т.п. Это можно сделать и в самом Шефе через соответствующий кукбук.
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы