Прежде всего, попробуйте запустить gem install nokogiri
вручную и проверьте журнал, как показано в выводе выше:
...
To see why this extension failed to compile, please check the mkmf.log which can
be found here:
/usr/local/bundle/extensions/x86_64-linux/2.5.0/nokogiri-1.8.4/mkmf.log
...
У меня недавно была проблема с установкой камня nokogiri. Поэтому я открыл свой файл mkmf.log
и нашел причину проблемы (библиотека stdio.h
отсутствовала в дистрибутиве):
"gcc -o conftest -I/usr/local/include/ruby-2.5.0/x86_64-linux-musl -I/usr/local/include/ruby-2.5.0/ruby/backward -I/usr/local/include/ruby-2.5.0 -I. -O3 -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 -Wimplicit-function-declaration -Wdeprecated-declarations -Wmisleading-indentation -Wno-packed-bitfield-compat -Wsuggest-attribute=noreturn -Wsuggest-attribute=format -Wduplicated-cond -Wno-maybe-uninitialized -fPIC conftest.c -L. -L/usr/local/lib -Wl,-rpath,/usr/local/lib -L. -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-rpath,/usr/local/lib -L/usr/local/lib -lruby -lpthread -ldl -lcrypt -lm -lc "
In file included from /usr/local/include/ruby-2.5.0/ruby/ruby.h:29:0,
from /usr/local/include/ruby-2.5.0/ruby.h:33,
from conftest.c:1:
/usr/local/include/ruby-2.5.0/ruby/defines.h:112:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
Проблема была решена установкой пакета libc-dev
для меня .
Итак. Для решения вашей проблемы вам следует итеративно запускать команду gem install nokogiri
, проверять файл mkmf.log
после каждого сбоя и исправлять недостающие зависимости до тех пор, пока пакет не будет установлен.
Кстати, вот мой окончательный список зависимостей , которого было достаточно для установки Rails в Alpine:
echo "http://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories \
&& apk update \
&& apk add --update-cache postgresql-client nodejs \
libffi-dev readline sqlite build-base postgresql-dev \
libc-dev linux-headers libxml2-dev libxslt-dev readline-dev gcc libc-dev \
&& rm -rf /var/cache/apk/*