• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >linux shell > Gearman::XS在Centos下的编译安装方法

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

作者:shichen2014 字体:[增加 减小] 来源:互联网

shichen2014 通过本文主要向大家介绍了gearman,gearman php,gearman java,gearman worker,电脑怎么安装xs表格等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

本文简述了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.
</div>

 
个人尝试了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.
</div>

显然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.

</div>

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

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

</div>

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

vi Makefile

</div>

可以找到:

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

</div>

删掉最后的“-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

</div>

很明显,是找不到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/

</div>

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

</div>

您可能想查找下面的文章:

  • Gearman::XS在Centos下的编译安装方法
  • gearman队列持久化引发的问题及解决方法
  • rhel5.7下安装gearmand及启动的方法

相关文章

  • Shell脚本实现监控iptables运行状态
  • Shell 编程:Bash空格的那点事
  • Linux BASH多进程并行处理的方法实现
  • shell备份文件、重命名文件、删除指定文件的3个脚本分享
  • 使用Bash Shell获取文件名和目录名的简单方法
  • Linux 中的nc命令小结
  • Shell中使用plink工具实现远程批量关机
  • php编译安装常见错误大全和解决方法
  • Linux 命令每天必学(34)之du命令
  • Shell脚本中获取本机ip地址的3个方法

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • 一天一个shell命令 linux文本操作系列-tree命令详解
    • Shell中获取脚本所在目录绝对路径的方法
    • shell中的数组操作小结和冒泡排序实现脚本分享
    • linux脚本实现自动发送和收取邮件的设置方法
    • Linux进程控制详解及实例
    • Shell脚本读取标准ini配置文件Demo
    • linux定时任务基础命令介绍(14)
    • linux用户与文件基础命令介绍(1)
    • shell监控linux系统进程创建脚本分享
    • Shell获取文件的文件名和扩展名的例子

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有