转自: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的更多相关文章

  1. Ruby Gem命令详解

    转自:http://www.jianshu.com/p/728184da1699 Gem介绍: Gem是一个管理Ruby库和程序的标准包,它通过Ruby Gem(如 http://rubygems.o ...

  2. Ruby Gem命令

    Gem是一个管理Ruby库和程序的标准包,它通过Ruby Gem(如 http://rubygems.org/ )源来查找.安装.升级和卸载软件包,非常的便捷. Ruby 1.9.2版本默认已安装Ru ...

  3. ruby gem tips(转)

    淘宝源: https://ruby.taobao.org 升级ruby gem gem update --system 查看gem版本 gem -v 查看gem版本,gems安装目录,remote s ...

  4. Installing MySQL 5.7.23 on CentOS 7

    Installing MySQL 5.7.23 on CentOS 7 1. 安装前检查 1.1 检查NUMA是否开启 NUMA为什么要咋MySQL中禁用? MySQL是单进程多线程架构数据库,当nu ...

  5. bundler简介(ruby gem)

    簡介 Bundler   RubyGem 是包裝.散佈Ruby程式庫的標準方式,相關文件可以參考 RubyGems Guides 的說明,或是 簡介 plugins 中的第二個例子.在使用rails ...

  6. ruby gem install rails 错误解决

    最近打算看ruby. 今天用命令gem install rails的时候碰到这样的错误提示: ERROR:  Error installing XXXXXXXXXXX:            The ...

  7. ruby(&gem) koala安装

    1.ruby下载安装 下载地址:http://railsinstaller.org/en 选择合适版本 2.gem(安装ruby时自带gem) 删除原镜像:gem sources --remove h ...

  8. 转 关于ruby gem无法连接到rubygems.org的解决方案

    为什么有这个? 由于国内网络原因(你懂的),导致 rubygems.org 存放在 Amazon S3 上面的资源文件间歇性连接失败.所以你会与遇到 gem install rack 或 bundle ...

  9. 修改ruby gem源为ruby.taobao.org

    由于网络原因,导致从rubygems.org下载gem文件较慢或者间歇性的连接失败,所以可以修改gem源为ruby.taobao.org.具体可以用 gem install rails -V 来查看执 ...

随机推荐

  1. session服务器Nginx+Tomcat+Memcached集群Session共享

    cookie是怎样工作的? 例如,我们创立了一个名字为login的Cookie来包含访问者的信息,创立Cookie时,服务器端的Header如下面所示,这里假设访问者的注册名是“Michael Jor ...

  2. 【MySQL】MySQL for Mac 环境变量的配置

    昨天刚入的MacBookPro中配.目前已经深深爱上不能自拔. 各种快捷键.终端命令.各种编译器.系统偏好等,感觉压力好大,要学的东西好多. 入正题,项目需要MySQL,安装按照官网下载就没问题. 但 ...

  3. 【DFS】NYOJ-82 迷宫寻宝(一)-条件迷宫问题

    [题目链接:NYOJ-82] #include<iostream> #include<cstring> using namespace std; struct node{ in ...

  4. winform实现自动更新并动态调用form实现

    winform实现自动更新并动态调用form实现 标签: winform作业dllbytenull服务器 2008-08-04 17:36 1102人阅读 评论(0) 收藏 举报  分类: c#200 ...

  5. metadata lock

    1 锁等待的例子 session 1: 执行查询但不提交 mysql> begin; mysql> select * from test where c2 = '1'; session 2 ...

  6. lightoj 1023

    题意:让你输出前N个大写字母的前K个排列,按字典序,很水,直接dfs. #include<cstdio> #include<string> #include<cstrin ...

  7. 修改Zabbix默认运行账户

    默认Zabbix运行的账户是Zabbix,但在自动部署的时候,Agent与Server的先后顺序不定,而且官方不建议两者使用同一个账户.   所以,解压压缩包后,进入目录: vi configure ...

  8. 【windows核心编程】DLL相关(1)

    DLL相关的东西 1.DLL的加载方式 隐式: #pragma comment(lib, "XX.lib"); 编译器去查找名为XX.dll的DLL,除了名字相同,该DLL和该LI ...

  9. oc_转_构造对象的方法,以及类的继承

    一.构造方法 (一)构造方法的调用 完整的创建一个可用的对象:Person *p=[Person new]; New方法的内部会分别调用两个方法来完成2件事情: 1) 使用alloc方法来分配存储空间 ...

  10. Iaas概述

    IAAS :设施即服务,为开发者提供存储,计算,网络等资源,整体架构如下图: 整体分为三个部分: 1.Iaas云的管理部分:对整个云有超级用户管理权限,可以查看监控整个云中的资源,租户信息,并进行管理 ...