bitcoin compile (.undefined reference to **')
It looks like you're having linker errors, possibly due to the way you're installing and configuring the BerkeleyDB. It would help to post the output of the ./configure command. Bitcoin-core recommends installing it using the Bitcoin PPA:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install libdb4.8-dev libdb4.8++-dev


Then you don't have to run ./configure with the LDFLAGS andCPPFLAGS for BerkeleyDB.

I would recommend following the UNIX build instructions in the repository. First download the source code for the release you want from the repository releases.

$ tar xvzf v0.17.0.tar.gz &amp;&amp; cd v0.17.0


Then follow the instructions in the link above.