MongoDB.so: undefined symbol: HeUTF8解决方法

管理员 mongodb1 23字数 1867阅读6分13秒阅读模式

因为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参数文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-so-undefined-symbol-heutf8/

# 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

看起来一切完好。测试脚本
脚本内容文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-so-undefined-symbol-heutf8/

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

运行文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-so-undefined-symbol-heutf8/

# 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”,只发现一篇相关文章.一群人讨论这个问题。其中一个人的解决方法如下:文章源自运维生存时间-https://www.ttlsa.com/mongodb/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.文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-so-undefined-symbol-heutf8/

实际上是因为不兼容的问题,对于系统RHEL5/CENTOS5发行版,mongodb的perl驱动最后的一个版本是v0.45
如下是国外网友的回复:文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-so-undefined-symbol-heutf8/

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文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-so-undefined-symbol-heutf8/

转载请注明出处: https://www.ttlsa.com/html/2344.html文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-so-undefined-symbol-heutf8/

参考地址:https://jira.mongodb.org/browse/PERL-247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-so-undefined-symbol-heutf8/

文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-so-undefined-symbol-heutf8/文章源自运维生存时间-https://www.ttlsa.com/mongodb/mongodb-so-undefined-symbol-heutf8/
weinxin
我的微信
微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
管理员
  • 本文由 发表于 15/08/2013 12:33:48
  • 转载请务必保留本文链接:https://www.ttlsa.com/mongodb/mongodb-so-undefined-symbol-heutf8/
评论  1  访客  0

    来自外部的引用

评论已关闭!