Author Topic: unable to compile with GDBM  (Read 1454 times)

Offline michael7408

  • Acquaintance
  • *
  • Posts: 5
    • View Profile
unable to compile with GDBM
« on: January 01, 2018, 10:46:58 PM »
packages/db_spec.c
Code: [Select]
#include "spec.h"

#if defined(MSQL)
string sql_escape(string);
mixed *sql_exec(string);
#endif /* MSQL, ... */

#if defined(GDBM)
int dbm_exists(string, string);
mixed dbm_query(string, string);
int dbm_store(string, string, mixed);
int dbm_delete(string, string);
string *dbm_keys(string, string|void);
#endif /* GDBM, ... */

packages/db.h
Code: [Select]
#ifndef l_db_h
#define l_db_h

#if defined(MSQL)
#include "/usr/local/include/mysql/mysql.h"

static MYSQL *dbh = NULL;

#endif /* MSQL, ... */

#if defined(GDBM)
#include "/usr/local/include/gdbm.h"

int dbm_exists (char * db, char * keystr);
svalue_t *dbm_query (char * db, char * keystr);
int dbm_store (char * db, char * key, svalue_t * val);
int dbm_delete (char * db, char * keystr);
array_t *dbm_keys (char * db, char * pattern);
#endif /* GDBM, ... */

#endif /* l_db_h */

packages/db.c
Code: [Select]
/*    Database package for the MudOS driver
 *    Designed to allow people to write datbase independent LPC
 *    Currently supports MYSQL
 *    created 960124 by George Reese
 *    No MSQL / George Reese code remains as of 20011101
 */

#include "std.h"
#include "md.h"
#include "../lpc_incl.h"
#include "../mapping.h"
#include "../comm.h"
#include "../file_incl.h"
#include "../file.h"
#include "../object.h"
#include "../eoperators.h"
#include "../backend.h"
#include "db.h"

#include <sys/types.h>
#include "/usr/local/include/pcreposix.h"

#if defined(MSQL) /* other SQL types here? */
#ifdef F_SQL_ESCAPE
void f_sql_escape (void) {
    char *s, *e;

    s = sp->u.string;

    e = (char *)DXALLOC((strlen(s) * 2) + 1, TAG_DB, "f_sql_escape");

    mysql_escape_string(e, s, strlen(s));

    pop_n_elems(1);
    copy_and_push_string(e);
    FREE(e);
}
#endif /* F_SQL_ESCAPE */

#ifdef F_SQL_EXEC
void f_sql_exec (void) {
    int i, j, f, r;
    char *q, *e;
    array_t *ret, *data;
    MYSQL_ROW   row;
    MYSQL_RES   *sth;
    MYSQL_FIELD *field;

    q = sp->u.string;

    if ((dbh = mysql_init(NULL)) == NULL) {
error("Unable to initialize SQL handle.\n");
    }

    if (mysql_real_connect(dbh, NULL, "starmud", NULL, "starmud", 0, NULL, 0) == NULL) {
mysql_close(dbh);
error("Unable to connect to SQL database.\n");
    }

    if (mysql_query(dbh, q) != 0) {
e = new_string(strlen(mysql_error(dbh)), "f_sql_exec");
strcpy(e, mysql_error(dbh));
strcat(e, "\n");
mysql_close(dbh);
        error_needs_free(e);
    }

    if ((sth = mysql_store_result(dbh)) == NULL) {
if (mysql_field_count(dbh) == 0) {
    mysql_close(dbh);
    pop_n_elems(1);
    push_refed_array(&the_null_array);
    return;
} else {
    e = new_string(strlen(mysql_error(dbh)), "f_sql_exec");
    strcpy(e, mysql_error(dbh));
    strcat(e, "\n");
    mysql_close(dbh);
    error_needs_free(e);
}
    }

    if ((r = mysql_num_rows(sth)) == 0) {
mysql_free_result(sth);
mysql_close(dbh);
pop_n_elems(1);
push_refed_array(&the_null_array);
return;
    }

    ret = allocate_empty_array(r);
    f   = mysql_num_fields(sth);

    for (i = 0; i < r; i++) {
row  = mysql_fetch_row(sth);
data = allocate_empty_array(f);

for (j = 0; j < f; j++) {
    data->item[j] = const0u;
    field         = (row ? mysql_fetch_field_direct(sth, j) : NULL);

    if (field != NULL && row[j] != NULL) {
switch (field->type) {
    case FIELD_TYPE_TINY:
    case FIELD_TYPE_SHORT:
    case FIELD_TYPE_LONG:
data->item[j].type     = T_NUMBER;
data->item[j].u.number = atoi(row[j]);
break;
    case FIELD_TYPE_FLOAT:
    case FIELD_TYPE_DOUBLE:
    case FIELD_TYPE_DECIMAL:
    case FIELD_TYPE_NEWDECIMAL:
data->item[j].type     = T_REAL;
data->item[j].u.real   = atof(row[j]);
break;
    default:
data->item[j].type     = T_STRING;
data->item[j].subtype  = STRING_MALLOC;
data->item[j].u.string = string_copy(row[j], "f_sql_exec");
break;
}
    }
}

ret->item[i].type  = T_ARRAY;
ret->item[i].u.arr = data;
    }

    mysql_free_result(sth);
    mysql_close(dbh);

    pop_n_elems(1);
    push_refed_array(ret);
}
#endif /* F_SQL_EXEC */

#endif /* MYSQL, ... */

#if defined(GDBM) /* Based on Benny Holmgren's code for dbm/lpc interface. */

#ifdef F_DBM_EXISTS
void f_dbm_exists (void) {
    int ret;

    ret = dbm_exists((sp-1)->u.string, sp->u.string);
    pop_n_elems(2);
    push_number(ret);
}
#endif

#ifdef F_DBM_QUERY
void f_dbm_query (void) {
    svalue_t *ret;

    ret = dbm_query((sp-1)->u.string, sp->u.string);
    pop_n_elems(2);
    if( ret ) {
switch( ret->type ) {
    case T_NUMBER:
push_number(ret->u.number);
break;
    case T_STRING:
copy_and_push_string(ret->u.string);
break;
    case T_REAL:
push_real(ret->u.real);
break;
    case T_ARRAY:
push_array(ret->u.arr);
break;
    case T_MAPPING:
push_mapping(ret->u.map);
break;
    default: fatal("Bogus svalue in dbm_query(), type %d\n", ret->type);
}
free_svalue(ret, "f_dbm_query");
FREE(ret);
    } else {
push_undefined();
    }
}
#endif

#ifdef F_DBM_STORE
void f_dbm_store (void) {
    int ret;

    if( !(sp->type & (T_NUMBER|T_STRING|T_REAL|T_ARRAY|T_MAPPING)) )
bad_argument(sp, (T_NUMBER|T_STRING|T_REAL|T_ARRAY|T_MAPPING), 3, F_DBM_STORE);

    ret = dbm_store((sp-2)->u.string, (sp-1)->u.string, sp);
    pop_n_elems(3);
    push_number(ret);
}
#endif

#ifdef F_DBM_DELETE
void f_dbm_delete (void) {
    int ret;

    ret = dbm_delete((sp-1)->u.string, sp->u.string);
    pop_n_elems(2);
    push_number(ret);
}
#endif

#ifdef F_DBM_KEYS
void f_dbm_keys (void) {
    array_t *ret;

    if (st_num_arg == 2) {
ret = dbm_keys((sp-1)->u.string, sp->u.string);
pop_n_elems(2);
    } else {
ret = dbm_keys(sp->u.string, (char *)NULL);
pop_n_elems(1);
    }

    if( ret ) {
push_refed_array(ret);
    } else
push_number(0);
}
#endif

int dbm_exists (char * db, char * keystr) {
    int ret;
    char *file;
    datum key;
    GDBM_FILE dbf;

    if( !(file = check_valid_path(db, current_object, "dbm_exists", 0) ) )
error("Denied read permission for database.\n");

    dbf = gdbm_open(file, 0, GDBM_READER, 0660, NULL);
    if( !dbf )
return 0;

    key.dptr = keystr;
    key.dsize = strlen(keystr) + 1;

    ret = gdbm_exists(dbf, key);

    gdbm_close(dbf);
    return ret;
}

svalue_t *dbm_query (char * db, char * keystr) {
    int ret;
    char *file;
    datum key, content;
    svalue_t *val;
    GDBM_FILE dbf;
    extern svalue_t const0u;

    if( !(file = check_valid_path(db, current_object, "dbm_query", 0) ) )
error("Denied read permission for database.\n");

    dbf = gdbm_open(file, 0, GDBM_READER, 0660, NULL);
    if( !dbf )
return (svalue_t *)NULL;

    key.dptr = keystr;
    key.dsize = strlen(keystr) + 1;

    content = gdbm_fetch(dbf, key);
    gdbm_close(dbf);
    if( !content.dptr )
return (svalue_t *)NULL;

    val = (svalue_t *)DXALLOC(sizeof(svalue_t), TAG_DB, "dbm_query");
    *val = const0u;
    ret = restore_svalue(content.dptr, val);
    free(content.dptr);
    switch( ret ) {
case -1:
    FREE((char *)val);
    error("dbm_query(): Illegal array format.\n");
case -2:
    FREE((char *)val);
    error("dbm_query(): Illegal mapping format.\n");
default: break;
    }
    return val;
}

int dbm_store (char * db, char * keystr, svalue_t * val) {
    int ret, savesize;
    datum key, content;
    char *savestr, *tmp, *file;
    GDBM_FILE dbf;
    extern int save_svalue_depth;

    if( !(file = check_valid_path(db, current_object, "dbm_store", 1) ) )
error("Denied write permission for database.\n");

    dbf = gdbm_open(file, 0, GDBM_WRCREAT, 0660, NULL);
    if( !dbf )
return 0;

    save_svalue_depth = 0;
    savesize = svalue_save_size(val);
    if (save_svalue_depth > MAX_SAVE_SVALUE_DEPTH)
error("Mappings and/or arrays nested too deep for dbm_store()\n",
      MAX_SAVE_SVALUE_DEPTH);
    savestr = (char *)DXALLOC(savesize, TAG_DB, "dbm_store");
    *savestr = '\0';
    tmp = savestr;
    save_svalue(val, &tmp);

    key.dptr = keystr;
    key.dsize = strlen(keystr) + 1;

    content.dptr = savestr;
    content.dsize = strlen(savestr) + 1;

    ret = gdbm_store(dbf, key, content, GDBM_REPLACE);
    gdbm_close(dbf);
    FREE(savestr);
    return (!ret);
}

int dbm_delete (char * db, char * keystr) {
    int ret;
    char *file;
    datum key;
    GDBM_FILE dbf;

    if( !(file = check_valid_path(db, current_object, "dbm_delete", 1) ) )
error("Denied write permission for database.\n");

    dbf = gdbm_open(file, 0, GDBM_WRITER, 0660, NULL);
    if( !dbf )
return 0;

    key.dptr = keystr;
    key.dsize = strlen(keystr) + 1;

    ret = gdbm_delete(dbf, key);
    gdbm_close(dbf);
    return (!ret);
}

array_t *dbm_keys (char * db, char * pattern) {
    array_t *ret;
    int keycnt;
    datum key, nextkey;
    char *file;
    GDBM_FILE dbf;
    regex_t rexp;
    extern int eval_cost;

    if( !(file = check_valid_path(db, current_object, "dbm_keys", 0) ) )
error("Denied read permission for database.\n");

    if( pattern ) {
if( regcomp(&rexp, pattern, REG_EXTENDED|REG_NOSUB) != 0 )
    return (array_t *)NULL;
    }

    dbf = gdbm_open(file, 0, GDBM_READER, 0660, NULL);
    if( !dbf )
return (array_t *)NULL;

    keycnt = 0;

    key = gdbm_firstkey(dbf);
    while( key.dptr ) {
nextkey = gdbm_nextkey(dbf, key);
free(key.dptr);

if( !pattern || regexec(&rexp, key.dptr, 0, NULL, 0) == 0 )
    keycnt++;

key = nextkey;
    }

    ret = allocate_empty_array(keycnt);

    key = gdbm_firstkey(dbf);
    while( key.dptr ) {
nextkey = gdbm_nextkey(dbf, key);
if( !pattern || regexec(&rexp, key.dptr, 0, NULL, 0) == 0 ) {
    --keycnt;

    ret->item[keycnt].type = T_STRING;
    ret->item[keycnt].subtype = STRING_MALLOC; /* should we make it shared? */
    ret->item[keycnt].u.string = string_copy(key.dptr, "f_dbm_keys");
}

free(key.dptr);
key = nextkey;
    }

    gdbm_close(dbf);
    if( pattern )
regfree(&rexp);

    return ret;
}
#endif /* GDBM, ... */


mv -f driver driver.old
mv: rename driver to driver.old: No such file or directory
gmake[1]: [GNUmakefile:113: driver] Error 1 (ignored)
gcc -D__USE_FIXED_PROTOTYPES__ -O2 obj/grammar.tab.o obj/lex.o obj/main.o obj/rc.o obj/interpret.o obj/simulate.o obj/file.o obj/object.o obj/backend.o obj/array.o obj/mapping.o obj/comm.o obj/ed.o obj/regexp.o obj/buffer.o obj/crc32.o obj/malloc.o obj/mallocwrapper.o obj/class.o obj/efuns_main.o obj/efuns_port.o obj/call_out.o obj/otable.o obj/dumpstat.o obj/stralloc.o obj/hash.o obj/port.o obj/reclaim.o obj/parse.o obj/simul_efun.o obj/sprintf.o obj/program.o obj/compiler.o obj/avltree.o obj/icode.o obj/trees.o obj/generate.o obj/scratchpad.o obj/socket_efuns.o obj/socket_ctrl.o obj/qsort.o obj/eoperators.o obj/socket_err.o obj/md.o obj/disassembler.o obj/uvalarm.o obj/replace_program.o obj/master.o obj/function.o obj/debug.o obj/crypt.o obj/applies_table.o obj/add_action.o obj/eval.o obj/fliconv.o obj/console.o `./dtrace_compile` -o driver packages/packages.a  `cat system_libs`
packages/packages.a(db.o): In function `dbm_exists':
db.c:(.text+0x3d4): undefined reference to `gdbm_open'
db.c:(.text+0x3f2): undefined reference to `gdbm_exists'
db.c:(.text+0x3fc): undefined reference to `gdbm_close'
packages/packages.a(db.o): In function `dbm_query':
db.c:(.text+0x486): undefined reference to `gdbm_open'
db.c:(.text+0x4a8): undefined reference to `gdbm_fetch'
db.c:(.text+0x4b3): undefined reference to `gdbm_close'
packages/packages.a(db.o): In function `dbm_store':
db.c:(.text+0x665): undefined reference to `gdbm_open'
db.c:(.text+0x6de): undefined reference to `gdbm_store'
db.c:(.text+0x6e9): undefined reference to `gdbm_close'
packages/packages.a(db.o): In function `dbm_delete':
db.c:(.text+0x7da): undefined reference to `gdbm_open'
db.c:(.text+0x7fa): undefined reference to `gdbm_delete'
db.c:(.text+0x804): undefined reference to `gdbm_close'
packages/packages.a(db.o): In function `dbm_keys':
db.c:(.text+0x8bf): undefined reference to `gdbm_open'
db.c:(.text+0x8d6): undefined reference to `gdbm_firstkey'
db.c:(.text+0x8ef): undefined reference to `gdbm_nextkey'
db.c:(.text+0x93e): undefined reference to `gdbm_firstkey'
db.c:(.text+0x957): undefined reference to `gdbm_nextkey'
db.c:(.text+0x9cf): undefined reference to `gdbm_close'
collect2: error: ld returned 1 exit status
gmake[1]: *** [GNUmakefile:114: driver] Error 1
gmake[1]: Leaving directory '/usr/home/starmud/fluffos1'
gmake: *** [GNUmakefile:84: main_build] Error 2
$


I'm unsure as to why these come up as 'undefined reference'.

Offline Adam

  • Global Moderator
  • *****
  • Posts: 69
  • Adam@DeadSoulsDev
    • View Profile
    • TheMud.ORG
Re: unable to compile with GDBM
« Reply #1 on: January 02, 2018, 12:38:25 AM »
ok is 'libgdbm-dev' installed on your system?

if not:
install the package then try ur build again. don't forget to run 'make clean'

if yes:
for some reason, fluffos isn't finding it and more information is needed for us to give you an answer
https://www.themud.org - MudList, Channel History, Channel History Search, i3 Dynamic DNS, Router Infomation

Offline michael7408

  • Acquaintance
  • *
  • Posts: 5
    • View Profile
Re: unable to compile with GDBM
« Reply #2 on: January 02, 2018, 07:09:06 PM »
Yes, it's installed and here it is:

/usr/local/include/gdbm.h
Code: [Select]
/* gdbm.h  -  The include file for dbm users.  -*- c -*- */

/*  This file is part of GDBM, the GNU data base manager, by Philip A. Nelson.
    Copyright (C) 1990-1991, 1993, 2011, 2016-2017 Free Software
    Foundation, Inc.

    GDBM is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2, or (at your option)
    any later version.

    GDBM is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with GDBM. If not, see <http://www.gnu.org/licenses/>. 

    You may contact the author by:
       e-mail:  phil@cs.wwu.edu
      us-mail:  Philip A. Nelson
                Computer Science Department
                Western Washington University
                Bellingham, WA 98226
       
*************************************************************************/

/* Protection for multiple includes. */
#ifndef _GDBM_H_
# define _GDBM_H_

# include <stdio.h>

/* GDBM C++ support */
# if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
# endif

/* Parameters to gdbm_open for READERS, WRITERS, and WRITERS who
   can create the database. */
# define GDBM_READER 0 /* A reader. */
# define GDBM_WRITER 1 /* A writer. */
# define GDBM_WRCREAT 2 /* A writer.  Create the db if needed. */
# define GDBM_NEWDB 3 /* A writer.  Always create a new db. */
# define GDBM_OPENMASK 7 /* Mask for the above. */

# define GDBM_FAST 0x010 /* Write fast! => No fsyncs.  OBSOLETE. */
# define GDBM_SYNC 0x020 /* Sync operations to the disk. */
# define GDBM_NOLOCK 0x040 /* Don't do file locking operations. */
# define GDBM_NOMMAP 0x080 /* Don't use mmap(). */
# define GDBM_CLOEXEC   0x100   /* Close the underlying fd on exec(3) */
# define GDBM_BSEXACT   0x200   /* Don't adjust block_size. Bail out with
   GDBM_BLOCK_SIZE_ERROR error if unable to
   set it. */ 
# define GDBM_CLOERROR  0x400   /* Only for gdbm_fd_open: close fd on error. */
 
/* Parameters to gdbm_store for simple insertion or replacement in the
   case that the key is already in the database. */
# define GDBM_INSERT 0 /* Never replace old data with new. */
# define GDBM_REPLACE 1 /* Always replace old data with new. */

/* Parameters to gdbm_setopt, specifing the type of operation to perform. */
# define GDBM_SETCACHESIZE    1  /* Set the cache size. */
# define GDBM_FASTMODE       2 /* Toggle fast mode.  OBSOLETE. */
# define GDBM_SETSYNCMODE     3  /* Turn on or off sync operations. */
# define GDBM_SETCENTFREE     4  /* Keep all free blocks in the header. */
# define GDBM_SETCOALESCEBLKS 5  /* Attempt to coalesce free blocks. */
# define GDBM_SETMAXMAPSIZE   6  /* Set maximum mapped memory size */
# define GDBM_SETMMAP         7  /* Toggle mmap mode */

/* Compatibility defines: */
# define GDBM_CACHESIZE      GDBM_SETCACHESIZE
# define GDBM_SYNCMODE      GDBM_SETSYNCMODE
# define GDBM_CENTFREE       GDBM_SETCENTFREE
# define GDBM_COALESCEBLKS   GDBM_SETCOALESCEBLKS

# define GDBM_GETFLAGS        8  /* Get gdbm_open flags */
# define GDBM_GETMMAP         9  /* Get mmap status */
# define GDBM_GETCACHESIZE    10 /* Get current cache side */
# define GDBM_GETSYNCMODE     11 /* Get synch mode */
# define GDBM_GETCENTFREE     12 /* Get "centfree" status */
# define GDBM_GETCOALESCEBLKS 13 /* Get free block coalesce status */
# define GDBM_GETMAXMAPSIZE   14 /* Get maximum mapped memory size */
# define GDBM_GETDBNAME       15 /* Return database file name */
# define GDBM_GETBLOCKSIZE    16 /* Return block size */

typedef unsigned long long int gdbm_count_t;
 
/* The data and key structure. */
typedef struct
{
  char *dptr;
  int   dsize;
} datum;


/* A pointer to the GDBM file. */
typedef struct gdbm_file_info *GDBM_FILE;

/* External variable, the gdbm build release string. */
extern const char *gdbm_version;

# define GDBM_VERSION_MAJOR 1
# define GDBM_VERSION_MINOR 13
# define GDBM_VERSION_PATCH 0

extern int const gdbm_version_number[3];

/* GDBM external functions. */

extern GDBM_FILE gdbm_fd_open (int fd, const char *file_name, int block_size,
       int flags, void (*fatal_func) (const char *));
extern GDBM_FILE gdbm_open (const char *, int, int, int,
    void (*)(const char *));
extern void gdbm_close (GDBM_FILE);
extern int gdbm_store (GDBM_FILE, datum, datum, int);
extern datum gdbm_fetch (GDBM_FILE, datum);
extern int gdbm_delete (GDBM_FILE, datum);
extern datum gdbm_firstkey (GDBM_FILE);
extern datum gdbm_nextkey (GDBM_FILE, datum);
extern int gdbm_reorganize (GDBM_FILE);
 
extern void gdbm_sync (GDBM_FILE);
extern int gdbm_exists (GDBM_FILE, datum);
extern int gdbm_setopt (GDBM_FILE, int, void *, int);
extern int gdbm_fdesc (GDBM_FILE);
 
extern int gdbm_export (GDBM_FILE, const char *, int, int);
extern int gdbm_export_to_file (GDBM_FILE dbf, FILE *fp);
 
extern int gdbm_import (GDBM_FILE, const char *, int);
extern int gdbm_import_from_file (GDBM_FILE dbf, FILE *fp, int flag);

extern int gdbm_count (GDBM_FILE dbf, gdbm_count_t *pcount);

typedef struct gdbm_recovery_s
{
  /* Input members.
     These are initialized before call to gdbm_recover.  The flags argument
     specifies which of them are initialized. */
  void (*errfun) (void *data, char const *fmt, ...);
  void *data;

  size_t max_failed_keys;
  size_t max_failed_buckets;
  size_t max_failures;

  /* Output members.
     The gdbm_recover function fills these before returning. */
  size_t recovered_keys;
  size_t recovered_buckets;
  size_t failed_keys;
  size_t failed_buckets;
  char *backup_name;
} gdbm_recovery;

#define GDBM_RCVR_DEFAULT              0x00  /* Default settings */
#define GDBM_RCVR_ERRFUN               0x01  /* errfun is initialized */
#define GDBM_RCVR_MAX_FAILED_KEYS      0x02  /* max_failed_keys is initialized */
#define GDBM_RCVR_MAX_FAILED_BUCKETS   0x04  /* max_failed_buckets is initialized */
#define GDBM_RCVR_MAX_FAILURES         0x08  /* max_failures is initialized */
#define GDBM_RCVR_BACKUP               0x10  /* Keep backup copy of the
original database on success */
#define GDBM_RCVR_FORCE                0x20  /* Force recovery by skipping the
check pass */
       
extern int gdbm_recover (GDBM_FILE dbf, gdbm_recovery *rcvr, int flags);
 
 
#define GDBM_DUMP_FMT_BINARY 0
#define GDBM_DUMP_FMT_ASCII  1

#define GDBM_META_MASK_MODE    0x01
#define GDBM_META_MASK_OWNER   0x02
 
extern int gdbm_dump (GDBM_FILE, const char *, int fmt, int open_flags,
      int mode);
extern int gdbm_dump_to_file (GDBM_FILE, FILE *, int fmt);

extern int gdbm_load (GDBM_FILE *, const char *, int replace,
      int meta_flags,
      unsigned long *line);
extern int gdbm_load_from_file (GDBM_FILE *, FILE *, int replace,
int meta_flags,
unsigned long *line);

extern int gdbm_copy_meta (GDBM_FILE dst, GDBM_FILE src);

# define GDBM_NO_ERROR          0
# define GDBM_MALLOC_ERROR          1
# define GDBM_BLOCK_SIZE_ERROR          2
# define GDBM_FILE_OPEN_ERROR          3
# define GDBM_FILE_WRITE_ERROR          4
# define GDBM_FILE_SEEK_ERROR          5
# define GDBM_FILE_READ_ERROR          6
# define GDBM_BAD_MAGIC_NUMBER          7
# define GDBM_EMPTY_DATABASE          8
# define GDBM_CANT_BE_READER          9
# define GDBM_CANT_BE_WRITER         10
# define GDBM_READER_CANT_DELETE 11
# define GDBM_READER_CANT_STORE         12
# define GDBM_READER_CANT_REORGANIZE 13
# define GDBM_UNKNOWN_ERROR         14
# define GDBM_ITEM_NOT_FOUND         15
# define GDBM_REORGANIZE_FAILED         16
# define GDBM_CANNOT_REPLACE         17
# define GDBM_ILLEGAL_DATA         18
# define GDBM_OPT_ALREADY_SET         19
# define GDBM_OPT_ILLEGAL            20
# define GDBM_BYTE_SWAPPED         21
# define GDBM_BAD_FILE_OFFSET         22
# define GDBM_BAD_OPEN_FLAGS         23
# define GDBM_FILE_STAT_ERROR           24
# define GDBM_FILE_EOF                  25
# define GDBM_NO_DBNAME                 26
# define GDBM_ERR_FILE_OWNER            27
# define GDBM_ERR_FILE_MODE             28
# define GDBM_NEED_RECOVERY             29
# define GDBM_BACKUP_FAILED             30
# define GDBM_DIR_OVERFLOW              31

# define _GDBM_MIN_ERRNO 0
# define _GDBM_MAX_ERRNO GDBM_DIR_OVERFLOW

/* This one was never used and will be removed in the future */
# define GDBM_UNKNOWN_UPDATE GDBM_ERR_UNKNOWN_ERROR
 
typedef int gdbm_error;
extern gdbm_error gdbm_errno;
extern const char * const gdbm_errlist[];
extern int const gdbm_syserr[];
 
extern gdbm_error gdbm_last_errno (GDBM_FILE dbf);
extern int gdbm_last_syserr (GDBM_FILE dbf);
extern void gdbm_set_errno (GDBM_FILE dbf, gdbm_error ec, int fatal);
extern void gdbm_clear_error (GDBM_FILE dbf);
extern int gdbm_needs_recovery (GDBM_FILE dbf);
extern int gdbm_check_syserr (gdbm_error n);

/* extra prototypes */

extern const char *gdbm_strerror (gdbm_error);
extern const char *gdbm_db_strerror (GDBM_FILE dbf);
 
extern int gdbm_version_cmp (int const a[], int const b[]);

#if 0
# define GDBM_DEBUG_ENABLE 1

typedef void (*gdbm_debug_printer_t) (char const *, ...);
extern gdbm_debug_printer_t gdbm_debug_printer;
extern int gdbm_debug_flags;

# define GDBM_DEBUG_ERR    0x00000001
# define GDBM_DEBUG_OPEN   0x00000002
# define GDBM_DEBUG_READ   0x00000004
# define GDBM_DEBUG_STORE  0x00000008
# define GDBM_DEBUG_LOOKUP 0x00000010
 
# define GDBM_DEBUG_ALL    0xffffffff

extern int gdbm_debug_token (char const *tok);
extern void gdbm_debug_parse_state (int (*f) (void *, int, char const *),
    void *d);
 
extern void gdbm_debug_datum (datum dat, char const *pfx);
 
#endif
 
# if defined(__cplusplus) || defined(c_plusplus)
}
# endif

#endif

Offline Adam

  • Global Moderator
  • *****
  • Posts: 69
  • Adam@DeadSoulsDev
    • View Profile
    • TheMud.ORG
Re: unable to compile with GDBM
« Reply #3 on: January 02, 2018, 07:47:19 PM »
Beats me then. Can you supply us with some more information as it will help

Driver?
Driver Version?
OS you are trying to compile on?
https://www.themud.org - MudList, Channel History, Channel History Search, i3 Dynamic DNS, Router Infomation

Offline michael7408

  • Acquaintance
  • *
  • Posts: 5
    • View Profile
Re: unable to compile with GDBM
« Reply #4 on: January 02, 2018, 09:23:50 PM »
Driver: FluffOS
Driver version: 2.23-ds03
OS: FreeBSD 11.1

It may be unrelated but could changing permissions on a file/dir may help?

Offline Adam

  • Global Moderator
  • *****
  • Posts: 69
  • Adam@DeadSoulsDev
    • View Profile
    • TheMud.ORG
Re: unable to compile with GDBM
« Reply #5 on: January 02, 2018, 11:08:30 PM »
try using the latest release from here:
https://github.com/quixadhal/fluffos/releases

apparently there were a few fixes for bsd, you never know your luck
https://www.themud.org - MudList, Channel History, Channel History Search, i3 Dynamic DNS, Router Infomation

Offline michael7408

  • Acquaintance
  • *
  • Posts: 5
    • View Profile
Re: unable to compile with GDBM
« Reply #6 on: January 03, 2018, 08:29:56 PM »
It's certainly not a bsd problem. I tried it on Ubuntu 17.10. Believe it or not, the end result is the same. The include file is exactly where it needs to be but it cannot be found for whatever reason.
« Last Edit: January 03, 2018, 08:35:12 PM by michael7408 »

Offline Adam

  • Global Moderator
  • *****
  • Posts: 69
  • Adam@DeadSoulsDev
    • View Profile
    • TheMud.ORG
Re: unable to compile with GDBM
« Reply #7 on: January 04, 2018, 01:59:36 AM »
Whats the contents of this file system_libs
https://www.themud.org - MudList, Channel History, Channel History Search, i3 Dynamic DNS, Router Infomation

Offline quixadhal

  • BFF
  • ***
  • Posts: 642
    • View Profile
    • WileyMUD
Re: unable to compile with GDBM
« Reply #8 on: January 04, 2018, 02:26:54 AM »
It's a linker error, not a compiler error.

Unresolved symbol means the linker can't find the function referenced.  Check the contents of "system_libs" to see if gdbm is in there.  It's likely that the script which builds that system_libs is broken for all but the most common use cases.

Offline michael7408

  • Acquaintance
  • *
  • Posts: 5
    • View Profile
Re: unable to compile with GDBM
« Reply #9 on: January 12, 2018, 05:27:31 PM »
Ok I see what happened. The file 'system_libs' was missing, probably due to using 'gmake distclean'. I guess that's not a good idea. Maybe I'll stay with 'gmake clean' instead. So anyway I recreated 'system_libs'.

This is what's in 'system_libs'':
 -ly -lcrypt -lm -lz -L/usr/local/lib -lgdbm -lpcreposix -lpcre -lc -L/usr/local/lib/mysql -lmysqlclient

Then I did 'gmake'.
The same linker error showed up. The file 'system_libs' changed during 'gmake'. Here's what it changed to:
 -ly -lcrypt -lm -lz -L/usr/local/lib/mysql -lmysqlclient

I recreated the file again and continued with 'gmake'. It worked successfully this time.

Why did it change during the initial 'gmake'?
« Last Edit: January 12, 2018, 05:37:52 PM by michael7408 »