[SOLVED] What to do when you see a missing include file error like "fatal error: something.h: No such file or directory" when you build/compile/install something from source on Ubuntu Linux Server/Desktop

These are some common errors that you might face when you try to build/compile/install something from source on Ubuntu Linux Server/Desktop:

fatal error: openssl/ssl.h: No such file or directory
fatal error: zlib.h: No such file or directory
fatal error: png.h: No such file or directory
fatal error: curl/curl.h: No such file or directory
fatal error: expat.h: No such file or directory

This would be because of some missing library packages which contain these include files.

The ideal way to deal with these would be:

1. Go to http://packages.ubuntu.com/.
2. Under the main section 'Search', look for the sub-section labelled 'Search the contents of packages', and enter the following:
a) In the textbox against 'Keyword', enter the name of the file to be searched for. (eg.: "ssl.h" or "zlib.h" or "png.h" or "curl.h" or "expat.h").
b) Under the 'Display' radio buttons, choose the option labelled "packages that contain files named like this".
c) Select your Distribution, Architecture.
d) Click the Search button.
3. From the Search Results that show up, make a guess (it's usually one of the packages that have the name starting with "lib..." - eg.: when searching for 'ssl.h', I would choose 'libssl-dev').
4. Now install that package using:
sudo apt-get install packagename

That should do it.

Now try doing the build/compile/install again.

Let me know (using the Comments section below) if you face any further difficulty.

Cheers,
Anto

Comments

Nice explanation.. :)

Thanks! Nice and pragmatic approach :-).

It worked. Thanks. :)

Hey,
i have followed the above mentioned steps but haven't got any benefit ...i am getting again the same error.

In file included from /home/ravi/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/cocos2d-x-cocos2d-2.1rc0-x-2.1.2/NewTestProject/proj.android/../../cocos2dx/platform/android/CCImage.cpp:28:0:
/home/ravi/adt-bundle-linux-x86_64-20131030_Full_ADT_Working_tool/cocos2d-x-cocos2d-2.1rc0-x-2.1.2/NewTestProject/proj.android/../../cocos2dx/platform/CCImageCommon_cpp.h:33:17: fatal error: png.h: No such file or directory
compilation terminated.

I am cross compiling wpa_supplicant for raspberry pi in Ubuntu. So the libraries I install in ubuntu won't be in my arm board. Currently I am getting the error "ssh.h not found".

Your help was unpayable Anto. Saved me a lot of time and work!
Thank you!
George

Add new comment

randomness