国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Perl > 正文

perl操作MongoDB報錯undefined symbol: HeUTF8解決方法

2020-06-04 20:32:43
字體:
來源:轉載
供稿:網友

因為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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 庆安县| 泗水县| 霞浦县| 大同县| 油尖旺区| 阿勒泰市| 策勒县| 乳源| 甘肃省| 梁山县| 额济纳旗| 河北区| 韶山市| 于都县| 高邑县| 定远县| 杭锦旗| 邵武市| 武胜县| 伊吾县| 安徽省| 海宁市| 大港区| 万全县| 武邑县| 嘉黎县| 沾益县| 济源市| 习水县| 鄂托克旗| 吉林市| 申扎县| 保定市| 虞城县| 顺义区| 交口县| 庆城县| 阿拉善左旗| 巍山| 璧山县| 侯马市|