Gearman::XS在Centos下的编译安装方法_linux shell

本文简述了Gearman::XS在Centos下编译安装方法,供大家参考学习一下!

目前Gearman能够支持各种语言,其官网的描述如下:
 

Language Bindings/Drivers/Frameworks
Select your language – cross links to download section which details all your options.
C, C#/.NET, Go, Java, Lisp, Nodejs, PHP, Perl, Python, Ruby, Database UDFs.

 
个人尝试了C、python、perl三种语言的API,感觉perl的API功能相对来说齐全一点。Gearman::XS是perl的开源支持。其链接如下:http://search.cpan.org/~krow/Gearman-XS/

在RHEL5.7下安装的Gearman::XS,中间会出现各种问题,此处给出这些问题的解决方法供大家参考。

首先,我使用了cpanm来安装Gearman::XS,结果如下:

[@localhost yunfei]# cpanm Gearman::XS
--> Working on Gearman::XS
Fetching http://www.cpan.org/authors/id/K/KR/KROW/Gearman-XS-0.15.tar.gz ... OK
Configuring Gearman-XS-0.15 ... OK
Building and testing Gearman-XS-0.15 ... FAIL
! Installing Gearman::XS failed. See /root/.cpanm/work/1392343258.18128/build.log for details. Retry with --force to force install it.

显然force强制安装肯定是不行的,所以就找原因。查看 /root/.cpanm/work/1392343258.18128/build.log文件,发现其中有如下的提示:

gcc -c -Wall -Wundef -Wno-shadow -Wmissing-prototypes -fdiagnostics-show-option -Wformat=2 -Wstrict-aliasing -Wextra -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wno-undef -Wno-unused-value -Wno-unused-variable -Wno-unused-parameter -Wno-format-invalid-specifier -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\"0.15\" -DXS_VERSION=\"0.15\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/CORE" XS.c
cc1: error: unrecognized command line option "-Wno-format-invalid-specifier"
make: *** [XS.o] Error 1
-> FAIL Installing Gearman::XS failed.

看到是在编译的时候出了问题,所以,咱们切换到它的编译目录(即 /root/.cpanm/work/1392343258.18128/这个目录)

cd /root/.cpanm/work/1392343258.18128/Gearman-XS-0.15

然后执行make命令,就可以看到上面报的编译错误了。ok,下面就着手解决它。

vi Makefile

可以找到:

CCFLAGS = -Wall -Wundef -Wno-shadow -Wmissing-prototypes -fdiagnostics-show-option -Wformat=2 -Wstrict-aliasing -Wextra -Wmissing-declarations -Wcast-align -Wswitch-default -Wswitch-enum -Wno-undef -Wno-unused-value -Wno-unused-variable -Wno-unused-parameter -Wno-format-invalid-specifier

删掉最后的“-Wno-format-invalid-specifier”这个选项,然后保存退出,再次执行make。
 
会发现报出如下错误:

In file included from XS.xs:11:
gearman_xs.h:18:36: error: libgearman-1.0/gearman.h: No such file or directory
XS.c: In function 'XS_Gearman__XS_strerror':
XS.c:229: error: 'gearman_return_t' undeclared (first use in this function)
XS.c:229: error: (Each undeclared identifier is reported only once
XS.c:229: error: for each function it appears in.)
XS.c:229: error: expected ';' before 'rc'
XS.xs:82: warning: implicit declaration of function 'gearman_strerror'
XS.xs:82: error: 'rc' undeclared (first use in this function)
XS.xs:82: warning: assignment makes pointer from integer without a cast
make: *** [XS.o] Error 1

很明显,是找不到gearman.h,也就是说需要gearman-devel,正常情况下通过yum直接安装gearman-devel包就可以解决这个问题,但是,我的rhel是手动安装的Gearman-1.1.11版本,和yum安装的版本不一致,所以,再次打开并修改Makefile。

找到INC以及LDDLFLAGS,修改为如下内容:

LDDLFLAGS = -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -L/usr/local/gearman/lib/ -lgearman

INC = -I/usr/local/gearman/include/ -L/usr/local/gearman/lib/

可以看到就是加入了Gearman的incule以及lib相关的东西。保存退出Makefile,再次执行make,顺利通过,然后make install就安装完毕了。

以上是小编为您精心准备的的内容,在的博客、问答、公众号、人物、课程等栏目也有的相关内容,欢迎继续使用右上角搜索按钮进行搜索安装
, centos
, 编译
gearman
shell脚本、shell脚本学习指南、linux shell、shell编程、xshell,以便于您获取更多的相关知识。

时间: 2024-09-19 23:54:48

Gearman::XS在Centos下的编译安装方法_linux shell的相关文章

ubuntu+php环境下的Memcached 安装方法_Linux

目前被很多系统所使用,例如Flick.Twitter等.这是一套开放源代码软件,以BSD license授权发布.下面记录一下在lamp环境下的Memcached安装.关于Memcached的应用,这里有两篇不错的文章:<应用 memcached 提升站点性能>.<Discuz!的Memcache缓存实现> 使用apt安装memcached apt-get install memcached 启动memcached 1. 终端下使用命令 memcached就可以启动 .例如 mem

Linux下 rpm 命令查询方法_linux shell

[root@wang /]# rpm -qa // 查看安装所有包 [root@wang /]# rpm -qa |grep vim // 查询所安装的包 +包名 [root@wang /]# rpm -qi libattr-devel //查询包的安装信息 Name : libattr-devel Relocations: (not relocatable) Version : 2.4.44 Vendor: CentOS Release : 7.el6 Build Date: 2011年09月

Linux下的Memcache安装方法_Linux

Linux下Memcache服务器端的安装服务器端主要是安装memcache服务器端,目前的最新版本是 memcached-1.3.0 .下载:http://www.danga.com/memcached/dist/memcached-1.2.2.tar.gz另外,Memcache用到了libevent这个库用于Socket的处理,所以还需要安装libevent,libevent的最新版本是libevent-1.3.(如果你的系统已经安装了libevent,可以不用安装)官网:http://ww

linux下采用shell脚本实现批量为指定文件夹下图片添加水印的方法_linux shell

要实现linux下采用shell脚本批量为指定文件夹下图片添加水印,首先需要安装imagemagick: CentOS上安装: yum install ImageMagick -y Debian上安装: apt-get install ImageMagick -y 脚本: #!/bin/bash for each in /要处理的图片目录/*{.jpg,.gif} s=`du -k $each | awk '{print $1}'` if [ $s -gt 10 ]; then #convert

gearman队列持久化引发的问题及解决方法_linux shell

本文简述了gearman用mysql持久化的方法,以及由此引发的一些问题,具体分析如下: 一.gearman 创建Mysql持久化队列的方式如下: 1. 登入mysql命令行,运行:    create database gearman;  2. 启动gearman,命令如下: /usr/local/gearman/sbin/gearmand -p 4730 -L 0.0.0.0 --log-file=/tmp/gearmand-4730.log --pid-file=/tmp/gearmand

Linux下启动tomcat的方法_linux shell

tomcat是随机启动的,所以在开启服务器的时候要手动开启tomcat,不然没法访问(网上说可以设置随着服务器开启而开启,我还不会妮...) 1:找到tomcat安装路径 [root@localhost ~]# cd .. (返回上一级目录) [root@localhost /]# ls        (列出该目录下的所有文件) bin   dev  home  lib64       media  mnt  opt   root  selinux  sys       tmp  var boo

centOS下mongodb的安装

###############centOS下mongodb的安装######### mongodb作为非关系型数据库NoSQL数据库的一种,并且是属于免安装类型. mongodb安装说明:32的安装db空间有限,最大支持2G多,并且性能低于64bit.64bit系统db存储没有限制!                                  mongodb安装需要磁盘大小为15G以上,如果只是测试可以使用--smallfiles参数最小安装! 1:准备安装包:    可以到官网下载:ht

centos下yum搭建安装linux+apache+mysql+php环境的方法_Linux

一.脚本YUM源安装: 1.yum install wget #安装下载工具wget 2.wget http://www.atomicorp.com/installers/atomic #下载atomic yum源,配置CentOS 6.5第三方yum源 3. sh ./atomic #脚本执行 4. yum check-update #更新yum软件包 二.163yum源的安装 1.进入yum源配置目录 cd /etc/yum.repos.d 2.备份系统自带的yum源 mv CentOS-B

CentOS 7.0编译安装lnmp教程(Nginx1.6.0+MySQL5.6.19+PHP5.5.14)_Linux

准备篇: CentOS 7.0系统安装配置图解教程 http://www.jb51.net/os/188487.html 一.配置防火墙,开启80端口.3306端口 CentOS 7.0默认使用的是firewall作为防火墙,这里改为iptables防火墙. 1.关闭firewall: systemctl stop firewalld.service #停止firewall systemctl disable firewalld.service #禁止firewall开机启动 2.安装iptab