<p>This bug only occurs when linking the <code>bitcoin-util</code> and <code>bitcoin-wallet</code> tools. The simplest workaround would be to disable those by adding <code>--disable-util-util --disable-util-wallet</code> to your <code>configure</code> command line.</p>
<p>If you want to build them anyway, this patch should work:</p>
<pre><code>--- 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 #
</code></pre>

CC BY-SA 4.0
2024-03-14T22:34:07.563Z
2024-03-14T22:34:07.563Z
Luke Dashjr
<p>I try to build Bitcoin Core on my Ubuntu 23.10 machine using the <a href="https://github.com/bitcoin/bitcoin/blob/master/doc/build-unix.md" rel="nofollow noreferrer">&quot;Build Unix&quot; documentation page</a> but it fails with undefined reference to <code>evhttp_uridecode</code>.</p>
<p>Here are the details:</p>
<p>I started by cloning the repo locally and using the v26.0 tag:</p>
<pre><code>git clone git@github.com:bitcoin/bitcoin.git
cd bitcoin
git checkout v26.0
</code></pre>
<p>Then installed the necessary packages:</p>
<pre><code>sudo apt update &amp;&amp; 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
</code></pre>
<p>I'm not interested in building the wallet, but just the P2P protocol, so I skipped the other installs.</p>
<p>Then starts the build phase:</p>
<pre><code>./autogen.sh
./configure --disable-bench --disable-fuzz-binary --enable-debug --without-gui \
            --enable-suppress-external-warnings --disable-wallet
make -j 4
</code></pre>
<p>This last <code>make</code> commands returns an error after some time:</p>
<pre><code>...
  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&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)':
/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&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt; const&amp;)':
/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
</code></pre>
<p>It looks like the issue is that <code>evhttp_uridecode</code> is not found. However I'm pretty sure I installed all the necessary packages.</p>
<p>If this can help, running <code>uname -a</code> on my machine returns:</p>
<pre><code>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
</code></pre>
<p>Thanks for your help.</p>

CC BY-SA 4.0
2024-03-18T11:58:59.563Z
Also see https://github.com/bitcoin/bitcoin/issues/29654.
hebasto
CC BY-SA 4.0
2024-04-19T08:49:14.140Z
This problem should go away after https://github.com/bitcoin/bitcoin/pull/29904 is merged, so hopefully in the v28 release. Until then hopefully the workaround below helps.
Sjors Provoost
<bitcoin-core><linux><ubuntu><compiling>
Build phase fails with undefined reference to `evhttp_uridecode`
Hassen
# Build phase fails with undefined reference to `evhttp_uridecode`

(Asked by: username_0 on 2024-01-02)

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 git@github.com: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, std::allocator > 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, std::allocator > 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.

**Tags:** bitcoin-core, linux, ubuntu, compiling

> **Comments:**
> **username_1**: Also see https://github.com/bitcoin/bitcoin/issues/29654.  
> **username_2**: This problem should go away after https://github.com/bitcoin/bitcoin/pull/29904 is merged, so hopefully in the v28 release. Until then hopefully the workaround below helps.  

---

## 1 answers

### Answer by username_3 on 2024-03-14. Score: 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 #


---

