【转】Installing the libv8 Ruby gem on Centos 5.8
转自:http://appsintheopen.com/posts/18-installing-the-libv8-ruby-gem-on-centos-5-8
First, Centos 5.8 ships with gcc 4.1.4, but to compile libv8 you need 4.4. Luckily, this step is easy:
$ yum install gcc44-c++
Next, you need to tell the build to make use of it. The easiest thing to do here, is to export a couple of environment variables:
$ export CC=/usr/bin/gcc44
$ export CXX=/usr/bin/g++44
Now if you attempt gem install libv8, you will get an error along the lines of:
$ gem install libv8
creating MakefileUsing compiler:/usr/bin/g++44Traceback(most recent call last):File"build/gyp/gyp", line 15,in?import gyp
File"build/gyp/pylib/gyp/__init__.py", line 8,in?import gyp.input
File"build/gyp/pylib/gyp/input.py", line 14,in?import gyp.common
File"build/gyp/pylib/gyp/common.py", line 375with open(source_path)as source_file:^SyntaxError: invalid syntax
gmake:***[out/Makefile.x64]Error1
GYP_GENERATORS=make \
build/gyp/gyp --generator-output="out" build/all.gyp \
-Ibuild/standalone.gypi --depth=. \
-Dv8_target_arch=x64 \
-S.x64 -Dhost_arch=x64
This is because the version of Python that is shipped with Centos is too old. Upgrading Python is not too hard, but be warned - do not under any circumstance replace the shipped Centos Python - lots of stuff depends on it, and it you replace it, lots of stuff will break.
To install Python 2.7:
$ yum install bzip2
$ yum install bzip2-devel
$ wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz
$ tar -xf Python-2.7.3.tgz
$ cd Python-2.7.3
$ ./configure
$ make
$ make altinstall
The final step is very important - this stops it overwriting the default Centos Python. We are on the home straight now. To get the libv8 install to use Python 2.7 instead of Python 2.4, I thought I could create a symlink in my local directory, and then slip my local directory onto the front of my path:
$ ln -s /usr/local/bin/python2.7 python
$ export PATH=.:$PATH
$ python --version
Python2.7.3
However, that didn't work.
I don't know why - maybe the Makefile explicitly references /usr/bin/python? What I did was move the existing Python executable out of the way, and symlink the Python 2.7 in its place:
$ mv /usr/bin/python /usr/bin/python_
$ ln -s /usr/local/bin/python2.7/usr/bin/python
Finally:
$ gem install libv8
( about 5 minutes later)Buildingnative extensions.This could take a while...Successfully installed libv8-3.11.8.41 gem installed
Installing ri documentation for libv8-3.11.8.4...InstallingRDoc documentation for libv8-3.11.8.4...
Now remember, to put Python back the way you found it:
$ rm /usr/bin/python
$ mv /usr/bin/python_ /usr/bin/python
Job done - finally.
【转】Installing the libv8 Ruby gem on Centos 5.8的更多相关文章
- Ruby Gem命令详解
转自:http://www.jianshu.com/p/728184da1699 Gem介绍: Gem是一个管理Ruby库和程序的标准包,它通过Ruby Gem(如 http://rubygems.o ...
- Ruby Gem命令
Gem是一个管理Ruby库和程序的标准包,它通过Ruby Gem(如 http://rubygems.org/ )源来查找.安装.升级和卸载软件包,非常的便捷. Ruby 1.9.2版本默认已安装Ru ...
- ruby gem tips(转)
淘宝源: https://ruby.taobao.org 升级ruby gem gem update --system 查看gem版本 gem -v 查看gem版本,gems安装目录,remote s ...
- Installing MySQL 5.7.23 on CentOS 7
Installing MySQL 5.7.23 on CentOS 7 1. 安装前检查 1.1 检查NUMA是否开启 NUMA为什么要咋MySQL中禁用? MySQL是单进程多线程架构数据库,当nu ...
- bundler简介(ruby gem)
簡介 Bundler RubyGem 是包裝.散佈Ruby程式庫的標準方式,相關文件可以參考 RubyGems Guides 的說明,或是 簡介 plugins 中的第二個例子.在使用rails ...
- ruby gem install rails 错误解决
最近打算看ruby. 今天用命令gem install rails的时候碰到这样的错误提示: ERROR: Error installing XXXXXXXXXXX: The ...
- ruby(&gem) koala安装
1.ruby下载安装 下载地址:http://railsinstaller.org/en 选择合适版本 2.gem(安装ruby时自带gem) 删除原镜像:gem sources --remove h ...
- 转 关于ruby gem无法连接到rubygems.org的解决方案
为什么有这个? 由于国内网络原因(你懂的),导致 rubygems.org 存放在 Amazon S3 上面的资源文件间歇性连接失败.所以你会与遇到 gem install rack 或 bundle ...
- 修改ruby gem源为ruby.taobao.org
由于网络原因,导致从rubygems.org下载gem文件较慢或者间歇性的连接失败,所以可以修改gem源为ruby.taobao.org.具体可以用 gem install rails -V 来查看执 ...
随机推荐
- poj 3181 Dollar Dayz
题意:给定一个数p,要求用K种币值分别为1,2,3...K的硬币组成p,问方案数,1,2,2和2,2,1算一种方案即与顺序无关,n <= 1000,k <= 100// 用完全背包做了 这 ...
- Chrome 实用调试技巧
Chrome 实用调试技巧 2016-07-23 如今Chrome浏览器无疑是最受前端青睐的工具,原因除了界面简洁.大量的应用插件,良好的代码规范支持.强大的V8解释器之外,还因为Chrome开发者工 ...
- hdu 3172 Virtual Friends(并查集)University of Waterloo Local Contest 2008.09
题目比较简单,但作为长久不写题之后的热身题还是不错的. 统计每组朋友的朋友圈的大小. 如果a和b是朋友,这个朋友圈的大小为2,如果b和c也是朋友,那么a和c也是朋友,此时这个朋友圈的大小为3. 输入t ...
- Android之APK文件签名——keytool和jarsigner
一.生成密钥库将位置定位在jdk的bin文件中,输入以下命名行:keytool -genkey -alias ChangeBackgroundWidget.keystore -keyalg RSA - ...
- Headmaster's Headache
题意: s门课程,现任老师有m个给出工资,和他们能教的课,现在有n个应聘的老师,给出费用和能教的课程标号,求使每门课都至少有两个老师教的最小花费 分析: n个老师选或不选有背包的特征,n很小想到用状压 ...
- HDU 5776 sum (BestCoder Round #85 A) 简单前缀判断+水题
分析:就是判断简单的前缀有没有相同,注意下自身是m的倍数,以及vis[0]=true; #include <cstdio> #include <cstdlib> #includ ...
- C ~ char int 等数据转换问题
1,char型数字转换为int型 "; printf(]-');//输出结果为3 2,int转化为char (1)字符串转换成数字,用atoi,atol,atof,分别对应的是整型,long ...
- [LeetCode] Ugly Number II (A New Question Added Today)
Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors ...
- TCMalloc优化MySQL、Nginx、Redis内存管理
TCMalloc(Thread-Caching Malloc)与标准glibc库的malloc实现一样的功能,但是TCMalloc在效率和速度效率都比标准malloc高很多.TCMalloc是 goo ...
- Spring入门(2)-通过构造器注入Bean
Spring入门(2)-通过构造器注入Bean 前一篇文章将了最基本的spring例子,这篇文章中,介绍一下带有参数的构造函数和通过构造器注入对象引用. 0. 目录 带有参数的构造函数 通过构造器注入 ...