4

I try to build Bitcoin Core on my Ubuntu 23.10 machine using the "Build Unix" documentation page but it fails with undefined reference to evhttp_uridecode.

Here are the details:

I started by cloning the repo locally and using the v26.0 tag:

git clone [email protected]:bitcoin/bitcoin.git cd bitcoin git checkout v26.0 

Then installed the necessary packages:

sudo apt update && sudo apt upgrade -y sudo apt install -y build-essential libtool autotools-dev automake pkg-config bsdmainutils python3 sudo apt install -y libevent-dev libboost-dev sudo apt install -y libzmq3-dev systemtap-sdt-dev 

I'm not interested in building the wallet, but just the P2P protocol, so I skipped the other installs.

Then starts the build phase:

./autogen.sh ./configure --disable-bench --disable-fuzz-binary --enable-debug --without-gui \ --enable-suppress-external-warnings --disable-wallet make -j 4 

This last make commands returns an error after some time:

... CXXLD libbitcoinconsensus.la AR libbitcoin_util.a CXXLD bitcoin-cli CXXLD bitcoin-tx CXXLD bitcoin-util /usr/bin/ld: libbitcoin_common.a(libbitcoin_common_a-url.o): in function `urlDecode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/hassen/Workspace/OpenSource/bitcoin/src/common/url.cpp:15:(.text+0x61): undefined reference to `evhttp_uridecode' /usr/bin/ld: libbitcoin_common.a(libbitcoin_common_a-url.o): in function `urlDecode(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)': /home/hassen/Workspace/OpenSource/bitcoin/src/common/url.cpp:15:(.text+0x61): undefined reference to `evhttp_uridecode' collect2: error: ld returned 1 exit status make[2]: *** [Makefile:7407: bitcoin-util] Error 1 make[2]: *** Waiting for unfinished jobs.... collect2: error: ld returned 1 exit status make[2]: *** [Makefile:7403: bitcoin-tx] Error 1 make[2]: Leaving directory '/home/hassen/Workspace/OpenSource/bitcoin/src' make[1]: *** [Makefile:20138: all-recursive] Error 1 make[1]: Leaving directory '/home/hassen/Workspace/OpenSource/bitcoin/src' make: *** [Makefile:814: all-recursive] Error 1 

It looks like the issue is that evhttp_uridecode is not found. However I'm pretty sure I installed all the necessary packages.

If this can help, running uname -a on my machine returns:

Linux XPS-machine 6.5.0-14-generic #14-Ubuntu SMP PREEMPT_DYNAMIC Tue Nov 14 14:59:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux 

Thanks for your help.

2

1 Answer 1

1

This bug only occurs when linking the bitcoin-util and bitcoin-wallet tools. The simplest workaround would be to disable those by adding --disable-util-util --disable-util-wallet to your configure command line.

If you want to build them anyway, this patch should work:

--- a/src/Makefile.am +++ b/src/Makefile.am @@ -715,11 +715,6 @@ libbitcoin_common_a_SOURCES = \ script/solver.cpp \ warnings.cpp \ $(BITCOIN_CORE_H) - -if USE_LIBEVENT -libbitcoin_common_a_CPPFLAGS += $(EVENT_CFLAGS) -libbitcoin_common_a_SOURCES += common/url.cpp -endif # # util # @@ -765,6 +760,11 @@ libbitcoin_util_a_SOURCES = \ util/time.cpp \ util/tokenpipe.cpp \ $(BITCOIN_CORE_H) + +if USE_LIBEVENT +libbitcoin_util_a_CPPFLAGS += $(EVENT_CFLAGS) +libbitcoin_util_a_SOURCES += common/url.cpp +endif # # cli # 

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.