Perl Operation MongoDB Error undefined Symbol:heutf8 resolution _perl

Source: Internet
Author: User
Tags mongodb install perl perl script

Because the shell operation MONGO more troublesome, had to try to use Perl operation Mongo,perl need to operate MongoDB must first install the appropriate driver, most people use CPAN installation, personal feel too troublesome, use Cpanm install Perl module.

Copy Code code as follows:

# 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 the error, use the –force parameter

Copy Code code as follows:

# 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

Everything seems to be in good condition. Test scripts

Script content:

Copy Code code as follows:

# cat/root/testmongo.pl
#!/usr/bin/perl
Use MongoDB;
My $connection = mongodb::connection->new (host => ' localhost ', port => 27017);

Run:

Copy Code code as follows:

# 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 query "MongoDB.so:undefined Symbol:heutf8", only found a related article. A group of people discussed the problem. One of the solutions for this one is as follows:

Copy Code code as follows:

# 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
Add the following to Perl_mongo.h:
/* Supply HeUTF8 if it ' s missing-ppport.h doesn ' t supply it, unfortunately * *
#ifndef HeUTF8
#define HEUTF8 (Heklen (HE) = Hef_svkey)? \
SvUTF8 (HEKEY_SV (HE)): \
(U32) HeKUTF8 (He))
#endif
# Perl makefile.pl
# make
# make Install

Perl script runs OK.

In fact, because of incompatible issues, for the system Rhel5/centos5 release, the last version of MongoDB's Perl drive is v0.45

The following is a reply from a foreign netizen:

The latest version to compile, test and install properly on RHEL5/CENTOS5 was v0.45 by KRISTINA. (Requires Any::moose)
https://metacpan.org/release/KRISTINA/MongoDB-0.45

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.