Using current master (6a2bb0fd835977637e0f43db76121bbfd21565f6), if you configure with the following, CMake will “Error”:
0# gcc --version
1# gcc (Ubuntu 14.2.0-4ubuntu2~24.04) 14.2.0
2
3cmake -B build -DBUILD_KERNEL_LIB=ON -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
4<snip>
5Cross compiling ....................... FALSE
6C++ compiler .......................... GNU 14.2.0, /usr/bin/c++
7CMAKE_BUILD_TYPE ...................... RelWithDebInfo
8Preprocessor defined macros ...........
9C++ compiler flags .................... -O2 -g -std=c++20 -fPIC -fno-extended-identifiers -fdebug-prefix-map=/root/ci_scratch/src=. -fmacro-prefix-map=/root/ci_scratch/src=. -fstack-reuse=none -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -Wstack-protector -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wall -Wextra -Wformat -Wformat-security -Wvla -Wredundant-decls -Wdate-time -Wduplicated-branches -Wduplicated-cond -Wlogical-op -Woverloaded-virtual -Wsuggest-override -Wimplicit-fallthrough -Wunreachable-code -Wbidi-chars=any -Wundef -Wno-unused-parameter
10Linker flags .......................... -O2 -g -fstack-reuse=none -fstack-protector-all -fcf-protection=full -fstack-clash-protection -Wl,-z,relro -Wl,-z,now -Wl,-z,separate-code -fPIE -pie
11
12NOTE: The summary above may not exactly match the final applied build flags
13 if any additional CMAKE_* or environment variables have been modified.
14 To see the exact flags applied, build with the --verbose option.
15
16Treat compiler warnings as errors ..... OFF
17Use ccache for compiling .............. ON
18
19
20-- Configuring done (23.3s)
21CMake Error at src/kernel/CMakeLists.txt:11 (add_library):
22 CMake doesn't support IPO for current compiler
23
24
25-- Generating done (0.1s)
26CMake Generate step failed. Build files cannot be regenerated correctly.
However you can just call cmake --build build
, and compilation “works”:
0cmake --build build -j14 --target bitcoinkernel
1[ 0%] Generating bitcoin-build-info.h
2[ 0%] Built target secp256k1_precomputed
3[ 0%] Built target crc32c
4[ 14%] Built target bitcoin_crypto
5[ 14%] Built target secp256k1
6[ 42%] Built target leveldb
7[ 42%] Built target generate_build_info
8[ 42%] Built target bitcoin_clientversion
9[100%] Built target bitcoinkernel
10
11# file build/lib/libbitcoinkernel.a
12build/lib/libbitcoinkernel.a: current ar archive
It would be good if when CMake errors during configuration, it’s not actually possible to continue building, rather than silently ignoring errors.
Note that the presence of -Werror=dev
when configuring, makes no difference here.
Also, the error string CMake is throwing, is also incorrect, as the compiler does support LTO.