博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
【转】Installing the libv8 Ruby gem on Centos 5.8
阅读量:5921 次
发布时间:2019-06-19

本文共 2664 字,大约阅读时间需要 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 libv8creating 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 syntaxgmake:***[out/Makefile.x64]Error1GYP_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 --versionPython2.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 installedInstalling 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.

转载地址:http://keivx.baihongyu.com/

你可能感兴趣的文章
Dubbo 生态添新兵,Dubbo Admin 发布 v0.1
查看>>
结合P2P软件使用Ansible分发大文件
查看>>
12月18日云栖精选夜读 | Java 中创建对象的 5 种方式!
查看>>
Rethink Deepfakes,浅谈深度学习落地
查看>>
阿里云搭建的最好代刷网
查看>>
android.support.v7.widget.SearchView开发记录(一)
查看>>
想做一个合格的C语言程序员,从这篇文章开始
查看>>
confluence的初步认识和了解
查看>>
Python 成功上位,正逐渐与 Java 拉开差距
查看>>
分类模型的评价方法
查看>>
中后台管理系统 HeyUI Admin 发布
查看>>
Vant Weapp 0.5.5 发布,有赞小程序 UI 组件库
查看>>
Activiti 7.1.4 发布,业务流程管理与工作流系统
查看>>
小微企业阿里云最佳实践系列(一):ECS 服务器与 RDS 数据库
查看>>
ViewModelLocator
查看>>
SQL Server Replication的分发服务器的快照文件夹位置查找
查看>>
微服务系列-Spring Cloud优质项目推荐
查看>>
WPF 图片灰度处理
查看>>
如何把高版本的sqlserver 还原到低版本的 sqlserver
查看>>
联发科向上,高通向下
查看>>