19

When building bitcoind on LinuxCoin (Debian based), I receive this error

"headers.h:36:20: fatal error: db_cxx.h: No such file or directory"

following the instructions at https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.txt

I believe the error is caused by the package "libdb4.8++-dev" being non-existant for the distro, as when attempting to "apt-get install" that, I get:

Package libdb4.8++-dev is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source

E: Package 'libdb4.8++-dev' has no installation candidate

NOTE: libdb4.8-dev and all other dependencies are already installed.

It's probably a silly mistake on my part but any help is appreciated! Thanks.

6
  • Do you have a db_cxx.h file anywhere? You can check with locate. Oct 9, 2011 at 15:29
  • No. I used to have the db-5.1.8 version but I removed that as the readme said I needed 4.8. Oct 9, 2011 at 15:33
  • If you don't have libdb-devel installed, it won't compile. You can use 5.1.8, just realize your files won't be compatible with builds made with earlier versions. Oct 9, 2011 at 15:53
  • Yeah. I've redownloaded and compiled 5.1.8 now and that's all okay but I'm getting the same error. Not sure how to tweak this makefile to include the db5.1.8 directories Oct 9, 2011 at 16:03
  • The makefile I am using is: pastebin.com/wGpPNjEb. My db-5.1.8 directories are located at /usr/local/BerkeleyDB.5.1/ Oct 9, 2011 at 16:13

6 Answers 6

7

You need to add -I <directory> to the end of the CXX=g++ line in the Makefile. The directory should be the one that contains the db_cxx.h file from your BerkeleyDB installation. So, change:

CXX=g++

to

CXX=g++ -I /usr/local/BerkeleyDB.5.1

You may need a /include or something like that on the end of that. It depends exactly which directory holds the db_cxx.h file.

2
  • Worked a treat with Berkeley 5.1.8, thanks. Oct 9, 2011 at 17:37
  • Yup thanks, works a treat with Berkeley 5.1.8
    – ktec
    Mar 10, 2012 at 10:28
20

I did the following command on Ubuntu and it worked.

sudo apt-get install libdb++-dev
1
  • 2
    brew install berkeley-db on Mac OS X
    – Felipe
    May 12, 2014 at 7:23
5

I think you can install the libdb4.8++-dev package if you add the stable debian repo in your sources.list.

I did it on my system (debian sid), and now I can proceed to the installation. I haven't tested the full bitcoind compilation yet, though.

1
  • 1
    libdb5.1++-dev also works, for those who would rather install later versions of packages. +1 thanks!
    – L0j1k
    Mar 10, 2013 at 23:56
1

it compiles nice with later versions but be carefull and do not mix up db*-dev and db*++-dev. Here you have to install the "++" version

1
  • Thanks, that's what I was missing ,db*++-dev instead of db*-dev
    – Squeezle
    May 24, 2013 at 6:01
0

Try this:

sudo apt-get install libdb5.3++-dev

The latest stable package, I used this on the new Bitcoin-Qt 8.3 patch from GIT and it compiled flawlessly, for any files that had that as an include.

Note:

If you are using gcc / g++ version 4.8 and you were looking for libdb4.8++-dev, there is a reason why you couldn't find an installation candidate.

Don't confuse the libdb5.3++-dev package with the version of the gcc / g++ compiler and linker, they're not part of the gcc / g++ but an add-on development library regardless of what version of the compiler you use.

0

If you're building under homebrew on MacOS, install the requisite header files via

brew install berkeley-db

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.