Trouble follwing Mastering bitcoin

Hi there!! I´m trying to follow along the book from Andreas Antonopolus (Mastering bitcoin) and I would want to do everything in the book, so Im stuck with this:

trying to install the bitcoin explorer command line tool, I realized that I needed to install the libbitcoin-client library which then made me realize I had to had installed the libbitcoin-protocol library which then made me realize that I had to had installed the libbitcoin-system library , which then requires Bosst ( some c++ libraries ) and the libbitcoin/secp256k1 library as well … long story short … I´m stuck at installing the libbitcoin-system library, because when I type the following command:

cloud76@system76:~/libbitcoin-system$ ./configure --with-boost=/usr/local/boost_1_77_0 --with-boost-libdir=/usr/lib/x86_64-linux-gnu/

after a long list of everything is OK, I get this one:

configure: error: libsecp256k1 >= 0.1.0.19 is required but was not found.

Can anyone help me try to find out how do I tell the configure command to find the secp256k1 library?? I´m running everything from an ubuntu pc … Im sure I installed the secp256k1 library correctly using autotools … but I´m stuck with this … @Alko89

Guessing that since you’re using system76 that you have PopOS installed. Then you should be able to install boost dev libraries using the package manager: sudo apt-get install libboost-all-dev.

On that note, did you check if you also already these libs available in the repos? :wink:
apt-cache search bitcoin

I checked on my sandbox machine that has ubuntu and it seems there is a libsecp256k1-dev available.

hi there @Alko89!! long time no see … I already installed all the boost libraries successfully :wink:

I ran that command : apt-cache search bitcoin

and this was the result:

base58 - base58 encode/decode: command-line interface
cgminer - multi-threaded multi-pool Bitcoin miner
golang-github-btcsuite-btcd-btcec-dev - Go library for Elliptic curve cryptography
libbase58-0 - library for Bitcoin's base58 encoding
libbase58-dev - library for Bitcoin's base58 encoding -- development files
libblkmaker-0.1-6 - implementation of getblocktemplate protocol
libblkmaker-0.1-dev - C implementation of getblocktemplate protocol - development files
libencode-base58-perl - module to shorten numbers using a base58 conversion
libsecp256k1-dev - library for EC operations on curve secp256k1 - development headers
python3-base58 - base58 encode/decode for Python
python3-bip32utils - Python implementation of Bitcoin hierarchical deterministic wallet
python3-bitcoinlib - Python module with an easy interface to the Bitcoin protocol
python3-btchip - Python library to communicate with BTChip dongle (Python 3)
python3-mnemonic - Implementation of Bitcoin BIP-0039 (Python 3)
python3-stdnum - Python module to handle standardized numbers and codes (Python3 version)
python3-trezor - library for communicating with TREZOR Bitcoin HW wallet (Python 3)
trezor - utilities for communicating with TREZOR Bitcoin HW wallet

does it make any difference on which user installs what things? For example, I installed bitcoind with a user but installed all of the libraries that we are taking about with a different user. Could it be that this is the root cause of why it seems to be that the libbitccoin-system library doesnt seem to realize that I already have a secp256 library already on my computer?? … because I installed the boost libraries, the secp256 library and the bitcoin-system library with a different user than the one that I used for installing bitcoind.

Apt cache searches the db, this doesn’t mean the package is already installed, but is available in the repos.

You can see that libsecp256k1 is already available for your system, so you can simply install it with apt install libsecp256k1-dev.

It depends how you installed these packages. If you used a package manager than these installs are system wide, you can know this when the package manager requires root permissions to run. You can also verify this by using whereis <command> which will return the path. If that command is in the PATH than the user will be able to access it, which should be the case when installing with apt, you can also check this by checking the user PATH variable (echo $PATH). If the installed directory is not in the other users PATH variable, you can expose it by using export PATH="$PATH:<MISSING_PATH>, note that export only exports the path for the current session, to make it permanent you will have to set this in the users shell config file (~/.bashrc for bash).

If you self compiled the binary then you will have to move the binary to one of these folders to make them available to other users. This can usually be done by simply running sudo make install. If there is no install command in the makefile, then you will have to move the executable manually (for example in /usr/bin or /usr/lib if its a library, and make sure to change executable user to root - chown root:root /usr/bin/<EXECUTABLE> and possibly set mode chmod 755 /usr/bin/<EXECUTABLE>).
You can also create your own folder for compiled binaries and libraries (like create bin and lib folder in /opt) and use the export path method to expose these binaries to all users, the benefit to this would be not messing up the system folders and being able to “clean up” by simply removing the contents of these folders, but it does require some setting up.

Don’t forget that when installing packages on Debian systems you usually always have to install the development files separately, to be able to compile sources that depend on them. These are the packages that have the *-dev suffix.

Hope I didn’t miss anything :grin: If I did, let me know.

https://man.archlinux.org/man/whereis.1
https://man.archlinux.org/man/export.1p
https://man.archlinux.org/man/echo.1
https://man.archlinux.org/man/chown.1
https://man.archlinux.org/man/chmod.1

hi @Alko89 !! thanks for the answer … I had been trying to make it happen, but I am really stuck here … even though I installed the libsepc256k1 library successfully, I cannot get this command to pass:

cloud76@system76:~/libbitcoin-system$ ./configure --with-boost=/usr/local/boost_1_77_0 --with-boost-libdir=/usr/lib/x86_64-linux-gnu/

I get the same output than before:

checking for secp256k1... no
configure: error: libsecp256k1 >= 0.1.0.19 is required but was not found.

and when i use whereis on bitcoind and libsecp:

cloud76@system76:~/libbitcoin-system$ whereis bitcoind
bitcoind: /usr/local/bin/bitcoind
cloud76@system76:~/libbitcoin-system$ whereis libsecp256k1
libsecp256k1: /usr/lib/x86_64-linux-gnu/libsecp256k1.a /usr/lib/x86_64-linux-gnu/libsecp256k1.so

I think I installed everything correctly

hello again!! … never mind, I think i did it :grinning:

============================================================================

Testsuite summary for libbitcoin-system 4.0.0

============================================================================

# TOTAL: 1

# PASS: 1

# SKIP: 0

# XFAIL: 0

# FAIL: 0

# XPASS: 0

# ERROR: 0

============================================================================
1 Like

Hey, great that you figured it out :raised_hands: what was the issue? :smiley:

I’m having pretty much the exact same problem you described. Any chance you could share how you managed to get past the libsecp256k1 “required but was not found” error? Thank you

@jackmachine hi mate … I couldn´t get past it … and thus, I was not able to install the bx utility … I just kept on reading, since it is not necessary for most of the book, I checked the whole book … and after I finish I will read Jimmy song´s book … I heard its quite good, though its mostly in python … every day that goes by, I´m becoming a bitcoin maxi more and more … though I still hodl some memecoins like ETH

got it. okay. well, thanks for getting back to me, I appreciate it! and if I do happen to figure it out, I will post here just in case you decide to try it out again. thanks again!

funny enough I figured it out right after I left my last comment, lol. instead of running .autogen then .configure, if I just run the “.install.sh” script it takes care of everything and installs fine (takes a long time though). hopefully it works for you and whoever happens to read this as well.

1 Like

I will try it later… hope that works for me… I´m installing tor, because my node has not allowed inbound connections … I tried opening the ports with UFW but that didnt work , so asking questions here and there, they recommended to me that I should use tor, and then everything will be fine