Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Although, I installed libxml2 once and reinstalled it a few more times. I cannot compile c-source code because the compiler cannot find where the header file is. I am able to locate where it is (in the folder where I downloaded the tar.gz package) but I had a feeling in my guts that this package isn't installed correctly because when I tried sudo make install, it says

/bin/bash: /home/bfaskiplar/Downloads/tar.gz: No such file or directory
make[2]: *** [install-libLTLIBRARIES] Error 127
make[2]: Leaving directory `/home/bfaskiplar/Downloads/tar.gz packages/libxml2-2.8.0'
make[1]: *** [install-am] Error 2
make[1]: Leaving directory `/home/bfaskiplar/Downloads/tar.gz packages/libxml2-2.8.0'
make: *** [install-recursive] Error 1

This is why I installed synaptic package manager and reinstalled libxml2, but in this case, isn't it supposed to put header files in default directory where gcc normally searches?

Currently, I am able to compile c-source code with -I option, but I wonder why I have to copy headers manually even if I used synaptic for installation and why am I getting Error 1 and Error 2 when trying to install the package manually.

Thanks in advance

share|improve this question
up vote 1 down vote accepted

I'm not sure why you're trying to compile libxml2 exactly. You need to install libxml2-dev to be able to build sources which depend on libxml2. You can do sudo apt-get build-dep $package to install the build-dependencies for a particular source package, as well.

I'm not sure what the error in your question is exactly. There isn't enough context to say what the exact problem is, but it looks like possibly an issue with the space in the file path.

share|improve this answer
First off thanks for the answer. I wanted to install it manually rather than using apt-get install. I tried what you suggested and gcc still cannot find the header, somehow I need to put the header in one of the default directories, I guess. – bfaskiplar Jul 6 '12 at 14:32
Yes you were right, those Errors after make install were caused by the space in the path. Now, I managed to install it, but still same problem cannot include any libxml header in my code – bfaskiplar Jul 6 '12 at 14:44
You should be more explicit about your problem in your question. You are probably not looking for libxml2 properly, or adding the write include path to your compiler flags. You need to use pkg-config to get the correct compiler and linker flags. – dobey Jul 6 '12 at 17:30
Okay, I got it working by setting the right compilerflags gcc -o example xml2-config --cflags example.c `xml2-config --libs but I am still curious about why synaptic package manager didn't put the headers one of the default folders where gcc is searching for included libraries in. Header files are still in the folder where I donwloaded the package in. And second thing, what is the trick in setting the both cflags and lib xml12-config, is this something which sets every parameter to the correct value automatically? – bfaskiplar Jul 6 '12 at 18:12
It has nothing to do with synaptic. Not everything installs headers directly into /usr/include. Most modern libraries are designed to support parallel installation, and install their headers in a versioned sub-directory, so that multiple API versions can be installed and built against, on the same machine. – dobey Jul 6 '12 at 19:14

The answer is from the comments in Dobey's answer. I write it again to make it clearer.

The problem is because you have space in the path. Install it in some path which doesn't have space.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.