我正在尝试运行以下Docker文件,但是当它尝试安装gem" soca"它始终失败并出现以下错误
错误:
Building native extensions. This could take a while...
ERROR: Error installing soca:
ERROR: Failed to build gem native extension.
/usr/bin/ruby2.1 extconf.rb
checking for re.h... no
creating Makefile
make "DESTDIR=" clean
make "DESTDIR="
compiling parser.c
In file included from /usr/include/ruby-2.1.0/ruby.h:33:0,
from parser.h:4,
from parser.rl:1:
parser.rl: In function 'JSON_parse_object':
/usr/include/ruby-2.1.0/ruby/ruby.h:437:18: error: expected '(' before '!' token
#define RTEST(v) !(((VALUE)(v) & ~Qnil) == 0)
^
parser.rl:165:20: note: in expansion of macro 'RTEST'
VALUE klass = rb_funcall(mJSON, i_deep_const_get, 1, klassname);
^
/usr/include/ruby-2.1.0/ruby/ruby.h:437:18: warning: value computed is not used [-Wunused-value]
#define RTEST(v) !(((VALUE)(v) & ~Qnil) == 0)
^
parser.rl:165:20: note: in expansion of macro 'RTEST'
VALUE klass = rb_funcall(mJSON, i_deep_const_get, 1, klassname);
^
parser.rl:165:68: error: expected ';' before '{' token
VALUE klass = rb_funcall(mJSON, i_deep_const_get, 1, klassname);
^
Makefile:224: recipe for target 'parser.o' failed
make: *** [parser.o] Error 1
make failed, exit code 2
Gem files will remain installed in /var/lib/gems/2.1.0/gems/json-1.4.6 for inspection.
Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/json-1.4.6/gem_make.out
这是我正在运行的Docker文件 其中使用couchdb图像和 然后安装希望它需要运行ruby gems
FROM couchdb:1
# custom setup RUN apt-get update RUN apt-get --assume-yes install ruby RUN apt-get --assume-yes install ruby-dev RUN apt-get
--assume-yes install rubygems RUN apt-get --assume-yes install build-essential bison openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libxml2-dev autoconf libc6-dev ncurses-dev automake libtool RUN gem install soca
-v 0.3.0
COPY local.ini /usr/local/etc/couchdb/
EXPOSE 5984
答案 0 :(得分:0)
看起来Ruby gem使用原生扩展存在问题,特别是问题就像JSON gem一样:https://rubygems.org/gems/json/versions/1.4.6
这可能与您拥有的Ruby版本有关。
您可以尝试自行安装gem以查看错误:
gem install json -v 1.4.6
这就是我能够获得更多信息的错误消息,并能够找出缺少的本机库。