在OS X 10.9.2下使用Rbenv制作Ruby 2.1.1失败
GCC-4.9 Fails to Make Ruby 2.1.1 with Rbenv in OS X 10.9.2
我在这里超出了我的深度,因为我对C和这样的编译器不了解,除了根据tut的我已经读过-我已经自制安装了gcc-4.9,链接它,并在我的。bash_profile中有cc=gcc-4.9 -希望这将允许我安装Ruby 2.1.1,因为以前的尝试失败了,抱怨如下:
note: unrestricted unions only available with -std=c++11 or -std=gnu++11
我访问了gcc网站,看到4.9包含c++11支持,所以我很困惑,为什么它不能按照上面的错误制作Ruby,下面是完整的错误输出:
make
CC = /usr/local/bin/g++-4.9
LD = ld
LDSHARED = /usr/local/bin/g++-4.9 -dynamic -bundle
CFLAGS = -O3 -fno-fast-math -ggdb3 -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -pipe
XCFLAGS = -D_FORTIFY_SOURCE=2 -fstack-protector -fno-strict-overflow -fvisibility=hidden -DRUBY_EXPORT -fPIE
CPPFLAGS = -I/usr/local/Cellar/openssl/1.0.1g/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT -I. -I.ext/include/x86_64-darwin13.0 -I./include -I.
DLDFLAGS = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -L/usr/local/Cellar/openssl/1.0.1g/lib -fstack-protector -Wl,-u,_objc_msgSend -pie -framework CoreFoundation
SOLIBS = -lgmp
Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++-4.9
COLLECT_LTO_WRAPPER=/usr/local/Cellar/gcc49/4.9.0/libexec/gcc/x86_64-apple-darwin13.1.0/4.9.0/lto-wrapper
Target: x86_64-apple-darwin13.1.0
Configured with: ../configure --build=x86_64-apple-darwin13.1.0 --prefix=/usr/local/Cellar/gcc49/4.9.0 --enable-languages=c,c++,objc,obj-c++ --program-suffix=-4.9 --with-gmp=/usr/local/opt/gmp4 --with-mpfr=/usr/local/opt/mpfr2 --with-mpc=/usr/local/opt/libmpc08 --with-cloog=/usr/local/opt/cloog018 --with-isl=/usr/local/opt/isl011 --with-system-zlib --enable-version-specific-runtime-libs --enable-libstdcxx-time=yes --enable-stage1-checking --enable-checking=release --enable-lto --disable-werror --enable-plugin --disable-nls --enable-multilib
Thread model: posix
gcc version 4.9.0 (GCC)
compiling miniprelude.c
In file included from vm_core.h:24:0,
from miniprelude.c:8:
method.h:84:19: error: member 'rb_method_attr_t rb_method_definition_struct::<anonymous union>::attr' with copy assignment operator not allowed in union
rb_method_attr_t attr;
^
method.h:84:19: note: unrestricted unions only available with -std=c++11 or -std=gnu++11
In file included from miniprelude.c:8:0:
vm_core.h:674:59: error: use of enum 'iseq_type' without previous declaration
VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE, enum iseq_type);
^
vm_core.h:677:76: error: use of enum 'iseq_type' without previous declaration
VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, VALUE);
^
vm_core.h:678:75: error: use of enum 'iseq_type' without previous declaration
VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, enum iseq_type, const rb_compile_option_t*);
^
make: *** [miniprelude.o] Error 1
正如我所写的,我真的不知道该怎么做了,所以如果有人能帮我解决这个问题,我就能安装Ruby 2.1.1了。
我使用的./configure命令是:
./configure --prefix="$HOME/.rbenv/versions/2.1.1" --with-opt-dir=/usr/local/Cellar/openssl/1.0.1g
我通过自制安装了Rbenv,所以它的bin不在~中。/rbenv,但在我的路径和系统链接的自制从:
/usr/local/bin/rbenv -> ../Cellar/rbenv/0.4.0/bin/rbenv
我看不到任何抱怨,这让我认为我可能使用错误的c编译器,但我没有看到其他人有同样的错误,他们很高兴与自制的gcc-4.9或apple-gcc42,但说实话-我不知道如何确定使用哪个。
感谢任何帮助,因为我已经浪费了太多的时间,而不是实际开发一个web应用程序。
谢谢
错误信息
note: unrestricted unions only available with -std=c++11 or -std=gnu++11
表示只有当gcc
(或g++
)以选项-std=c++11
或-std=gnu++11
启动时,某些特性才可用
因此,gcc 4.9包含对c++11的支持,但默认情况下不启用它。添加命令行选项-std=c++11
以启用支持。这些选项通常包含在CFLAGS
变量中。或者你甚至可以试着把它添加到你的抄送中。
我认为在Ruby的configure
脚本可能有错误。这个脚本应该检查所有需要的特性,并为CFLAGS
添加正确的标志,但在您的情况下,它未能将-std=c++11
添加到标志中。
相关文章:
- 如何在c++17中制作一个模板包装器/装饰器
- FFmpeg:制作一个应用程序比直接使用ffmepg更好吗
- 如何制作一个将函数作为参数的类方法
- 如何从unique_ptr制作static_cast
- 下面是我为检测链接列表中的循环而制作的代码
- 如何使用gdb制作一个可以漂亮地打印每个对象的C++函数
- 从对象文件(.o)在macos上制作归档文件(.a文件)
- 如何制作无限制照明系统
- 我试图制作一个程序,要求用户输入问题和答案,但程序循环不正确
- 什么是(或如何制作)cpp中矢量的默认初始值设定项?
- 如何在QT中制作模态QProgressDialog?
- 如何制作指向模板函数的指针?
- 可视化 如何在 c++ 中制作特定大小的文件?
- 我可以制作指向智能指针的智能指针吗?
- 为我的 c++ 类介绍制作一个三角形分类器.我有几个问题
- 如何使用用户输入变量制作二维数组?
- 我应该包含什么来制作 boost.python 扩展?
- 制作具有平均值的随机数生成器
- 如何在C++中为表面制作邻接矩阵
- 在OS X 10.9.2下使用Rbenv制作Ruby 2.1.1失败