Bug when building v22.1.0 on Ubuntu 16.04
Having same issue when building Bitcoin Cash Node v22.1.0 as described here - https://github.com/Bitcoin-ABC/bitcoin-abc/issues/400
Here is a fix in case of Bitcoin ABC - https://github.com/Bitcoin-ABC/bitcoin-abc/commit/15dc0ccc20c1fabb5950ff66f11f1a0aa525c909
Can you guys please port it into the Bitcoin Cash Node code?
Thanks.
Describe the issue
With new build system introduced it seems some dependencies / libraries are still checked from the system instead of the depends directory, there might be an error in CMake / Ninja scripts.
Before new compilation system I was using old one (autotools) and it was working just fine on the same system.
Can you reliably reproduce the issue?
If so, please list the steps to reproduce below:
- Get v22.1.0 tag.
- Use this script for building Bitcoin Cash Node by using depends system:
#!/bin/bash
VER=$(git describe --tags)
daemon=$(pname=$(pwd); echo ${pname##/*/})
# build dependencies (bitcoin-cash specific)
CC=/usr/bin/gcc CXX=/usr/bin/g++ make -j4 -C depends HOST=x86_64-linux-gnu NO_ZMQ=1 NO_QT=1 NO_UPNP=1
DEPENDS="$(pwd)/depends/x86_64-linux-gnu"
rm -rf build
mkdir build -p
cd build
cmake -GNinja .. -DENABLE_QRCODE=OFF -DENABLE_UPNP=OFF -DBUILD_BITCOIN_ZMQ=OFF -DBUILD_BITCOIN_QT=OFF -DCMAKE_TOOLCHAIN_FILE=../cmake/platforms/Linux64.cmake
if [ "$?" != 0 ]; then
echo "[-] Configure FAILED"
exit 1
fi
#make -j8
ninja
if [ "$?" == 0 ]; then
echo "Build succeeded!"
else
echo "Build Failed."
fi
- Instead of using libevent inside depends directory Bitcoin Cash Node tries to use system libevent-2.0.21-stable:
$ ./build.sh
...
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of __int128
-- Check size of __int128 - done
-- Found OpenSSL: /home/build/bcash/source/depends/x86_64-linux-gnu/lib/libcrypto.a (found version "1.0.1k") found components: Crypto
-- Found Boost 1.70.0 at /home/build/bcash/source/depends/x86_64-linux-gnu/lib/cmake/Boost-1.70.0
-- Requested configuration: QUIET REQUIRED COMPONENTS filesystem
-- Found boost_headers 1.70.0 at /home/build/bcash/source/depends/x86_64-linux-gnu/lib/cmake/boost_headers-1.70.0
-- Found boost_filesystem 1.70.0 at /home/build/bcash/source/depends/x86_64-linux-gnu/lib/cmake/boost_filesystem-1.70.0
-- libboost_filesystem-mt-x64.a
-- Adding boost_filesystem dependencies: headers
-- Found Boost: /home/build/bcash/source/depends/x86_64-linux-gnu/lib/cmake/Boost-1.70.0/BoostConfig.cmake (found suitable version "1.70.0", minimum required is "1.59") found components: filesystem
-- Found Boost 1.70.0 at /home/build/bcash/source/depends/x86_64-linux-gnu/lib/cmake/Boost-1.70.0
-- Requested configuration: QUIET REQUIRED COMPONENTS thread
-- Found boost_thread 1.70.0 at /home/build/bcash/source/depends/x86_64-linux-gnu/lib/cmake/boost_thread-1.70.0
-- libboost_thread-mt-x64.a
-- Adding boost_thread dependencies: headers
-- Found Boost: /home/build/bcash/source/depends/x86_64-linux-gnu/lib/cmake/Boost-1.70.0/BoostConfig.cmake (found suitable version "1.70.0", minimum required is "1.59") found components: thread
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Found Event component event: /home/build/bcash/source/depends/x86_64-linux-gnu/lib/libevent.a
CMake Error at /usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:165 (message):
Could NOT find Event: Found unsuitable version "2.0.21-stable", but
required is at least "2.0.22" (found
/home/build/bcash/source/depends/x86_64-linux-gnu/include, found
components: event)
Call Stack (most recent call first):
/usr/share/cmake-3.18/Modules/FindPackageHandleStandardArgs.cmake:456 (_FPHSA_FAILURE_MESSAGE)
cmake/modules/FindEvent.cmake:90 (find_package_handle_standard_args)
cmake/modules/NativeExecutable.cmake:25 (find_package)
src/CMakeLists.txt:510 (non_native_target_link_libraries)
src/CMakeLists.txt:513 (link_event)
-- Configuring incomplete, errors occurred!
See also "/home/build/bcash/source/build/CMakeFiles/CMakeOutput.log".
See also "/home/build/bcash/source/build/CMakeFiles/CMakeError.log".
[-] Configure FAILED
- There is libevent installed globally:
$ dpkg -l|grep libevent-
ii libevent-2.0-5:amd64 2.0.21-stable-2ubuntu0.16.04.1 amd64 Asynchronous event notification library
ii libevent-core-2.0-5:amd64 2.0.21-stable-2ubuntu0.16.04.1 amd64 Asynchronous event notification library (core)
ii libevent-dev 2.0.21-stable-2ubuntu0.16.04.1 amd64 Asynchronous event notification library (development files)
ii libevent-extra-2.0-5:amd64 2.0.21-stable-2ubuntu0.16.04.1 amd64 Asynchronous event notification library (extra)
ii libevent-openssl-2.0-5:amd64 2.0.21-stable-2ubuntu0.16.04.1 amd64 Asynchronous event notification library (openssl)
ii libevent-pthreads-2.0-5:amd64 2.0.21-stable-2ubuntu0.16.04.1 amd64 Asynchronous event notification library (pthreads)
- Inside the depends system libevent has the correct version:
$ ls -al depends/built/x86_64-linux-gnu/libevent/libevent-2.1.11-stable-b91e0c623cd.tar.gz
-rw-rw-r-- 1 build build 461274 Sep 22 15:06 depends/built/x86_64-linux-gnu/libevent/libevent-2.1.11-stable-b91e0c623cd.tar.gz
Expected behaviour
Bitcoin Cash Node should be compiling using depends system fine ignoring libraries installed globally.
Actual behaviour
Bitcoin Cash Node compilation fails
What version of bitcoin-cash node are you using?
v22.1
Machine specs:
- OS: Ubuntu 16.04.6 LTS