The problem was that brew gcc and Xcode 15 have an duplicate lib:
ld: warning: ignoring duplicate libraries: ‘-lc++‘gs)
But since we’ve enabled fatal warnings for Mac, we’re getting:
ld: fatal warning(s) induced error (-fatal_warnings)
Based on:
https://stackoverflow.com/questions/77164140/ld-warning-ignoring-duplicate-libraries-lgcc-after-the-recent-update-of-xc we should be able to work around it:
0diff --git a/cmake/module/TryAppendLinkerFlag.cmake b/cmake/module/TryAppendLinkerFlag.cmake
1--- a/cmake/module/TryAppendLinkerFlag.cmake (revision ec5d1c372b20d49147813aa0392195a3642b86a1)
2+++ b/cmake/module/TryAppendLinkerFlag.cmake (date 1723148834055)
3@@ -79,7 +79,7 @@
4 if(MSVC)
5 try_append_linker_flag("/WX" VAR working_linker_werror_flag)
6 elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
7- try_append_linker_flag("-Wl,-fatal_warnings" VAR working_linker_werror_flag)
8+ try_append_linker_flag("-Wl,-no_warn_duplicate_libraries,-fatal_warnings" VAR working_linker_werror_flag) # https://github.com/orgs/Homebrew/discussions/4794#discussioncomment-7044468
9 else()
10 try_append_linker_flag("-Wl,--fatal-warnings" VAR working_linker_werror_flag)
11 endif()
which makes building with fuzz possible:
ld: warning: ignoring duplicate libraries: ‘-lc++’, ‘../../../libleveldb.a’, ‘../../../libminisketch.a’, ‘../../libbitcoin_common.a’, ‘../../secp256k1/src/libsecp256k1.a’, ‘../../univalue/libunivalue.a’
[100%] Built target fuzz
and fuzzing can start (with the same error as the Autotools version)
% FUZZ=bech32 ./build_fuzz/src/test/fuzz/fuzz
fuzz(91171,0x2060fcc00) malloc: nano zone abandoned due to inability to reserve vm space.
/opt/homebrew/opt/llvm/bin/../include/c++/v1/variant:495:12: runtime error: call to function decltype(auto) std::__1::__variant_detail::__visitation::__base::__dispatcher<0ul, 0ul>::__dispatch[abi:ne180100]<void std::__1::__variant_detail::__ctor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue»::__generic_construct[abi:ne180100]<std::__1::__variant_detail::__move_constructor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>, (std::__1::__variant_detail::_Trait)1»(std::__1::__variant_detail::__ctor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue»&, std::__1::__variant_detail::__move_constructor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>, (std::__1::__variant_detail::_Trait)1>&&)::’lambda’(std::__1::__variant_detail::__move_constructor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>, (std::__1::__variant_detail::_Trait)1>&, auto&&)&&, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>&, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>&&>(std::__1::__variant_detail::__move_constructor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>, (std::__1::__variant_detail::_Trait)1>, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>&, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>&&) through pointer to incorrect function type ‘void (*)((lambda at /opt/homebrew/opt/llvm/bin/../include/c++/v1/variant:814:11) &&, std::__variant_detail::__base<std::__variant_detail::_Trait::_Available, RPCArg::Optional, std::string, UniValue> &, std::__variant_detail::__base<std::__variant_detail::_Trait::_Available, RPCArg::Optional, std::string, UniValue> &&)’
variant:532: note: decltype(auto) std::__1::__variant_detail::__visitation::__base::__dispatcher<0ul, 0ul>::__dispatch[abi:ne180100]<void std::__1::__variant_detail::__ctor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue»::__generic_construct[abi:ne180100]<std::__1::__variant_detail::__move_constructor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>, (std::__1::__variant_detail::_Trait)1»(std::__1::__variant_detail::__ctor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue»&, std::__1::__variant_detail::__move_constructor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>, (std::__1::__variant_detail::_Trait)1>&&)::’lambda’(std::__1::__variant_detail::__move_constructor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>, (std::__1::__variant_detail::_Trait)1>&, auto&&)&&, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>&, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>&&>(std::__1::__variant_detail::__move_constructor<std::__1::__variant_detail::__traits<RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>, (std::__1::__variant_detail::_Trait)1>, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>&, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, RPCArg::Optional, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator>, UniValue>&&) defined here
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /opt/homebrew/opt/llvm/bin/../include/c++/v1/variant:495:12
INFO: Running with entropic power schedule (0xFF, 100).
INFO: Seed: 534925934
INFO: Loaded 1 modules (1210318 inline 8-bit counters): 1210318 [0x105d56048, 0x105e7d816),
INFO: Loaded 1 PC tables (1210318 PCs): 1210318 [0x105e7d818,0x1070f54f8),
INFO: -max_len is not provided; libFuzzer will not generate inputs larger than 4096 bytes
INFO: A corpus is not provided, starting from an empty corpus
#2 INITED cov: 294 ft: 294 corp: 1/1b exec/s: 0 rss: 74Mb
#3 NEW cov: 294 ft: 298 corp: 2/2b lim: 4 exec/s: 0 rss: 74Mb L: 1/1 MS: 1 ChangeBit-
#5 NEW cov: 295 ft: 301 corp: 3/3b lim: 4 exec/s: 0 rss: 74Mb L: 1/1 MS: 2 ShuffleBytes-ChangeBit-
#6 NEW cov: 295 ft: 303 corp: 4/4b lim: 4 exec/s: 0 rss: 74Mb L: 1/1 MS: 1 ChangeBit-
#7 NEW cov: 295 ft: 305 corp: 5/5b lim: 4 exec/s: 0 rss: 74Mb L: 1/1 MS: 1 ChangeBit-