[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: include dirs



On Mon, 18 Sep 2000, jereme wrote:

> hi all,
> 
> 	I hope this question is directed to the correct group and not
> too redundant.  I checked the list archives and the policy manual
> before mailing this off.  What i would like is for someone to point me
> towards a good source of information about what headers i need on my
> system, where they should be, what should be in /usr/local/include,
> how the kernel tree includes fit in the picture and anything else
> related to the topic that i haven't asked, (because i don't know
> enough to ask them yet:)  I have a rudminentary understand of
> programming in C and the process of compilation and linking.  I
> understand why i need headers, i am just not sure what my system
> expects where.   I appreciate everyone time, thanks very much.

In general you need header files on your system when you compile programs
that link in libraries that are not part of the application or package
that you are compiling. The header files specify the "application
programmers interface" to those libraries. All (at least well behaved)
libraries will provide the header files necessary to use that library and
should be installed in the appropriate 'include' directory upon
installation of the library package. Now which include directory...

Normally the issue occurs because you are building an application that is
not a Debian package (or else you would just install it), so you must
compile it manually. In the more usual case (at least in my experience)
you get a compile error because an include file that is required is
not found. What I often find is that this include file is part of a
library for which a Debian package exists, but that I don't have installed
on my system. So, I install the library package using dselect or apt and
off I go continuing to build the application. You'll notice that there are
often 'lib-dev' Debian packages that correspond to the lib
package. For example there is a libc6 package and a libc6-dev package. The
libc6 package contains only the compiled library and the libc6-dev package
contains header files and object files necessary to compile and link
programs that require the standard C library. The important thing here
is: when you find you need some mysterious header file, determine the
library that it belongs to and see if there is a Debian package
(specifically a '-dev' package) for that library. Normally installation of
this will solve your problem.

Sometimes (not often in my experience) you run across an application that
you are building (no Debian package) that requires a library that also has
not been packaged for Debian. So, first you must build and install the
library manually. This is when stuff gets added to the /usr/local tree.
You build the library and it gets installed in /usr/local -- the library
in /usr/local/lib and the header files in /usr/local/include. Usually the
library build process will default to installing all if itself into
/usr/local though you can change it if you want (I recommend you don't
change it and use /usr/local for this purpose). 

Having said all this, and I hope I've been able to clear things up rather
than confuse you more, I don't think you should worry about where the
headers go. Any thing that is a Debian package will put the header files
in the "right" place, usually /usr/include, though there are exceptions.
Applications with header files that you build manually will normally put
their header files in /usr/local/include by default. So, its my opinion
that you don't really need to worry about header files too much in
general.

If you are doing C development, you'll almost certainly need to create
your own header files that are pertinent to your application, but these
should be in the directory structure of the application. These shouldn't
be installed in one of the global include directories (/usr/include or
/usr/local/include). 

The kernel source is an example of a large body of code that contains its
own internal header files. These are in the kernel source tree according
to the software engineering methodology of the kernel developers. There
isn't anything you need to do with header files for the kernel, it has all
the one's it needs. The kernel may use header files in /usr/include (I'm
not sure, I've never looked), but if so, these are placed there during a
normal Debian install I assume. I've compiled the kernel a lot of times
and never run into a header file problem. 

> post: as i said, i am looking for general information but the specific
> situation that prompted this note arose while running the configure
> script that came with cipe-1.4.2  I got this error:
> checking for kernel include tree... configure: error: no suitable
> configured kernel include tree found
> 
> it seems to be a very clear error message, i just do not have the
> knowledge of what should be where.
> 
> ./configure --help shows --includedir=DIR  C header files in DIR
>  [PREFIX/include] and PREFIX is /usr/local
> 

I have no experience with cipe but if it needs the kernel headers there
are two ways of getting them. You can install the kernel source, which
will include the headers (the kernel source is a Debian package for each
version of the kernel) . Debian also packages the kernel header files (for
each kernel version) separately that you can install if you don't
need the whole kernel source tree. The cipe build documentation should
tell you about needing the kernel headers and where it thinks they ought
to be.

Hope this helps...




Reply to: