# FreeBSD 8: gdbm.h: No such file or directory



## klabacita (May 3, 2010)

Hi.

I want to install http://www.csamuel.org/software/vacation/

Version vacation-1.2.7.0, the INSTALL say:


```
under FreeBSD type 'gmake' to compile
the program.   To install it you will need to do (as root) 'make install'
or, for FreeBSD, 'gmake install'."
```

But went I run "gmake" i got:

```
gcc  -g -Wall -DMAIN   -Xlinker -warn-common -D_PATH_VACATION=\"/usr/bin/vacation\" -o vacation vacation.c strlcpy.c strlcat.c rfc822.c -lgdbm
vacation.c:81:18: error: gdbm.h: No such file or directory
In file included from vacation.c:92:
vacation.h:61: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'db'
vacation.c: In function 'main':
vacation.c:200: error: 'db' undeclared (first use in this function)
vacation.c:200: error: (Each undeclared identifier is reported only once
vacation.c:200: error: for each function it appears in.)
vacation.c:200: warning: implicit declaration of function 'gdbm_open'
vacation.c:200: error: 'GDBM_NEWDB' undeclared (first use in this function)
vacation.c:200: error: 'GDBM_WRITER' undeclared (first use in this function)
vacation.c:222: warning: implicit declaration of function 'gdbm_close'
vacation.c: In function 'recent':
vacation.c:529: error: 'datum' undeclared (first use in this function)
vacation.c:529: error: expected ';' before 'key'
vacation.c:533: error: 'key' undeclared (first use in this function)
vacation.c:535: error: 'data' undeclared (first use in this function)
vacation.c:535: warning: implicit declaration of function 'gdbm_fetch'
vacation.c:535: error: 'db' undeclared (first use in this function)
vacation.c: In function 'setinterval':
vacation.c:567: error: 'datum' undeclared (first use in this function)
vacation.c:567: error: expected ';' before 'key'
vacation.c:569: error: 'key' undeclared (first use in this function)
vacation.c:571: error: 'data' undeclared (first use in this function)
vacation.c:573: warning: implicit declaration of function 'gdbm_store'
vacation.c:573: error: 'db' undeclared (first use in this function)
vacation.c:573: error: 'GDBM_REPLACE' undeclared (first use in this function)
vacation.c: In function 'setreply':
vacation.c:583: error: 'datum' undeclared (first use in this function)
vacation.c:583: error: expected ';' before 'key'
vacation.c:586: error: 'key' undeclared (first use in this function)
vacation.c:589: error: 'data' undeclared (first use in this function)
vacation.c:591: error: 'db' undeclared (first use in this function)
vacation.c:591: error: 'GDBM_REPLACE' undeclared (first use in this function)
gmake: *** [vacation] Error 1
```

I got gdbm from ports,

The Makefile is:

```
SHELL           = /bin/sh
CC              = gcc
ARCH            = $(uname -m)
OS              = $(uname -s)
#
# Default CFLAGS for all builds, architecture flags get appended below.
CFLAGS          = $(RPM_OPT_FLAGS) -g -Wall -DMAIN
ifeq "$(ARCH)" "x86_64"
# Uncomment below for backwards compatibility of gdbm files.
#  CFLAGS       = $(CFLAGS) -m32
else
ifeq "$(ARCH)" "ppc"
  CFLAGS       = $(CFLAGS) -fsigned-char
else
ifeq "$(ARCH)" "ppc64"
  CFLAGS       = $(CFLAGS) -fsigned-char
endif
endif
endif

LFLAGS          = -Xlinker -warn-common
IFLAGS          =

LIBS            = -lgdbm
LINT            = lint -abchuvx
LLIBS           =


ifeq "$(OS)" "FreeBSD"
# PREFIX for FreeBSD
PREFIX          = /usr/local
IFLAGS          = -I/usr/local/include
LIBS            = -L/usr/local/lib -lgdbm
else
# PREFIX for Linux
PREFIX          = /usr
endif
# where things go
BINDIR          = $(PREFIX)/bin
VACATION        = $(BINDIR)/vacation
VACLOOK         = $(BINDIR)/vaclook
MANDIR          = $(PREFIX)/man/man
MANEXT1         = 1

VERSION         = 1
SUBVERSION      = 2
PATCHLEVEL      = 7

# what are we making
EXTRAS          = strlcpy.c strlcat.c rfc822.c
SRC             = vacation.c $(EXTRAS)
OBJ             = vacation.o
BIN             = vacation
HDR             = vacation.h

# what we are packaging
PACKAGE         = ChangeLog Makefile README tzfile.h \
                  vacation vacation.c vacation.h *.man COPYING rfc822.c \
                  contrib vacation-1.2.6.lsm patches OLD strlcpy.c strlcat.c
TGZFILE         = vacation-$(VERSION).$(SUBVERSION).$(PATCHLEVEL).tar.gz

# rules

all:    $(BIN)

install:  all
        install -s -m 755 $(BIN) $(VACATION)
        install -m 755 vaclook $(VACLOOK)
        ./html2man.pl < vacation.html > $(MANDIR)$(MANEXT1)/vacation.$(MANEXT1)
        install -m 444 vaclook.man $(MANDIR)$(MANEXT1)/vaclook.$(MANEXT1)

vacation:       $(SRC) $(HDR)
        $(CC) $(CFLAGS) $(IFLAGS) $(PFLAGS) $(LFLAGS) -D_PATH_VACATION=\"$(VACATION)\" -o $(BIN) $(SRC) $(LIBS)

courier:        $(SRC) $(HDR)
        $(CC) $(CFLAGS) $(IFLAGS) $(PFLAGS) $(LFLAGS) -DCOURIER -D_PATH_VACATION=\"$(VACATION)\" -o $(BIN) $(SRC) $(LIBS)
debug:  $(SRC) $(HDR)
        $(CC) $(CFLAGS) $(IFLAGS) -DDEBUG $(LFLAGS) -o $(BIN) $(SRC) $(LIBS)

clean:
        rm -f *.o core *.out *~ Makefile.old vacation

clobber: clean
        rm -f $(BIN)

package: all
        strip vacation
        tar cvf - $(PACKAGE) | gzip > ../$(TGZFILE)
```

vacation.c Line 81:


```
#include <gdbm.h>
```

"In file included from vacation.c:92:" ===> static GDBM_FILE db; in vacation.h

Now, I copy /usr/local/include/gdbm.h to /usr/include

But now I got:


```
gcc  -g -Wall -DMAIN   -Xlinker -warn-common -D_PATH_VACATION=\"/usr/bin/vacation\" -o vacation vacation.c strlcpy.c strlcat.c rfc822.c -lgdbm
/usr/bin/ld: cannot find -lgdbm
gmake: *** [vacation] Error 1
```

Perl is install with gdbm, what could cause the error?

Thanks!!!


----------



## DutchDaemon (May 3, 2010)

You are trying to install the Linux port of FreeBSD's own vacation(1) program?


----------



## crsd (May 3, 2010)

You could try using vacation(1), which is in base.


----------



## klabacita (May 3, 2010)

Wow, guys I really appreciated this great forum, I didn't know that we have that small program at the ports.
 Thanks both of u!!!


----------



## SirDice (May 3, 2010)

It's not in the ports, it's part of the base freebsd operating system.


----------

