Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

linking libxml2

by shan_emails (Beadle)
on Jul 10, 2013 at 13:58 UTC ( #1043476=perlquestion: print w/ replies, xml ) Need Help??
shan_emails has asked for the wisdom of the Perl Monks concerning the following question:

Hi All,

I need to install Apache::Pagekit module. So now i am installing the pre-required module "XML-LibXML" for that i have download like below and try to install. it says that not able to link "libxml2". then i have download libxml2 and intalled then tried again but then also i could not able to succeed.
So shall i know how to link this installed libxml2.
Do i need to add the libxml2 installed directory(/install/others/lib) into the file "/etc/ld.so.conf" and Update the dynamic loader cache by running: ldconfig

bash-3.2$ wget http://search.cpan.org/CPAN/authors/id/S/SH/SHLOMIF/XM +L-LibXML-2.0019.tar.gz bash-3.2$ tar zxvf XML-LibXML-2.0019.tar.gz bash-3.2$ pwd /install/others/XML-LibXML-2.0019 bash-3.2$ perl Makefile.PL LIBS='-L/install/others/lib' INC='-I/instal +l/others/include' enable native perl UTF8 Checking for ability to link against xml2...no Checking for ability to link against libxml2...libxml2, zlib, and/or t +he Math library (-lm) have not been found. Try setting LIBS and INC values on the command line Or get libxml2 from http://xmlsoft.org/ If you install via RPMs, make sure you also install the -devel RPMs, as this is where the headers (.h files) are. Also, you may try to run perl Makefile.PL with the DEBUG=1 parameter to see the exact reason why the detection of libxml2 installation failed or why Makefile.PL was not able to compile a test program. bash-3.2$ bash-3.2$ bash-3.2$ bash-3.2$ bash-3.2$ perl Makefile.PL PREFIX=/install/others LIBS='-L/install/ot +hers/lib' INC='-I/install/others/include' enable native perl UTF8 Checking for ability to link against xml2...no Checking for ability to link against libxml2...libxml2, zlib, and/or t +he Math library (-lm) have not been found. Try setting LIBS and INC values on the command line Or get libxml2 from http://xmlsoft.org/ If you install via RPMs, make sure you also install the -devel RPMs, as this is where the headers (.h files) are. Also, you may try to run perl Makefile.PL with the DEBUG=1 parameter to see the exact reason why the detection of libxml2 installation failed or why Makefile.PL was not able to compile a test program. bash-3.2$
Note: I don't have root access and my Operation System is linux RedHat.

Thanks in advance
Shanmugam A.

Comment on linking libxml2
Download Code
Re: linking libxml2
by daxim (Chaplain) on Jul 10, 2013 at 14:37 UTC
    INC=-I/install/others/include/libxml2

    … which you could have figured out all by yourself if you had just followed the advice to run with DEBUG=1.

      Hi Thanks for your suggestion,
      below is the DEBUG=1 included output

      bash-3.2$ perl Makefile.PL LIBS='-L/install/others/include/libxml2' IN +C='-L/install/others/include/libxml2' DEBUG=1 running xml2-config... xml2-config --version failed *** backticks call to 'xml2-config --version' failed at Makefile.PL li +ne 212. using fallback values for LIBS and INC options: LIBS='-L/usr/local/lib -L/usr/lib -lxml2 -lz -lm' INC='-I/usr/local/include -I/usr/include' If this is wrong, Re-run as: $ /usr/bin/perl Makefile.PL LIBS='-L/path/to/lib' INC='-I/path/to/in +clude' looking for -lxml2... /usr/bin/perl Makefile.PL 'INC=-I/usr/local/incl +ude -I/usr/include' 'LIBS=-L/usr/local/lib -L/usr/lib -lxml2 -lz -lm' INC = -I/usr/local/include -I/usr/include LIBS = -L/usr/local/lib -L/usr/lib -lxml2 -lz -lm Writing Makefile for Conftest make test 'OTHERLDFLAGS=-lxml2' cp Conftest.pm blib/lib/Conftest.pm /usr/bin/perl /usr/lib/perl5/5.8.8/ExtUtils/xsubpp -typemap /usr/lib/ +perl5/5.8.8/ExtUtils/typemap Conftest.xs > Conftest.xsc && mv Confte +st.xsc Conftest.c gcc -c -I/usr/local/include -I/usr/include -D_REENTRANT -D_GNU_SOURCE + -fno-strict-aliasing -pipe -Wdeclaration-after-statement -I/usr/loca +l/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/g +dbm -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-p +rotector --param=ssp-buffer-size=4 -m64 -mtune=generic -DVERSION=\" +1\" -DXS_VERSION=\"1\" -fPIC "-I/usr/lib64/perl5/5.8.8/x86_64-linux-t +hread-multi/CORE" Conftest.c Conftest.xs:11: warning: return type defaults to âintâ Running Mkbootstrap for Conftest () chmod 644 Conftest.bs rm -f blib/arch/auto/Conftest/Conftest.so gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions - +fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic Confte +st.o -lxml2 -o blib/arch/auto/Conftest/Conftest.so \ -L/usr/local/lib -L/usr/lib -lxml2 -lz -lm \ /usr/bin/ld: cannot find -lxml2 collect2: ld returned 1 exit status make: *** [blib/arch/auto/Conftest/Conftest.so] Error 1 system call to 'make test 'OTHERLDFLAGS=-lxml2'' failed at Makefile.PL + line 188. no libxml2 not found Try setting LIBS and INC values on the command line Or get libxml2 from http://www.libxml.org/ If you install via RPMs, make sure you also install the -devel RPMs, as this is where the headers (.h files) are. bash-3.2$ pwd /install/others/XML-LibXML-1.31 bash-3.2$
      Thanks,

        LIBS='-L/install/others/include/libxml2'
        ⋮
        libxml2 not found
        
        Do you notice something? Why did you change the LIBS parameter? It's wrong now.
Re: linking libxml2
by derby (Abbot) on Jul 10, 2013 at 15:09 UTC

    I need to install Apache::Pagekit module...

    For the love of all that is holy and sacred, why? If you need to migrate a legacy system then I feel your pain but if you're starting from scratch please run far and fast from this "hasn't been updated in 9 years" framework into something a bit more modern like Catalyst or something built upon starman. The mod_perl/XML pipelines had their day and I, for one, am thankful they're over.

    -derby
Re: linking libxml2
by thomas895 (Hermit) on Jul 10, 2013 at 23:04 UTC

    libxml2 is not by itself a Perl library. XML::LibXML is simply a wrapper around the interface it provides. Therefore, you must install libxml2 to your system first. Your command lines suggest the usage of GNU/Linux. If this is indeed so, then you can use your distribution's package manager(zypper, yum, apt, or others) to quickly install libxml2. In your case, you should ask your system administrator.
    If no such system is available, then you must download the sources from their website. Then, when running the configure script, specify --prefix to be somewhere in your home directory.

    That possibility was already hinted at in the dump you provided. You might want to read it, you know. ;-)

    ~Thomas~ 
    "Excuse me for butting in, but I'm interrupt-driven..."
      I downvoted your answer because the question already said the library is installed in a custom location.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://1043476]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2014-12-25 12:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (160 votes), past polls