Ruby源码编译安装
从ruby官网上下载ruby源码,https://www.ruby-lang.org/en/downloads/,解压:
./configure
make
make install
问题一:zlib
ERROR: Loading command: install (LoadError)
cannot load such file -- zlib
ERROR: While executing gem ... (NameError)
uninitialized constant Gem::Commands::InstallCommand
解决方法:
sudo apt-get install zlib1g-dev
进入ruby源码文件夹,
cd ext/zlib
ruby extconf.rb
make && make install
问题二:openssl
gem install bundle
error:Error: while executing gem (Gem::Exception)
Unable to require openssl. install openSSL and rebuilt ruby (preferred) or use non HTTPs sources
解决方法:
(一)去掉加密:(不推荐)
gem source -r https://rubygems.org/ to remove
followed by
gem source -a http://rubygems.org/ to read
(二)重新编译:
重新编译ruby,可参考:http://stackoverflow.com/questions/28924827/unable-to-compile-ruby-with-openssl
cd etc/openssl
修改Makefile 否则编译失败
加入top_srcdir = ../..
然后
./configure
make && make install
最后到 源码目录下重新编译即可
Ruby源码编译安装及zlib、openssl问题解决
本文介绍了如何从源码编译安装Ruby,包括遇到的zlib加载错误和openssl编译问题的解决方法。解决zlib问题需要安装zlib1g-dev,然后在ext/zlib目录下重新编译。对于openssl错误,有两种解决策略,一是不推荐地去掉加密,二是重新编译Ruby。
1123

被折叠的 条评论
为什么被折叠?



