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

perl操作MongoDB报错undefined symbol: HeUTF8解决方法

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

junjie 通过本文主要向大家介绍了perl,perl语言入门,perl下载,perl语言,perl安装等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

因为shell操作mongo比较麻烦,只好尝试使用perl操作mongo,perl需要操作mongodb必须先安装相应的驱动,大部分人使用cpan安装,个人觉得太麻烦,使用cpanm安装perl模块。

# cpanm MongoDB
--> Working on MongoDB
Fetching http://www.cpan.org/authors/id/F/FR/FRIEDO/MongoDB-0.702.1.tar.gz ... OK
Configuring MongoDB-0.702.1 ... OK
Building and testing MongoDB-0.702.1 ... FAIL
! Installing MongoDB failed. See /root/.cpanm/work/1376540233.15152/build.log for details. Retry with --force to force install it.
</div>

cpanm报错了,使用–force参数

# cpanm MongoDB --force
--> Working on MongoDB
Fetching http://www.cpan.org/authors/id/F/FR/FRIEDO/MongoDB-0.702.1.tar.gz ... OK
Configuring MongoDB-0.702.1 ... OK
Building and testing MongoDB-0.702.1 ... FAIL
! Testing MongoDB-0.702.1 failed but installing it anyway.
Successfully installed MongoDB-0.702.1 (upgraded from 0.702.0)
1 distribution installe
</div>

看起来一切完好。测试脚本

脚本内容:

# cat /root/testMongo.pl
#!/usr/bin/perl
use MongoDB;
my $connection = MongoDB::Connection->new( host => 'localhost', port => 27017);
</div>

运行:

# perl /root/testMongo.pl
/usr/bin/perl: symbol lookup error: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/MongoDB/MongoDB.so: undefined symbol: HeUTF8
</div>

google查询“MongoDB.so: undefined symbol: HeUTF8”,只发现一篇相关文章.一群人讨论这个问题。其中一个人的解决方法如下:

# wget http://search.cpan.org/CPAN/authors/id/F/FR/FRIEDO/MongoDB-0.701.4.tar.gz
# tar -xzvf MongoDB-0.701.4.tar.gz
# cd MongoDB-0.701.4
添加如下内容到perl_mongo.h:
/* supply HeUTF8 if it's missing - ppport.h doesn't supply it, unfortunately */
 #ifndef HeUTF8
 #define HeUTF8(he) ((HeKLEN(he) == HEf_SVKEY) ? \
 SvUTF8(HeKEY_sv(he)) : \
 (U32)HeKUTF8(he))
 #endif
# perl Makefile.PL
# make
# make install
</div>

perl脚本运行ok.

实际上是因为不兼容的问题,对于系统RHEL5/CENTOS5发行版,mongodb的perl驱动最后的一个版本是v0.45

如下是国外网友的回复:

The latest version to compile, test and install properly on Rhel5/Centos5 is v0.45 by KRISTINA. (requires Any::Moose)
https://metacpan.org/release/KRISTINA/MongoDB-0.45

</div>

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

  • Perl与JS的对比分析(数组、哈希)
  • 使用Perl生成随机密码
  • perl 简明教程 perl教程集合
  • Perl中的单行注释和多行注释语法
  • Perl基本数组排序方法介绍
  • Perl中怎样从数组中删除某个值?
  • Perl中捕获警告信息、异常信息并写入日志详解
  • Perl删除前导和拖尾空白(删除左右空格、空白字符)
  • About Perl(翻译Perl官网介绍)
  • Perl学习笔记之文件操作

相关文章

  • perl写的一个随机编故事的程序(rand随机函数)
  • Perl语法中Perl运算符用法指南
  • Perl中怎样从数组中删除某个值?
  • perl跳过首行读取文件的实现代码
  • Perl split字符串分割函数用法指南
  • perl常问题集合之一
  • Perl实现的Linux下socket代理服务器
  • Perl内置特殊变量总结
  • Perl实现删除Windows下的图片缓存缩略图Thumbs.db
  • Perl 哈希的创建和引用介绍

文章分类

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

最近更新的内容

    • 关于Perl里面正则表达式规范
    • Perl eval函数使用实例
    • Perl中捕获警告信息、异常信息并写入日志详解
    • 使用perl实现拆分数据表(mysql)并迁移数据实例
    • perl中heredoc使用说明
    • Perl文件句柄详解
    • Perl哈希表用法解析
    • 两段Perl脚本代码(数组应用与say用法)
    • Perl访问MSSQL并迁移到MySQL数据库脚本实例
    • perl文件包含(do,require,use)指令介绍

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

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