问题
I am trying to install foodcritic gem on Ubuntu 12.10. It could be successfully installed in Ubuntu 12.04. I have installed the requirements: libxslt-dev, libxml2-dev, ruby1.9.3 and make packages. But when now I try
sudo gem install foodcritic
I get the following error:
compiling xml_xpath_context.c
xml_xpath_context.c: In function ‘xpath_generic_exception_handler’:
xml_xpath_context.c:184:3: error: format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors
make: *** [xml_xpath_context.o] Error 1
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/nokogiri-1.5.0/ext/nokogiri/gem_make.out
Nokogiri-1.5.0 gem is a requirement for foodcritic and it is it's instllation that fails. How can I install foodcritic?
回答1:
Support for Ubuntu 12.10 (or any Debian-based system that uses -Werror=format-security
) was built into nokogiri-1.5.4. I recommend installing the latest (currently 1.5.5). It should be compatible with 1.5.0, except with more fixed bugs :) See the changelog for more information.
It looks like foodcritic
locked the version to 1.5.0 because of a segfault in 1.5.3 (according to its changelog) but one of the fixes in 1.5.4 fixes a segfault, so you may want to modify the gem to require ~> 1.5.4
and if it works, contact the author of the gem.
来源:https://stackoverflow.com/questions/13085404/installing-nokogiri-v-1-5-0-gem-in-ubuntu-12-10