Bitcoin-ABC / bitcoin-abc

Bitcoin ABC develops node software and infrastructure for the eCash project. This a mirror of the official Bitcoin-ABC repository. Please see README.md
https://reviews.bitcoinabc.org
MIT License
1.24k stars 779 forks source link

Can't build v0.22.2 #400

Closed gituser closed 4 years ago

gituser commented 4 years ago

Describe the issue

With new build system introduced in v0.22.2 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:

  1. Get v0.22.2 tag.
  2. Use this script for building Bitcoin-ABC by using depends system:
    
    #!/bin/bash
    VER=$(git describe --tags)
    daemon=$(pname=$(pwd); echo ${pname##/*/})

build dependencies (bitcoin-abc 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


3. Instead of using libevent inside depends directory Bitcoin-ABC tries to use system libevent-2.0.21-stable:

$ ./build.sh make: Entering directory '/home/build/bitcoinabc/source/depends' copying packages: native_protobuf boost openssl libevent bdb protobuf jemalloc to: /home/build/bitcoinabc/source/depends/x86_64-linux-gnu make: Leaving directory '/home/build/bitcoinabc/source/depends' -- Using ccache: /usr/bin/ccache -- Looking for builtin_clz -- Looking for __builtin_clz - found -- Looking for builtin_clzl -- Looking for builtin_clzl - found -- Looking for __builtin_clzll -- Looking for builtin_clzll - found -- Looking for __builtin_popcount -- Looking for __builtin_popcount - found -- Check if jemalloc needs libdl - FALSE -- Found Boost 1.70.0 at /home/build/bitcoinabc/source/depends/x86_64-linux-gnu/lib/cmake/Boost-1.70.0 -- Requested configuration: QUIET REQUIRED COMPONENTS chrono;filesystem;thread -- Found boost_headers 1.70.0 at /home/build/bitcoinabc/source/depends/x86_64-linux-gnu/lib/cmake/boost_headers-1.70.0 -- Found boost_chrono 1.70.0 at /home/build/bitcoinabc/source/depends/x86_64-linux-gnu/lib/cmake/boost_chrono-1.70.0 -- libboost_chrono-mt-x64.a -- Adding boost_chrono dependencies: headers -- Found boost_filesystem 1.70.0 at /home/build/bitcoinabc/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_thread 1.70.0 at /home/build/bitcoinabc/source/depends/x86_64-linux-gnu/lib/cmake/boost_thread-1.70.0 -- libboost_thread-mt-x64.a -- Adding boost_thread dependencies: headers CMake Error at /usr/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message): Could NOT find Event: Found unsuitable version "2.0.21-stable", but required is at least "2.0.22" (found /home/build/bitcoinabc/source/depends/x86_64-linux-gnu/include) Call Stack (most recent call first): /usr/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:443 (_FPHSA_FAILURE_MESSAGE) cmake/modules/FindEvent.cmake:84 (find_package_handle_standard_args) src/CMakeLists.txt:391 (find_package)

-- Configuring incomplete, errors occurred! See also "/home/build/bitcoinabc/source/build/CMakeFiles/CMakeOutput.log". See also "/home/build/bitcoinabc/source/build/CMakeFiles/CMakeError.log". [-] Configure FAILED


4. 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)


5. 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-ABC should be compiling using depends system fine ignoring libraries installed globally.

### Actual behaviour
Bitcoin-ABC compilation fails

### What version of bitcoin-abc are you using?
v0.22.2

### Machine specs:
- OS: Ubuntu 16.04.6 LTS
gituser commented 4 years ago

Ping @jasonbcox

laakie commented 4 years ago

Having a lot of trouble building with cmake as well Ubuntu 18.04 Found unsuitable version "1.58.0", but required is at least "1.59"

Latest boost for 18.04 is 1.58.0 Prefered the old build procedure where the depends where used properly.

jasonbcox commented 4 years ago

We're looking into it. Thanks for the bug report.

biatwc commented 4 years ago

Although I'm using 0.22.3 I'm facing similar battles, because I'm using CentOS 7 libevent is too old (2.0.21-4) and abc needs 2.0.22. I've compiled a static version of libevent (by ./configure --disabled-shared), but struggling to understand how to make cmake statically link this libevent.a static library? I've tried all kinds of -DCXXFLAGS / -DLDFLAGS to no avail.

Any help gratefully received.

Fabcien commented 4 years ago

The bug has been fixed on current master, unfortunately too late to make it in the coming 0.22.4 release so it will be part of 0.22.5.

If the problem persists, please re-open this issue.

Fabcien commented 4 years ago

@biatwc CentOS 7 has a glibc version which is too old for the software, so this fix won't be enough to let you complete the build. A solution is to upgrade to CentOS 8; if it is not possible and you can run a Docker container I suggest you take a look at the Bitcoin ABC containers which will let you run the release version or build yourself inside a container. You may want to read these instructions to build against the static libraries.

Feel free to open a separate issue if you find another bug.

gituser commented 4 years ago

@Fabcien any ETA on v0.22.5 release?

Fabcien commented 4 years ago

@gituser 0.22.5 should be available on October 27th. You can also pull the current master branch which has the fix if you don't want to wait, or use the Bitcoin ABC development container which is not affected by this bug.

gituser commented 4 years ago

@Fabcien I've tried building latest master - still no luck, same error.

Fabcien commented 4 years ago

@gituser Please clear your cmake cache and try again (in doubt you can delete your build directory). If the issue persists please post your full cmake output.

gituser commented 4 years ago

@Fabcien

Yes, that was it, I forgot to remove existing build directory before building new version.

Thank you, it worked!

M8BWNN commented 4 years ago

same error here.. started with a fresh git clone, checkout master

cmake -GNinja .. -- The C compiler identification is GNU 9.2.1 -- The CXX compiler identification is GNU 9.2.1 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found Python: /usr/bin/python3.5 (found suitable version "3.5.2", minimum required is "3.5") found components: Interpreter -- Found Git: /usr/bin/git (found version "2.7.4") -- Performing Test have_CXXWerror_unused_command_line_argument -- Performing Test have_CXX__Werror_unused_command_line_argument - Failed -- Performing Test have_linkerfuse_ld_gold -- Performing Test have_linkerfuse_ld_gold - Success -- Performing Test have_C__g3 -- Performing Test have_Cg3 - Success -- Performing Test have_CXXg3 -- Performing Test have_CXX__g3 - Success -- Performing Test have_Cftrapv -- Performing Test have_Cftrapv - Success -- Performing Test have_CXX__ftrapv -- Performing Test have_CXXftrapv - Success -- Performing Test have_Cfstack_reuse_none -- Performing Test have_C__fstack_reuse_none - Success -- Performing Test have_CXXfstack_reuse_none -- Performing Test have_CXXfstack_reuse_none - Success -- Performing Test have_CXX__fstack_protector_all -- Performing Test have_CXXfstack_protector_all - Success -- Performing Test have_CXXWstack_protector -- Performing Test have_CXXWstack_protector - Success -- Performing Test have_CU_FORTIFY_SOURCE -- Performing Test have_C__U_FORTIFY_SOURCE - Success -- Performing Test have_CXXU_FORTIFY_SOURCE -- Performing Test have_CXXU_FORTIFY_SOURCE - Success -- Performing Test have_linker_Wldynamicbase -- Performing Test have_linkerWl___dynamicbase - Failed -- Performing Test have_linkerWl_nxcompat -- Performing Test have_linkerWl_nxcompat - Failed -- Performing Test have_linkerWl_high_entropy_va -- Performing Test have_linkerWl_high_entropy_va - Failed -- Performing Test have_linkerWlz_relro -- Performing Test have_linkerWlz_relro - Success -- Performing Test have_linkerWlz_now -- Performing Test have_linkerWlz_now - Success -- Performing Test have_CWnested_externs -- Performing Test have_CWnested_externs - Success -- Performing Test have_CWstrict_prototypes -- Performing Test have_CWstrict_prototypes - Success -- Performing Test have_CWall -- Performing Test have_CWall - Success -- Performing Test have_C__Wextra -- Performing Test have_CWextra - Success -- Performing Test have_CWformat -- Performing Test have_C__Wformat - Success -- Performing Test have_CWvla -- Performing Test have_CWvla - Success -- Performing Test have_CWcast_align -- Performing Test have_CWcast_align - Success -- Performing Test have_CWunused_parameter -- Performing Test have_CWunused_parameter - Success -- Performing Test have_CWmissing_braces -- Performing Test have_CWmissing_braces - Success -- Performing Test have_CWthread_safety -- Performing Test have_CWthread_safety - Failed -- Performing Test have_C__Wshadow -- Performing Test have_CWshadow - Success -- Performing Test have_CWshadow_field -- Performing Test have_CWshadow_field - Failed -- Performing Test have_CWrange_loop_analysis -- Performing Test have_C__Wrange_loop_analysis - Failed -- Performing Test have_CWredundant_decls -- Performing Test have_CWredundant_decls - Success -- Performing Test have_CXXWall -- Performing Test have_CXXWall - Success -- Performing Test have_CXX__Wextra -- Performing Test have_CXXWextra - Success -- Performing Test have_CXXWformat -- Performing Test have_CXX__Wformat - Success -- Performing Test have_CXXWvla -- Performing Test have_CXXWvla - Success -- Performing Test have_CXXWcast_align -- Performing Test have_CXXWcast_align - Success -- Performing Test have_CXXWunused_parameter -- Performing Test have_CXXWunused_parameter - Success -- Performing Test have_CXXWmissing_braces -- Performing Test have_CXXWmissing_braces - Success -- Performing Test have_CXXWthread_safety -- Performing Test have_CXXWthread_safety - Failed -- Performing Test have_CXX__Wshadow -- Performing Test have_CXXWshadow - Success -- Performing Test have_CXXWshadow_field -- Performing Test have_CXXWshadow_field - Failed -- Performing Test have_CXXWrange_loop_analysis -- Performing Test have_CXX__Wrange_loop_analysis - Failed -- Performing Test have_CXXWredundant_decls -- Performing Test have_CXXWredundant_decls - Success -- Performing Test have_CWformatWformat_security -- Performing Test have_CWformatWformat_security - Success -- Performing Test have_CXXWformatWformat_security -- Performing Test have_CXXWformatWformat_security - Success -- Performing Test have_CXXWredundant_move -- Performing Test have_CXXWredundant_move - Success -- Performing Test have_CWno_unused_parameter -- Performing Test have_CWno_unused_parameter - Success -- Performing Test have_CXX__Wno_unused_parameter -- Performing Test have_CXXWno_unused_parameter - Success -- Performing Test have_CWno_implicit_fallthrough -- Performing Test have_C__Wno_implicit_fallthrough - Success -- Performing Test have_CXXWno_implicit_fallthrough -- Performing Test have_CXXWno_implicit_fallthrough - Success -- Looking for include file endian.h -- Looking for include file endian.h - found -- Looking for include file sys/endian.h -- Looking for include file sys/endian.h - not found -- Looking for htole16 -- Looking for htole16 - found -- Looking for htobe16 -- Looking for htobe16 - found -- Looking for be16toh -- Looking for be16toh - found -- Looking for le16toh -- Looking for le16toh - found -- Looking for htobe32 -- Looking for htobe32 - found -- Looking for htole32 -- Looking for htole32 - found -- Looking for be32toh -- Looking for be32toh - found -- Looking for le32toh -- Looking for le32toh - found -- Looking for htobe64 -- Looking for htobe64 - found -- Looking for htole64 -- Looking for htole64 - found -- Looking for be64toh -- Looking for be64toh - found -- Looking for le64toh -- Looking for le64toh - found -- Looking for include file byteswap.h -- Looking for include file byteswap.h - found -- Looking for bswap_16 -- Looking for bswap_16 - found -- Looking for bswap_32 -- Looking for bswap_32 - found -- Looking for bswap_64 -- Looking for bswap_64 - found -- Looking for include file sys/select.h -- Looking for include file sys/select.h - found -- Looking for include file sys/prctl.h -- Looking for include file sys/prctl.h - found -- Looking for builtin_clz -- Looking for builtin_clz - found -- Looking for __builtin_clzl -- Looking for builtin_clzl - found -- Looking for builtin_clzll -- Looking for __builtin_clzll - found -- Looking for builtin_popcount -- Looking for builtin_popcount - found -- Looking for M_ARENA_MAX -- Looking for M_ARENA_MAX - found -- Looking for malloc_info -- Looking for malloc_info - found -- Looking for strnlen -- Looking for strnlen - found -- Looking for daemon -- Looking for daemon - found -- Looking for getentropy -- Looking for getentropy - not found -- Looking for getentropy -- Looking for getentropy - not found -- Looking for include files sys/types.h, vm/vm_params.h -- Looking for include files sys/types.h, vm/vm_params.h - not found -- Looking for include files sys/types.h, sys/vmmeter.h -- Looking for include files sys/types.h, sys/vmmeter.h - not found -- Looking for include files sys/types.h, sys/resources.h -- Looking for include files sys/types.h, sys/resources.h - not found -- Looking for getifaddrs -- Looking for getifaddrs - found -- Looking for freeifaddrs -- Looking for freeifaddrs - found -- Performing Test HAVE_SYS_GETRANDOM -- Performing Test HAVE_SYS_GETRANDOM - Success -- Performing Test HAVE_SYSCTL_ARND -- Performing Test HAVE_SYSCTL_ARND - Failed -- Performing Test CHAR_EQUALS_INT8 -- Performing Test CHAR_EQUALS_INT8 - Failed -- Performing Test HAVE_LARGE_FILE_SUPPORT -- Performing Test HAVE_LARGE_FILE_SUPPORT - Success -- Performing Test HAVE_FUNC_ATTRIBUTE_VISIBILITY -- Performing Test HAVE_FUNC_ATTRIBUTE_VISIBILITY - Success -- Performing Test HAVE_FUNC_ATTRIBUTE_DLLEXPORT -- Performing Test HAVE_FUNC_ATTRIBUTE_DLLEXPORT - Failed -- Looking for std::system -- Looking for std::system - found -- Looking for ::wsystem -- Looking for ::wsystem - not found -- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") -- Looking for pthread.h -- Looking for pthread.h - found -- Performing Test CMAKE_HAVE_LIBC_PTHREAD -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed -- Check if compiler accepts -pthread -- Check if compiler accepts -pthread - yes -- Found Threads: TRUE
-- Found Jemalloc component jemalloc: /usr/lib/x86_64-linux-gnu/libjemalloc_pic.a -- Check if jemalloc needs libdl - FALSE -- Found Jemalloc: /usr/include/jemalloc (found suitable version "3.6.0", minimum required is "3.6.0")
-- Performing Test ENABLE_SSE41 -- Performing Test ENABLE_SSE41 - Success -- Performing Test ENABLE_AVX2 -- Performing Test ENABLE_AVX2 - Success -- Performing Test ENABLE_SHANI -- Performing Test ENABLE_SHANI - Success -- Performing Test have_C
Wno_inconsistent_missing_override -- Performing Test have_CWno_inconsistent_missing_override - Success -- Performing Test have_CWno_maybe_uninitialized -- Performing Test have_CWno_maybe_uninitialized - Success -- Performing Test have_CWno_shadow -- Performing Test have_CWno_shadow - Success -- Performing Test have_C__Wno_sign_compare -- Performing Test have_CWno_sign_compare - Success -- Performing Test have_CWno_unused_const_variable -- Performing Test have_CWno_unused_const_variable - Success -- Performing Test have_CXXWno_inconsistent_missing_override -- Performing Test have_CXXWno_inconsistent_missing_override - Success -- Performing Test have_CXXWno_maybe_uninitialized -- Performing Test have_CXX__Wno_maybe_uninitialized - Success -- Performing Test have_CXXWno_shadow -- Performing Test have_CXXWno_shadow - Success -- Performing Test have_CXXWno_sign_compare -- Performing Test have_CXXWno_sign_compare - Success -- Performing Test have_CXXWno_unused_const_variable -- Performing Test have_CXXWno_unused_const_variable - Success -- Performing Test have_C__Wno_strict_prototypes -- Performing Test have_CWno_strict_prototypes - Success -- Looking for C++ include atomic -- Looking for C++ include atomic - found -- Performing Test ENABLE_HWCRC32 -- Performing Test ENABLE_HWCRC32 - Success -- Performing Test have_Cpedantic -- Performing Test have_C__pedantic - Success -- Performing Test have_CWundef -- Performing Test have_CWundef - Success -- Performing Test have_C__Wno_unused_function -- Performing Test have_CWno_unused_function - Success -- Performing Test have_CWno_overlength_strings -- Performing Test have_C__Wno_overlength_strings - Success -- Performing Test have_Cstd_c89 -- Performing Test have_Cstd_c89 - Success -- Performing Test have_CWno_long_long -- Performing Test have_C__Wno_long_long - Success -- Performing Test USE_ASM_X86_64 -- Performing Test USE_ASM_X86_64 - Success -- Found OpenSSL: /usr/lib/x86_64-linux-gnu/libcrypto.so (found version "1.0.2g") found components: Crypto -- Found Event component event: /usr/lib/x86_64-linux-gnu/libevent.so CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message): Could NOT find Event: Found unsuitable version "2.0.21-stable", but required is at least "2.0.22" (found /usr/include) Call Stack (most recent call first): /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:391 (_FPHSA_FAILURE_MESSAGE) cmake/modules/FindEvent.cmake:85 (find_package_handle_standard_args) cmake/modules/NativeExecutable.cmake:25 (find_package) src/CMakeLists.txt:394 (non_native_target_link_libraries) src/CMakeLists.txt:397 (link_event)

Fabcien commented 4 years ago

@M8BWNN This is not the same error, and this is not a bug: you need a more recent version of libevent.

This bug is about building using the static dependencies, which provides a suitable libevent version for the build.