Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Berkeley DB error when trying to build crux #16

Open
yghazi opened this issue Jul 14, 2018 · 12 comments
Open

Berkeley DB error when trying to build crux #16

yghazi opened this issue Jul 14, 2018 · 12 comments

Comments

@yghazi
Copy link

yghazi commented Jul 14, 2018

I'm trying to build crux on ubuntu 16.04. The make command fails with this log:

# github.com/blk-io/crux/vendor/github.com/jsimonetti/berkeleydb
bdb.c: In function ‘go_db_cursor’:
bdb.c:78:38: warning: passing argument 3 of ‘dbp->cursor’ from incompatible pointer type [-Wincompatible-pointer-types]
         ret = dbp->cursor(dbp, NULL, dbcp, 0);
                                      ^
bdb.c:78:38: note: expected ‘DBC ** {aka struct __dbc **}’ but argument is of type ‘DBC * {aka struct __dbc *}’

The repo (github.com/jsimonetti/berkeleydb) has been archived and is no longer being maintained. I've managed to solve the issue locally but I think it would be a good idea to fork it and fix dependencies.

@conor10
Copy link
Member

conor10 commented Jul 16, 2018

Is the build failing or are you just getting a warning? The challenge is that we want to retain BerkeleyDB support in Crux for the time being.

@yghazi
Copy link
Author

yghazi commented Jul 18, 2018

The build was failing. I think you'd be better off forking the lib github.com/jsimonetti/berkeleydb and updating the code. I could do it, if you want, since I have already resolved this.

@conor10
Copy link
Member

conor10 commented Jul 19, 2018 via email

@yghazi yghazi mentioned this issue Jul 25, 2018
@0zAND1z
Copy link

0zAND1z commented Aug 30, 2018

Hi @yghazi , changing the import spec to github.com/block360/berkeleydb is not yet solving the problem. Still getting 9 errors. Is this still WIP? Pls help, thx.

@Puneetha17
Copy link
Contributor

Hi @kggp1995
Can you please specify the error log? Is it wrt to berkeleydb?

@0zAND1z
Copy link

0zAND1z commented Aug 31, 2018

@Puneetha17 , yes.

Here's a copy from my console:

$ go get github.com/block360/berkeleydb
# github.com/block360/berkeleydb
../../../go/src/github.com/block360/berkeleydb/bdb.go:44:7: could not determine kind of name for C.DBC
../../../go/src/github.com/block360/berkeleydb/bdb.go:19:15: could not determine kind of name for C.DB_CREATE
../../../go/src/github.com/block360/berkeleydb/bdb.go:20:15: could not determine kind of name for C.DB_EXCL
../../../go/src/github.com/block360/berkeleydb/bdb.go:25:16: could not determine kind of name for C.DB_INIT_MPOOL
../../../go/src/github.com/block360/berkeleydb/bdb.go:33:14: could not determine kind of name for C.DB_QUEUE
../../../go/src/github.com/block360/berkeleydb/bdb.go:21:15: could not determine kind of name for C.DB_RDONLY
../../../go/src/github.com/block360/berkeleydb/bdb.go:22:15: could not determine kind of name for C.DB_TRUNCATE
../../../go/src/github.com/block360/berkeleydb/bdb.go:34:14: could not determine kind of name for C.DB_UNKNOWN
../../../go/src/github.com/block360/berkeleydb/bdb.go:53:9: could not determine kind of name for C.db_create
../../../go/src/github.com/block360/berkeleydb/bdb.go:229:27: could not determine kind of name for C.db_full_version
../../../go/src/github.com/block360/berkeleydb/bdb.go:245:9: could not determine kind of name for C.db_strerror
../../../go/src/github.com/block360/berkeleydb/bdb.go:210:9: could not determine kind of name for C.go_cursor_get_first
../../../go/src/github.com/block360/berkeleydb/bdb.go:221:9: could not determine kind of name for C.go_cursor_get_last
../../../go/src/github.com/block360/berkeleydb/bdb.go:188:9: could not determine kind of name for C.go_cursor_get_next
../../../go/src/github.com/block360/berkeleydb/bdb.go:199:9: could not determine kind of name for C.go_cursor_get_prev
../../../go/src/github.com/block360/berkeleydb/bdb.go:172:9: could not determine kind of name for C.go_db_cursor

clang errors for preamble:
In file included from ../../../go/src/github.com/block360/berkeleydb/bdb.go:6:
./bdb.h:5:29: error: expected parameter declarator
extern int go_db_open(DB *, DB_TXN *, char *, char *, DBTYPE, u_int32_t, int);
                            ^
/usr/include/db.h:93:17: note: expanded from macro 'DB_TXN'
#define DB_TXN          0x80000000      /* Do transactions. */
                        ^
In file included from ../../../go/src/github.com/block360/berkeleydb/bdb.go:6:
./bdb.h:5:29: error: expected ')'
/usr/include/db.h:93:17: note: expanded from macro 'DB_TXN'
#define DB_TXN          0x80000000      /* Do transactions. */
                        ^
./bdb.h:5:22: note: to match this '('
extern int go_db_open(DB *, DB_TXN *, char *, char *, DBTYPE, u_int32_t, int);
                     ^
./bdb.h:11:24: error: unknown type name 'DB_ENV'
extern int go_env_open(DB_ENV *, char *, u_int32_t, u_int32_t);
                       ^
./bdb.h:12:25: error: unknown type name 'DB_ENV'
extern int go_env_close(DB_ENV *, u_int32_t);
                        ^
./bdb.h:19:24: error: unknown type name 'DBC'
int go_db_cursor(DB *, DBC **);
                       ^
./bdb.h:20:24: error: unknown type name 'DBC'
int go_cursor_get_next(DBC *, char *, char *);
                       ^
./bdb.h:21:24: error: unknown type name 'DBC'
int go_cursor_get_prev(DBC *, char *, char *);
                       ^
./bdb.h:22:25: error: unknown type name 'DBC'
int go_cursor_get_first(DBC *, char *, char *);
                        ^
./bdb.h:23:24: error: unknown type name 'DBC'
int go_cursor_get_last(DBC *, char *, char *);
                       ^
9 errors generated.

@Puneetha17
Copy link
Contributor

To build Crux we dont need to do go get github.com/block360/berkeleydb
You can install berkeleydb using sudo apt-get update -qq && apt-get install -y -qq libdb-dev libpthread-stubs0-dev and run make setup && make, it will pull down all the dependencies and execute.

@0zAND1z
Copy link

0zAND1z commented Aug 31, 2018

@Puneetha17 , thanks for that headsup. Mac users can install berkeleydb using:
brew install berkeley-db4 and brew link berkeley-db4 --force

However, I am now encountering a new error this time for make setup && make:

$ make setup && make
go get -u github.com/golang/dep/cmd/dep
go get -u golang.org/x/tools/cmd/goimports
go get -u github.com/wadey/gocovmerge
(cd /Users/<DIR>/crux/.GOPATH/src/github.com/blk-io/crux && ./bin/dep ensure)
# github.com/blk-io/crux/vendor/github.com/block360/berkeleydb
.GOPATH/src/github.com/blk-io/crux/vendor/github.com/block360/berkeleydb/bdb.go:229:27: could not determine kind of name for C.db_full_version
make: *** [build] Error 2

@Puneetha17
Copy link
Contributor

Can you reset Crux to use github.com/jsimonetti/berkeleydb instead of github.com/block360/berkeleydb?

There should be no build errors using github.com/jsimonetti/berkeleydb

@0zAND1z
Copy link

0zAND1z commented Sep 1, 2018

@Puneetha17 , still no luck. I hope I have setup the right dependencies via homebew?

@Puneetha17
Copy link
Contributor

@kggp1995 I wonder there is something wrong with the berkelydb installation. Can you remove the berkeleydb references from the GOPATH?

@schroedingerscode
Copy link

I am seeing the same warn, however I believe it is just a warning.

Looks like berkeleydb is no longer maintained, however, so having it as a build dependency is probably not ideal long term. jsimonetti/berkeleydb#1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants