4

I need to compile an old Apache version, 1.3, and the compilation process fails because:

mod_auth_dbm.c:77:18: fatal error: ndbm.h: File or directory not found 

Where is this ndbm.h file?

4 Answers 4

6

In ubuntu there is apt-file package that allows you to find package which contains specified file. You need to install it with

sudo apt-get install apt-file 

update the cache with

apt-file update 

and than you can to search the package you need with

apt-file search ndbm.h 

There is only tendra package, that contains file with such name.

Also libgdbm-dev contains /usr/include/gdbm-ndbm.h. May be it's the one you need. You can try to compile with it.

ps. Also you can use search on ubuntu site.

2
  • I don't think tendra has anything to do with this. dbm was a "database" (really a library for handling a table of a database only, part of early Unix), which in turn was replaced by ndbm (new DBM, had some licensing issues); gdbm (GNU dbm) was written to replace both. The whole sordid story is covered by Wikipedia. Perhaps there is still a ndbm-dev package in some non-free repo? Commented Mar 4, 2013 at 17:53
  • Excellent answer, equipping people with apt-file instead of just giving the answer. Commented Oct 30, 2020 at 5:30
4

That file here (Fedora 18) belongs to gdbm-devel, the package containing it for Ubuntu should be named similarly. Check the dependencies for the source, you'll probably need a swath of -devel packages corresponding to each dependency.

What do you need an outdated apache, which moreover has known vulnerabilities? Why doesn't the distribution's apache work? It is probably a much better idea to port whatever requires that apache forward than to get stuck in prehistory...

4
  • I downloaded that package but ndbm.h is still unfound because now I have gdbm.h and gdbm-ndbm.h. I need that version just because of vulnerabilities: I need to do some penetration testing using known exploits. Commented Mar 4, 2013 at 17:36
  • 1
    There is no gdbm-devel package in ubuntu. There is libgdbm-dev that is most similar by name, unfortunately it doesn't contain ndbm.h, however it contains /usr/include/gdbm-ndbm.h. Maybe it's the one is needed, Commented Mar 4, 2013 at 17:46
  • Ok, I made a symbolic link to this latter file and it worked. Problem is that now it searches for a db.h file... Commented Mar 4, 2013 at 17:53
  • db.h is part of Berkeley DB, another project to replace DBM (currently owned by Oracle, under some non-free license). Is this perhaps the config script lloking for available DBM functionality? In that case you should just leave things be. Commented Mar 4, 2013 at 17:57
1

The gdbm sources put the header files in /usr/include/gdbm. Some packaging systems (e.g. Arch Linux) put in symbolic links to those (so /usr/include/ndbm.h points to /usr/include/gdbm/ndbm.h) while at least some Debian-based systems omit the directory AND rename ndbm.h to gdbm-ndbm.h (so they have gdbm.h, dbm.h and gdbm-ndbm.h).

I assume it was to avoid some conflict with a different package, but it's a poor solution.

One way to get around such issues (especially if you don't have permissions to modify the system directories) is to create your own directory, e.g. compat, put in a link from compat/ndbm.h to /usr/include/gdbm-ndbm.h, and then tell the compiler to search your compat directory (-Icompat). Then, if it doesn't find the file in the system libraries it will find the correct name in your own directory.

1

Since Debian 10 and Ubuntu 18.04 (possibly earlier, but that’s the oldest supported release with this package), the relevant files are available in libgdbm-compat-dev:

apt install libgdbm-compat-dev 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.