繁体   English   中英

从Brightbox通过PPA安装在Ruby 2.1.x上安装Mongrel 1.2.0_pre2时出错

[英]Errors installing Mongrel 1.2.0_pre2 on Ruby 2.1.x installed via PPA from Brightbox

作为新演出的一部分,我继承了Ruby on Rails应用程序代码库。 该代码目前正在生产中,但是我一直负责评估和清理。 因此,该代码包括Mongrel依赖项; 特别是Mogrel 1.2.0_pre2,它可能在2010年最后一次更新,但这就是此代码所使用的。

本地开发环境在Ubuntu 12.04中运行,当我从源代码安装Ruby 2.1.x时,已通过bundle install成功安装了所有Ruby GEM。

但是我最近从Brightbox那里了解了Ubuntu就绪软件包,这让我感到非常兴奋! 我不介意安装表单源,但宁愿处理软件包安装的清洁度。 因此,在完全干净的Ubuntu 12.04系统上,我开始重建我的Ruby开发盒,并在回购中添加了PPA:

sudo add-apt-repository ppa:brightbox/ruby-ng

更新了本地来源列表:

sudo aptitude update

并按如下方式安装其Ruby 2.1软件包:

sudo aptitude install ruby2.1 ruby2.1-dev

一切顺利,直到bundle install为止,直到Mogrel因编译错误而死亡:

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

    /usr/bin/ruby2.1 extconf.rb 
checking for main() in -lc... yes
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling http11.c
http11.c: In function ‘http_field’:
http11.c:193:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c:194:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c: In function ‘request_uri’:
http11.c:235:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c: In function ‘fragment’:
http11.c:246:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c: In function ‘request_path’:
http11.c:257:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c: In function ‘query_string’:
http11.c:268:3: error: format not a string literal and no format arguments [-Werror=format-security]
http11.c: In function ‘HttpParser_execute’:
http11.c:439:5: error: format not a string literal and no format arguments [-Werror=format-security]
cc1: some warnings being treated as errors
make: *** [http11.o] Error 1

make failed, exit code 2

Gem files will remain installed in /tmp/bundler20141208-21746-1qez12a/mongrel-1.2.0.pre2/gems/mongrel-1.2.0.pre2 for inspection.
Results logged to /tmp/bundler20141208-21746-1qez12a/mongrel-1.2.0.pre2/extensions/x86_64-linux/2.1.0/mongrel-1.2.0.pre2/gem_make.out
An error occurred while installing mongrel (1.2.0.pre2), and Bundler cannot
continue.
Make sure that `gem install mongrel -v '1.2.0.pre2'` succeeds before bundling.

但是运行gem install mongrel -v '1.2.0.pre2'似乎没有帮助; 它经历了预期的动作,然后失败了,与通过bundle install时完全一样的http11.c错误。

我已经阅读了一些与人们在Ruby 1.9.2及更高版本中安装任何版本的Mongrel的问题相关的Stack Overflow,例如在该线程此线程中

所有不专注于“您应该只使用Thin代替”的解决方案。谈论手动修补http11.c 但是,像此页面一样, 这些引用是针对Ruby 1.9.1和Mongrel 1.1.5的,所引用的行号绝对不对应于Mogrel_1.2.0pre2中的等效项。

具有讽刺意味的是,某些解决方案实际上指导用户安装Mogrel版本1.2.0pre2而不是1.1.5来解决此问题; 但是我正在尝试安装1.2.0pre2版本,但似乎无法完成。

当然,我想知道如何克服这个Mongrel错误,因此在此方面的帮助将不胜感激。 但是为什么当我通过Brightbox PPA安装Ruby 2.1.x时会弹出此错误,而如果我直接从源代码编译Ruby 2.1.x则根本不会出现此错误?

好的,所以经过一番摸索之后,我偶然发现了一个解决方案,该解决方案使我可以在不需要手动修补的情况下进行整洁地安装在Ruby 2.1.x上的Mogrel 1.2.0_pre2。 解决方案是使用--with-cflags像这样直接对GEM进行Ruby安装:

sudo gem install mongrel -v 1.2.0.pre2 -- --with-cflags=\"-O2 -pipe -march=native -w\"

一旦完成,编译就没有问题了,并且成功安装了GEM:

Building native extensions with: '--with-cflags="-O2 -pipe -march=native -w"'
This could take a while...
Successfully installed mongrel-1.2.0.pre2
Parsing documentation for mongrel-1.2.0.pre2
Installing ri documentation for mongrel-1.2.0.pre2
Done installing documentation for mongrel after 1 seconds
1 gem installed

但是我仍然想知道为什么当通过纯文本源安装Ruby 2.1.x完全没有问题时,通过Brightbox PPA安装Ruby 2.1.x会引起问题。

而且--with-cflags=\\"-O2 -pipe -march=native -w\\"影响还不是100%清楚,但这似乎是一个常见的--with-cflags选项,用于获得一些固执(也许已经过时了?)安装在高于1.9.2的Ruby版本上的Ruby GEM。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM