gpt4 book ai didi

ruby-on-rails - 在 Ubuntu 14.04 上安装 gem `ruby2d` 时出错

转载 作者:数据小太阳 更新时间:2023-10-29 08:44:09 24 4
gpt4 key购买 nike

尝试在我的 Ubuntu 14.04 上安装 ruby​​2d gem 时出现以下错误

Building native extensions.  This could take a while...
ERROR: Error installing ruby2d:
ERROR: Failed to build gem native extension.

/home/rishi/.rvm/rubies/ruby-2.2.1/bin/ruby -r ./siteconf20160401-21057-yotffi.rb extconf.rb
creating Makefile

make "DESTDIR=" clean

make "DESTDIR="
compiling ruby2d.c
ruby2d.c: In function ‘render’:
ruby2d.c:133:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
for (int i = 0; i < num_objects; ++i) {
^
ruby2d.c:133:3: note: use option -std=c99 or -std=gnu99 to compile your code
ruby2d.c:215:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
struct image_data *data;
^
ruby2d.c:234:9: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
struct text_data *data;
^
ruby2d.c: In function ‘ruby2d_show’:
ruby2d.c:253:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
char *title = RSTRING_PTR(rb_iv_get(self, "@title"));
^
make: *** [ruby2d.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/rishi/.rvm/gems/ruby-2.2.1/gems/ruby2d-0.2.0 for inspection.
Results logged to /home/rishi/.rvm/gems/ruby-2.2.1/extensions/x86_64-linux/2.2.0/ruby2d-0.2.0/gem_make.out

如果有人能给我一些建议就太好了!

附言我已经按照 simple2d GitHub Page 上给出的所有步骤在我的机器上成功安装了 simple2d gem。

提前致谢:)

最佳答案

these的帮助下two答案,您应该能够通过在 gem 编译时设置 cflags强制 gcc 切换到 C99 模式:

gem install ruby2d -- --with-cflags=\"-std=c99\"

或者,如果您使用 bundler ,请在运行 bundle install 之前配置 gem 编译:

bundle config build.ruby2d --with-cflags=\"-std=c99\"

关于ruby-on-rails - 在 Ubuntu 14.04 上安装 gem `ruby2d` 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36356804/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com