山狮rvm安装1.8.7 x11错误

更新到山狮后,我试着安装1.8.7,我得到错误。 没有findX11文件,我安装了Xquarkz,但没有任何改变。 怎么了?

Fail to find [tclConfig.sh, tkConfig.sh] Use MacOS X Frameworks. Find Tcl/Tk libraries. Make tcltklib.so which is required by Ruby/Tk. clang -I. -I../.. -I../../. -I../.././ext/tk -DHAVE_RB_SAFE_LEVEL -DHAVE_RB_HASH_LOOKUP -DHAVE_RB_PROC_NEW -DHAVE_RB_OBJ_TAINT -DHAVE_ST_PTR -DHAVE_ST_LEN -DRUBY_VERSION=\"1.8.7\" -DRUBY_RELEASE_DATE=\"2012-06-29\" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -DWITH_TCL_ENABLE_THREAD=0 -fno-common -g -O2 -fno-common -pipe -fno-common -c stubs.c In file included from stubs.c:10: /usr/include/tk.h:78:11: fatal error: 'X11/Xlib.h' file not found # include <X11/Xlib.h> ^ 1 error generated. make[1]: *** [stubs.o] Error 1 make: *** [all] Error 1 

尝试通过http://xquartz.macosforge.org/landing/安装X11,为编译器的X11库设置正确的path:;

 export CPPFLAGS=-I/opt/X11/include 

然后尝试重新安装ruby,传递给编译器,其中gcc-4.2是:

 CC=/usr/local/bin/gcc-4.2 rvm reinstall 1.8.7 

没有CC我得到了很多分段错误。

我设法在OSX 10.8.2上没有任何问题:

 rvm install 1.8.7 --with-gcc=clang --without-tcl --without-tk 

如果你不需要tcl或tk,并使用rbenv,这应该工作:

 brew install https://raw.github.com/Homebrew/homebrew-dupes/master/apple-gcc42.rb CC=/usr/local/bin/gcc-4.2 CONFIGURE_OPTS="--without-tcl --without-tk" rbenv install 1.8.7-p358 

即使在X11修复后,我得到这个编译错误。

 compiling stubs.c In file included from stubs.c:16: /usr/include/tk.h:23:3: error: #error Tk 8.5 must be compiled with tcl.h from Tcl 8.5 make[2]: *** [stubs.o] Error 1 make[1]: *** [ext/tk/all] Error 2 make: *** [build-ext] Error 2 

在大量的抓挠之后,我在make输出中注意到了这一行。

 Use ActiveTcl libraries (if available). 

事实certificate,我在几年前安装了ActiveTcl 8.4,但它正在从版本8.5的/ usr / include中获取tk.h。

我无法弄清楚如何安全地卸载ActiveTcl和ActiveTcl卸载说明不正确 ,但我没有安装ActiveTcl 8.5,并解决了这个问题。 ActiveTcl从这里下载 。

令人沮丧。 无论如何,希望这可以帮助别人。

这里是我的.rvmrc引导文件现在,希望它可以帮助:

 if (uname -a | grep '12.0.0 Darwin' >/dev/null); then CC=/usr/local/bin/gcc-4.2 CPPFLAGS=-I/opt/X11/include rvm --install --create --disable-tcl --disable-tk use ree@gemset_name else rvm --install --create --disable-tcl --disable-tk use ree@gemset_name fi if ! which bundle >/dev/null; then gem install bundler --pre --no-ri --no-rdoc && bundle install fi if ! bundle check >/dev/null; then bundle install fi