Skip to content

cmake: Rework searching for wallet dependencies - #39

Merged
hebasto merged 2 commits into
cmake-stagingfrom
231026-cmake-Q
Dec 12, 2023
Merged

hebasto merged 2 commits into
cmake-stagingfrom
231026-cmake-Q

Conversation

@hebasto

@hebasto hebasto commented Oct 26, 2023

Copy link
Copy Markdown
Owner

SQLite:

Berkeley DB:

  • Our FindBerkeleyDB module has been rewritten using CMake guides and similar code from the CMake repo.
  • It is compiler-agnostic now and properly handles corner cases with Homebrew and vcpkg package managers.

Comment thread cmake/module/FindBerkeleyDB.cmake Outdated
# To find such a package, the find_path() and find_library() commands
# need additional path hints that are computed by Homebrew itself.
set(_BerkeleyDB_homebrew_include_hint)
foreach(_suffix IN ITEMS db@4 db@5 db)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this checking for multiple (unsupported) versions, when on master we only check for berkeley-db@4?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Linux users can build using BDB v5. Why should we limit macOS users?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is checking for 5 and 6, neither of which we officially support, or have any tests for. I'm also not sure why we'd change this behaviour just prior to BDB being removed. If this is going to be changed, it should atleast be mentioned in the comit message/PR description?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! db removed, and the commit message adjusted.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think db5 should also be removed, unless there's a compelling reason to increase the scope of BDB support here.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@hebasto
hebasto force-pushed the 231026-cmake-Q branch 2 times, most recently from aae4f0c to 1f0ec2d Compare November 1, 2023 11:01
@hebasto

hebasto commented Nov 7, 2023

Copy link
Copy Markdown
Owner Author

Rebased.

@hebasto

hebasto commented Nov 9, 2023

Copy link
Copy Markdown
Owner Author

Rebased.

@hebasto

hebasto commented Nov 16, 2023

Copy link
Copy Markdown
Owner Author

Rebased.

@pablomartin4btc pablomartin4btc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 12622b1

Comment thread cmake/module/FindBerkeleyDB.cmake Outdated
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
set(_BerkeleyDB_homebrew_include_hint "${_BerkeleyDB_homebrew_prefix}/include")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the output variable of this not just be _BerkeleyDB_homebrew_include_hint, and then we avoid the intermediate variable and the set / unset etc. All this does is append /include?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Reworked.

@hebasto

hebasto commented Nov 29, 2023

Copy link
Copy Markdown
Owner Author

As this PR branch was rebased, it is easy now to spot the difference in configuration logs on Windows:

  • the current cmake_staging branch:
-- Found BerkeleyDB: D:/a/bitcoin/bitcoin/build/vcpkg_installed/x64-windows-static (found suitable version "4.8", minimum required is "4.8") 
-- Found BerkeleyDB: optimized;D:/a/bitcoin/bitcoin/build/vcpkg_installed/x64-windows-static/lib/libdb48.lib;debug;D:/a/bitcoin/bitcoin/build/vcpkg_installed/x64-windows-static/debug/lib/libdb48.lib (found suitable version "4.8.30", minimum required is "4.8") 

@hebasto

hebasto commented Dec 6, 2023

Copy link
Copy Markdown
Owner Author

Rebased.

@hebasto

hebasto commented Dec 11, 2023

Copy link
Copy Markdown
Owner Author

Rebased.

@sedited sedited left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm ACK 35a45c1

Cross-compiled to some platforms, natively compiled with bdb 5.3, configured in visual studio as well to check the mentioned difference in build output.

Moving the brew check to the wallet commit also seems sane.

EDIT: Put in a reminder to check that the slight change in behavior for handling newer bdb versions is documented.

@hebasto
hebasto merged this pull request into cmake-staging Dec 12, 2023
hebasto pushed a commit that referenced this pull request Jul 22, 2026
…AFL fork

faada35 fuzz: [refactor] Use 100'000 digit separator in __AFL_LOOP (MarcoFalke)
fae067e fuzz: Avoid dangling prevoutfetch threads after AFL fork (MarcoFalke)

Pull request description:

  Presumably fixes https://issues.oss-fuzz.com/issues/536943806

  This is a bit confusing, because the issue was already fixed in commit f608a40, by removing the AFL forkserver.

  However, OSS-Fuzz doesn't go through the AFL_LOOP, but through the AFL libFuzzer driver:

  ```
            #0 0x7e055245baab in __pthread_clockjoin_ex /build/glibc-B3wQXB/glibc-2.31/nptl/pthread_join_common.c:89:6
      #1 0x5a27e904dcdd in operator() /src/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:293:14
      #2 0x5a27e904dcdd in Join<(lambda at /src/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:292:44)> /src/llvm-project/compiler-rt/lib/sanitizer_common/sanitizer_thread_arg_retval.h:75:9
      #3 0x5a27e904dcdd in ___interceptor_pthread_join /src/llvm-project/compiler-rt/lib/asan/asan_interceptors.cpp:292:25
      #4 0x5a27e90f4044 in std::__1::thread::join()
      #5 0x5a27e9366277 in ThreadPool::Stop() [bitcoin-core/src/util/threadpool.h:146](https://github.com/bitcoin/bitcoin/blob/7d8137c1417b61589949b3e8b081e5310fe335f3/src/util/threadpool.h#L146):53
      #6 0x5a27e9365db9 in ThreadPool::~ThreadPool() [bitcoin-core/src/util/threadpool.h:94](https://github.com/bitcoin/bitcoin/blob/7d8137c1417b61589949b3e8b081e5310fe335f3/src/util/threadpool.h#L94):9
  ...
            #32 0x5a27e95a9506 in (anonymous namespace)::ResetChainman(TestingSetup&) (.12669) [bitcoin-core/src/test/fuzz/process_messages.cpp:44](https://github.com/bitcoin/bitcoin/blob/7d8137c1417b61589949b3e8b081e5310fe335f3/src/test/fuzz/process_messages.cpp#L44):27
      #33 0x5a27e95a8c60 in process_messages_fuzz_target(std::__1::span<unsigned char const, 18446744073709551615ul>) [bitcoin-core/src/test/fuzz/process_messages.cpp:141](https://github.com/bitcoin/bitcoin/blob/7d8137c1417b61589949b3e8b081e5310fe335f3/src/test/fuzz/process_messages.cpp#L141):9
  ...
              #36 0x5a27e97b7190 in test_one_input(std::__1::span<unsigned char const, 18446744073709551615ul>) bitcoin-core/src/test/fuzz/fuzz.cpp:86:5
              #37 0x5a27e97b7190 in LLVMFuzzerTestOneInput bitcoin-core/src/test/fuzz/fuzz.cpp:214:5
              #38 0x5a27e90ada19 in LLVMFuzzerRunDriver /src/aflplusplus/utils/aflpp_driver/aflpp_driver.c:427:13
              #39 0x5a27e90ad69b in main /src/aflplusplus/utils/aflpp_driver/aflpp_driver.c:323:10
              #40 0x7e055223b082 in __libc_start_main /build/glibc-B3wQXB/glibc-2.31/csu/libc-start.c:308:16
              #41 0x5a27e8fc602d in _start
  ```

  So the correct fix would be to set `AFL_DRIVER_DONT_DEFER=1`. Ref: https://github.com/AFLplusplus/AFLplusplus/blob/ad5304010ae3be9d5cdc1ba51b09e14169c5cb87/utils/aflpp_driver/aflpp_driver.c#L161

  However, I don't know how to do this on OSS-Fuzz, so just drop the threads for now, because there are dedicated fuzz targets to test the multi-threaded case anyway.

ACKs for top commit:
  l0rinc:
    ACK faada35
  andrewtoth:
    lgtm ACK faada35
  sedited:
    ACK faada35

Tree-SHA512: c249d7267f789084968f8510531f60fc71c9fbd6b4e574a181fd6da1af19a3cb7c03ba60c3ca70244b56ce44c602293517cdb6b0e969b4a2cc9d1afaa49ab0f8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants