- Welcome to Geeksww.com
Installing Libxml2 on Ubuntu Linux
This short tutorial shows you how to install libxml2 on Ubuntu Linux Server. The process is very simple. For this tutorial, I'll be installing libxml2 version 2.6.29. Note: Do not use versions older than 2.5.10. Linux kernel is 2.6.15-26-powerpc. I have used a Mac Mini (powerpc/ppc architecture). GCC version number is 4.0.3. Your configuration may be different from mine but the installation steps below should work fine for most configurations with little or no change at all (including other Linux distributions and even unixes e.g. MacOS X).
Libxml:
According to xmlsoft.org,"Libxml2 is the XML C parser and toolkit developed for the Gnome project (but usable outside of the Gnome platform), it is free software available under the MIT License. XML itself is a metalanguage to design markup languages, i.e. text language where semantic and structure are added to the content using extra "markup" information enclosed between angle brackets. HTML is the most well-known markup language. Though the library is written in C a variety of language bindings make it available in other environments."
Before starting, please check to see if there is a latest version available to download. Visit ftp://xmlsoft.org/libxml2/ to find out about the available versions. IMPORTANT: See Configuring Ubuntu Linux After Installation to install the development tools required to compile and install libxml2 from source code.
Steps to download, compile, and install are as follows. Note: Replace 2.6.29 with your version number:
-
Downloading Libxml2:
Run the command below,wget ftp://xmlsoft.org/libxml2/libxml2-sources-2.6.29.tar.gz
-
Extracting files from the downloaded package:
tar -xvzf libxml2-sources-2.6.29.tar.gz
Now, enter the directory where the package is extracted.cd libxml2-2.6.29
-
Configuring Libxml2 Library:
./configure --prefix=/usr/local/libxml2
Replace "/usr/local/libxml2" above with the directory path where you want to copy the files and folders. Note: check for any error message. -
Compiling Libxml2:
make
Note: check for any error message.
-
Installing Libxml2:
As root (for privileges on destination directory), run the following.
With sudo,sudo make install
Without sudo,make install
Note: check for any error messages.
Thats it. Library has bee successfully installed.
Did this tutorial help a little? How about buy me a cup of coffee?
Please feel free to use the comments form below if you have any questions or need more explanation on anything. I do not guarantee a response.
IMPORTANT: You must thoroughy test any instructions on a production-like test environment first before trying anything on production systems. And, make sure it is tested for security, privacy, and safety. See our terms here.
tags cloud
popular searches
free download for mysql database server 5.1.5, bison, gearman, source code, php, install cairo, laptop, mysql, java, linux, install mysql, mysql initialization, mysql mysql, tools, ubuntu
Comments (write a comment):
Thank you. That was neat! Posted by: Balaji on Nov 17, 2010
Hi,I am trying to install libxml2-2.9.1 in Ubuntu 10.10 on a Virtual Machine using vmWare player.I followed the steps given above.The steps till configuration are working, but after executing make command I am getting the following errors.
libxml.c:14: fatal error: Python.h: No such file or directory
compilation terminated.
make[4]: *** [libxml.lo] Error 1
make[4]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1/python'
make[3]: *** [all-recursive] Error 1
make[3]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1/python'
make[2]: *** [all] Error 2
make[2]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1/python'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/abhijit/Documents/libxml2-2.9.1'
make: *** [all] Error 2
I also tried the steps given in http://www.linuxfromscratch.org/blfs/view/svn/general/libxml2.html .I am still getting the same error after configuration. Plz help Posted by: Abhi on Jun 27, 2013
Hei Abhi, i had the same issue , make sure that you have installed python on ubuntu;
go to libxml2-2.9.2/ directory and do;
sudo apt-get install python-dev Posted by: Sinai on Dec 01, 2014
in that case, install python-dev if you use ubuntu linux
sudo apt-get install python-dev Posted by: simon on Jan 05, 2015
I tried the steps above and got an error
Traceback (most recent call last):
File "./generator.py", line 1186, in ?
buildStubs()
File "./generator.py", line 556, in buildStubs
for function in sorted(functions.keys()):
NameError: global name 'sorted' is not defined
make[3]: *** [gen_prog] Error 1
make[3]: Leaving directory `/home/ationgzon/libxml2-2.7.8/python'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/asuarez/libxml2-2.7.8/python'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/asuarez/libxml2-2.7.8'
make: *** [all] Error 2 Posted by: Ailz on Sep 13, 2015
@Ailz: I haven't tried that version yet, so not sure what might be wrong.
Would it be ok fo you to test with the same version as I did in the tutorial? Posted by: geeksww on Oct 13, 2015
got libxml2-2.6.30
ran ./configure then make (as is from source directory) ok.
nanohttp.c: In function 'xmlNanoHTTPSave__internal_alias':
nanohttp.c:1597:7: warning: ignoring return value of 'write', declared with attribute warn_unused_result [-Wunused-result]
write(fd, buf, len);
^
In file included from /usr/include/fcntl.h:279:0,
from nanohttp.c:49:
In function 'open',
inlined from 'xmlNanoHTTPSave__internal_alias' at nanohttp.c:1588:12:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:24: error: call to '__open_missing_mode' declared with attribute error: open with O_CREAT in second argument needs 3 arguments
__open_missing_mode ();
^
make[2]: *** [nanohttp.lo] Error 1
make[2]: Leaving directory `/home/dave/Downloads/libxml2-2.6.30'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/dave/Downloads/libxml2-2.6.30'
make: *** [all] Error 2
appreciate any help in getting this done. Posted by: dave on Sep 05, 2016
@dave: Try using a newer version from ftp://xmlsoft.org/libxml2/ and let us know how it goes Posted by: shahryar on Sep 25, 2016
Hi Sir,
we need to update the Libxml 2.9.1 to libxml2.9.4 please provide the step so that we can deploy the installation on AwS Linux ARM server
Thanks
Anil Singh Posted by: anil S on Jan 13, 2018
a fresh install should be simple and similar to steps mentioned in this tutorial
however, an upgrade requires planning and testing (beyond the scope of this tutorial) Posted by: shahryar on Aug 18, 2018
leave a comment