安装datastax php-driver for cassandra 的悲惨经历

由于业务可能要使用cassandra,需要安装一个php的扩展,安装过程可谓是曲折

首先直接pecl安装

pecl install cassandra

然而告诉我

checking for supported DataStax C/C++ driver version... gawk: cmd. line:1: fatal: cannot open file `/include/cassandra.h' for reading (No such file or directory)

呵呵呵呵呵呵呵,还得首先安装cpp的driver。

行吧,先安装cpp-driver,按照官网给出的步骤

git clone https://github.com/datastax/cpp-driver.git
mkdir cpp-driver/build
cd cpp-driver/build
cmake ..
make

结果就是缺少libuv啊,缺少cmake啊,其中的过程就比较曲折了,等我都把依赖工具安装完成之后,开心的编译,然而…

/home/huchao/Downloads/cpp-driver/src/timestamp_generator.cpp: In function ‘CassTimestampGen* cass_timestamp_gen_monotonic_new_with_settings(int64_t, int64_t)’:
/home/huchao/Downloads/cpp-driver/src/timestamp_generator.cpp:38: error: declaration of C function ‘CassTimestampGen* cass_timestamp_gen_monotonic_new_with_settings(int64_t, int64_t)’ conflicts with
/home/huchao/Downloads/cpp-driver/include/cassandra.h:9529: error: previous declaration ‘CassTimestampGen* cass_timestamp_gen_monotonic_new_with_settings(cass_int64_t, cass_int64_t)’ here
make[2]: *** [CMakeFiles/cpp-driver.dir/src/timestamp_generator.cpp.o] Error 1
make[1]: *** [CMakeFiles/cpp-driver.dir/all] Error 2

还能说啥

。。。

之后再检查一下环境

官网centos5/6/7都是可以的,本地centos6.5

官网gcc4.1.2+,本地4.4.7,这应该也没问题吧,想着还是和官网一样的环境吧,编译一个gcc4.1.2。

然后另一个痛苦的过程来了,结果又是出错。这个,真没办法了,就上网找找看有没有和我一样的问题,结果真找到了

原文地址:http://blog.csdn.net/firefoxbug/article/details/7519565

原文摘抄如下

源码下载:ftp://ftp.gnu.org/gnu/gcc/gcc-4.1.2/

解包:tar -xvf gcc-4.1.2.tar.bz2

进入目录:cd gcc-4.1.2

 

# ./configure –prefix=/usr/local/gcc-4.1.2&& make
 

接着就出现错误

WARNING: `makeinfo' is missing on your system. You should only need it if
you modified a `.texi' or `.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy `make' (AIX,
DU, IRIX). You might want to install the `Texinfo' package or
the `GNU make' package. Grab either from any GNU archive site.
make[3]: *** [fastjar.info] 错误 1
make[3]:正在离开目录 `/home/ssm/gcc-obj/fastjar'
make[2]: *** [all] 错误 2
make[2]:正在离开目录 `/home/ssm/gcc-obj/fastjar'
make[1]: *** [all-fastjar] 错误 2
make[1]:正在离开目录 `/home/ssm/gcc-obj'
make: *** [all] 错误 2
这里有一个文章 http://blog.csdn.NET/galois_godel/article/details/6750331

下面是摘要:

(主要原因是GCC的版本过高)

1:全英文的这部分说的是你的系统中缺少相应版本的makeinfo软件。

因为gcc4.1以上的版本需要makeinfo的版本为4.2或更高。
所以输入命令行:
makeinfo –version           想查看makeinfo的版本。结果得到了以下信息:
The program ‘makeinfo’ is currently not installed. You can install it by typing:
yum install texinfo
按照提示输入命令,问题得到解决。

2:本机使用的Texinfo是4.11版本,

出现此错误的原因也在于configure文件中texinfo对该版本不支持,可以在解压gcc4.1.1文件夹中的configure文件里找到

以下语句

# For an installed makeinfo, we require it to be from texinfo 4.2 or
# higher, else we use the “missing” dummy.
if ${MAKEINFO} –version \
| egrep ‘texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])’ >/dev/null 2>&1; then
:
else
MAKEINFO=”$MISSING makeinfo”
fi
;;

其中4\.[2-9]|[5-9]表示的是支持4.2-4.9之间的几个版本,所以需要自己添加4\.[1-9][0-9]*,以支持4.11版本。即把’texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|[5-9])’编辑成’texinfo[^0-9]*([1-3][0-9]|4\.[2-9]|4\.[1-9][0-9]*|[5-9])’后保存,编译通过。

安装:make install
这时候先查看gcc版本

#gcc -v

发现还是4.6版本的,于是就卸载4.6版本

#rpm -e gcc-c++
#rpm -e gcc 

然后建立链接

# ln -s /usr/local/gcc-4.1.2/bin/gcc /usr/bin/gcc2
# ln -s /usr/local/gcc-4.1.2/bin/g++ /usr/bin/g++2

 

赞赏

微信赞赏支付宝赞赏

发表评论

您的电子邮箱地址不会被公开。