...额……还得等 arch 更新……
话说 changelog 里面有 * All symbols are now frozen.
原来以前 symbol 都不是 frozen 的……
安装吧!
rvm get stable
sed -i .bak 's!cache.ruby-lang.org/pub/ruby!ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db
rvm install 2.1.0
rbenv
brew upgrade readline openssl
brew upgrade ruby-build --HEAD
rbenv install -k -v 2.1.0
ruby-china.org
App Environments:
--------------------------------------------------------
Ruby: 2.1.0-p0
Rails: 4.0.2
真够快的……
#24 楼 @luikore 刚刚进 log 文件看了一下,第一次出现错误的是在这个地方:
compiling proc.c
compiling file.c
In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:68,
from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h:8,
from file.c:23:
/usr/include/MacTypes.h: In function ‘Debugger’:
/usr/include/MacTypes.h:699: error: expected declaration specifiers before ‘__AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_8’
/usr/include/MacTypes.h:711: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_8’
/usr/include/MacTypes.h:758: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_8’
/usr/include/MacTypes.h:770: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_8’
/usr/include/MacTypes.h:782: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__AVAILABILITY_INTERNAL__MAC_10_0_DEP__MAC_10_8’
/usr/include/MacTypes.h:792: error: expected declaration specifiers before ‘#pragma’
In file included from /System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h:8,
from file.c:23:
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:335: error: storage class specified for parameter ‘CFTypeID’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:336: error: storage class specified for parameter ‘CFOptionFlags’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:337: error: storage class specified for parameter ‘CFHashCode’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:338: error: storage class specified for parameter ‘CFIndex’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:342: error: storage class specified for parameter ‘CFTypeRef’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:344: error: storage class specified for parameter ‘CFStringRef’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:345: error: storage class specified for parameter ‘CFMutableStringRef’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:352: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘CFPropertyListRef’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:355: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘CFComparisonResult’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:362: error: expected declaration specifiers or ‘...’ before ‘*’ token
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:362: error: storage class specified for parameter ‘CFComparisonResult’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:362: error: ‘CFComparisonResult’ declared as function returning a function
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:373: error: expected specifier-qualifier-list before ‘CFIndex’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:375: error: storage class specified for parameter ‘CFRange’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:378: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘CFRangeMake’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:390: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘__CFRangeMake’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:395: error: storage class specified for parameter ‘CFNullRef’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:398: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘CFNullGetTypeID’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:401: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘kCFNull’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:411: error: storage class specified for parameter ‘CFAllocatorRef’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:415: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘kCFAllocatorDefault’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:419: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘kCFAllocatorSystemDefault’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:428: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘kCFAllocatorMalloc’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:435: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘kCFAllocatorMallocZone’
/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h:442: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘kCFAllocatorNull’
...
后面就是各种.c
文件的编译错误,难道是因为系统版本太高?
CC=`which clang` CXX=`which clang++` ./configure --prefix=$HOME/.rbenv/versions/2.1.0 --with-openssl-dir=/usr/local/opt/openssl --with-readline-dir=/usr/local/opt/readline
(如果没有 homebrew 装的 openssl, 就把 --with-openssl-dir 那项去掉)
然后检查下 Makefile 是否把 CC 设对了,然后 make install
搞定
从头安装的话
CC=`which clang` CXX=`which clang++` rbenv install -k -v 2.1.0
在极客头条翻译了一下主要的新特性:http://geek.csdn.net/news/detail/4112
收集了相关的一些资源。最后把本贴也加进去啦。
根据官方新闻,比较显著的包括:
> - 关键字参数的默认值可以忽略了。调用时需要显式给出必需的参数。 > - 整数与浮点数字面值增加了几个前缀,包括有理数'r',虚数'i'和复数'ri'。 > - def-expr 现在的返回值是名字的符号,而不再是 nil。
笹田耕一 9 月曾经对 2.1 版的更新做过演讲,演讲稿有一定参考价值。
GitHub 的 Ruby 程序员Aman Gupta有系列博客讲述 2.1 的各个改进,也不错。
#37 楼 @turingbook 看了一下,主要性能提升得地方在于 Rails startup 时间,就 Rails 处理请求效率提升有限。记得从 1.8.7 到 1.9.3,Ruby 性能大幅提升,但是 Rails 得性能提升也很有限,归结于 Rails 得性能瓶颈并不完全来自语言效率本身。
我把 Mac 的 ruby 从 2.0.0 升级到 2.1.0 了,接着把项目中的 Gemfile 的 ruby 改成 2.1.0,然后
bundle install
就报下面这个错:
Your Ruby version is 2.1.0, but your Gemfile specified 2.0.0
请问如何可以把项目的 ruby 也升级至 2.1.0?
#53 楼 @luikore 感谢指导,我终于装好了(>﹏<)。。。
/usr/bin/clang
的版本号始终没变过,最后用Compile and use LLVM 3.3 on OS X这篇文章编译了一个外部的clang
,在用CC=''
指向这个外部的clang
搞定了。
刚刚发现,在我的 Mac 里,CLT 并没有安装到/usr/bin
这个目录下,而是安装到了/Library/Developer/CommandLineTools
下面,奇了怪了。。。
也就是说,我的 Mac 里目前存在四个clang
,/usr/bin
、/Library/Developer/CommandLineTools/usr/bin
、/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/
下面都有一个,还有我自己编译的一个。目前把终端中的clang
指向第二个目录下面的clang
,在终端中查看时版本号终于正常了,如果一开始就这么干,就不用蛋疼了。
饶了很多弯路,不过这次对 Mac 的系统目录结构有了进一步的了解,也算因祸得福吧(‾▽‾)~~
#77 楼 @ksec 用 is out 没有任何问题。今天看到 https://groups.google.com/forum/#!msg/redis-db/cdy_85c1b1U/siu7MCYFBy8J 忽然想起这个帖子了。