Ubuntu: can't find ndbm.h

来源:互联网 发布:飞天侠淘宝客演示 编辑:程序博客网 时间:2024/06/05 21:07
1 down vote favorite

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

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

where is it?



1 down vote

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.



// cc -o ./store dbm_store.c -lgdbm -lgdbm_compat

#include <gdbm-ndbm.h>
#include <stdio.h>
#include <fcntl.h>
#define NAME      "Bill"
#define PHONE_NO          "123-4567"
#define DB_NAME   "phones"
main()
{
     DBM *db;
     datum name = {NAME, sizeof (NAME)};
     datum put_phone_no = {PHONE_NO, sizeof (PHONE_NO)};
     datum get_phone_no;
     /* Open the database and store the record */
     db = dbm_open(DB_NAME, O_RDWR | O_CREAT, 0660);
     (void) dbm_store(db, name, put_phone_no, DBM_INSERT);
     /* Retrieve the record */
     get_phone_no = dbm_fetch(db, name);
     (void) printf("Name: %s, Phone Number: %s\n", name.dptr, get_phone_no.dptr);
     /* Close the database */
     dbm_close(db);
     return (0);
}


#include <gdbm-ndbm.h>
#include <stdio.h>
#include <fcntl.h>
#define NAME      "Bill"
#define PHONE_NO          "123-4567"
#define DB_NAME   "phones"
main()
{
     DBM *db;
     datum name = {NAME, sizeof (NAME)};
     datum put_phone_no = {PHONE_NO, sizeof (PHONE_NO)};
     datum get_phone_no;
     /* Open the database and store the record */
     db = dbm_open(DB_NAME, O_RDWR | O_CREAT, 0660);
     (void) dbm_store(db, name, put_phone_no, DBM_INSERT);
     /* Retrieve the record */
     get_phone_no = dbm_fetch(db, name);
     (void) printf("Name: %s, Phone Number: %s\n", name.dptr,get_phone_no.dptr);
     /* Close the database */
     dbm_close(db);
     return (0);
}




0 0
原创粉丝点击