在couchdb docker镜像中安装soca gem时出错

我试图运行下面的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图像,然后安装,希望能够运行它需要运行rubygem

 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 

看起来像使用本机扩展的Ruby gem存在问题,并且它看起来特别像是JSON gem的问题: https : //rubygems.org/gems/json/versions/1.4.6

这可能与您拥有的Ruby版本有关。

你可以尝试自己安装gem,看看错误是什么:

 gem install json -v 1.4.6 

这就是我已经能够得到更多的信息错误信息,并能够找出什么本地库丢失。