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

因为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.

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

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

脚本内容:

复制代码 代码如下:

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

运行:

复制代码 代码如下:

# 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

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

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

时间: 2024-09-19 08:54:40

perl操作MongoDB报错undefined symbol: HeUTF8解决方法_perl的相关文章

Apache启动提示错误undefined symbol: libiconv_open解决方法_Linux

昨晚整合apache和php是实在找不到解决办法,Google 百度都转一圈了,总算在百度找回来解决方法,记录一下,这个问题是在apache启动时出现的: ./apachectl  start提示下面的错误: 复制代码 代码如下: httpd: Syntax error on line 57 of /usr/local/apache2/conf/httpd.conf: Cannot load /usr/local/apache2/modules/libphp5.so into server: /

Yum报错“undefined symbol: CRYPTO_num_locks”问题排查

Yum无法使用,报错如下: /usr/lib64/python2.7/site-packages/pycurl.so: undefined symbol: CRYPTO_num_locks ldd /usr/lib64/python2.7/site-packages/pycurl.so 查看一下动态库连接,注意libcurl的位置 查看一下libcurl是否有什么异常的配置 ldconfig -v | grep libcurl 发现两个libcurl 检查ld.so.conf的配置 对比正常的测

oracle12c安装报错:PRVF-0002的解决方法_oracle

./runInstaller 启动图形化报错 PRVF-0002 : Could not retrieve local nodename. 查看了一下报错信息: [root@test68 OraInstall2013-09-06_04-43-39AM]# cat installActions2013-09-06_04-43-39AM.log 后几行报错: SEVERE: [FATAL] PRVF-0002 : Could not retrieve local nodename. Refer as

集成UI报错。没有找到解决方法。急需

问题描述 如题 解决方案 NSObject+EaseMob.h  类先删了,还报错的话,加我QQ 296322762,工程发我QQ邮箱,我帮你看看

node.js请求HTTPS报错:UNABLE_TO_VERIFY_LEAF_SIGNATURE\的解决方法_node.js

发现错误 最近在用Nodejs发送https请求时候,出现\"Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE\"的错误,错误如下: events.js:72 throw er; // Unhandled \'error\' event ^ Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE at SecurePair. (tls.js:1381:32) at SecurePair.emit (events.js:92:17) at

MySQL统计函数GROUP_CONCAT报错的原因及解决方法

今天在执行下面这条sql语句时,结果报错了. CREATE table car_user_content select addr_id,comm_userid,GROUP_CONCAT(comm_content) as content from (select * from forum_comment union select * from forum_comment1) as te GROUP BY addr_id,comm_userid ; 这里用到了联合函数GROUP_CONCAT,但在使

server2008中页面报错webform_postbackoptions未定义解决方法

这个指示正对server2008服务器的 第一步: 第二步: 第三步: 重启网站就可以解决错误了.

Win8电脑网络连接错误并报错118问题的解决方法

  在Win8电脑使用过程中,经常会遇到网络连接出现错误,显示错误代码118,这已经让很多用户困惑良久了.那么下面小编分享一下如何快速有效的解决网络连接错误错误代码118问题,下面就一起来学习吧! 1.使用组合快捷键win键+r键打开运行窗口,输入"cmd"点击确定打开命令窗口.如下图所示 2.在打开的命令窗口中输入"ping www.baidu.com"回车确认.如下图所示 3.检测完网速之后,点击输入"ipconfig /flushdns"回

对象-qt报错undefined reference to `vtable for btnStyle'

问题描述 qt报错undefined reference to `vtable for btnStyle' 头文件中: //错误:undefined reference to `vtable for btnStyle' class btnStyle : public QProxyStyle { Q_OBJECT public: btnStyle(); }: 构造函数如下: //出错地方 一直报错什么问题呢,我只是对qt的例子稍微改了下,但是主体框架都没改 解决方案 问题 在一个类中添加了宏 Q_