Skip to content

cmake: Inherit WERROR setting for secp256k1 build - #33297

Closed
jmoik wants to merge 1 commit into
bitcoin:masterfrom
jmoik:cmake_inherit_Werror_secp256k1
Closed

jmoik wants to merge 1 commit into
bitcoin:masterfrom
jmoik:cmake_inherit_Werror_secp256k1

Conversation

@jmoik

@jmoik jmoik commented Sep 3, 2025

Copy link
Copy Markdown

This change prevents unexpected CLI output when compiling with -DWERROR=ON (treat warnings as errors). This setting is now properly propagated to the secp256k1 subproject build. Previously, secp256k1 would be built without the -Werror flag even when the main project was configured to treat warnings as errors, creating inconsistent build behavior.
#33284

@DrahtBot

DrahtBot commented Sep 3, 2025 •

Copy link
Copy Markdown
Contributor

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

Code Coverage & Benchmarks

For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33297.

Reviews

See the guideline for information on the review process.

Type Reviewers
Concept NACK purpleKarrot
Concept ACK luke-jr, kevkevinpal

If your review is incorrectly listed, please copy-paste <!--meta-tag:bot-skip--> into the comment that the bot should ignore.

@purpleKarrot

Copy link
Copy Markdown
Contributor

I am going to NACK every PR that adds even more -Werror. 30f6429 was a mistake and should be reverted. The correct approach to this is CMAKE_COMPILE_WARNING_AS_ERROR.

Yes, that requires CMake 3.24 and we allow 3.22 as the minimum. It does not matter. Just accept that the setting will have no effect on Ubuntu 22.04. 🤷‍♂️

cc @hebasto

@hebasto

hebasto commented Sep 4, 2025

Copy link
Copy Markdown
Member

30f6429 was a mistake...

Here is some historical context.

When migrating the build system from Autotools to CMake, there was a unanimous expectation that, at least initially, we should aim for 100% build option compatibility. That commit introduced CMake’s counterpart to Autotools’ --enable-werror:

bitcoin/configure.ac

Lines 284 to 289 in 6e62b70

dnl Turn warnings into errors
AC_ARG_ENABLE([werror],
[AS_HELP_STRING([--enable-werror],
[Treat compiler warnings as errors (default is no)])],
[enable_werror=$enableval],
[enable_werror=no])

@hebasto

hebasto commented Sep 4, 2025

Copy link
Copy Markdown
Member

Yes, that requires CMake 3.24 and we allow 3.22 as the minimum. It does not matter. Just accept that the setting will have no effect on Ubuntu 22.04. 🤷‍♂️

That seems acceptable to me, as none of the CI jobs use CMake older that 3.24. And when someone sets CMAKE_COMPILE_WARNING_AS_ERROR with an older CMake, it issues a warning:

CMake Warning:
  Manually-specified variables were not used by the project:

    CMAKE_COMPILE_WARNING_AS_ERROR


@purpleKarrot

Copy link
Copy Markdown
Contributor

Here is some historical context.

Don't take it personal. You did a great job migrating from autotools to CMake. I have zero doubts about that.

@luke-jr

luke-jr commented Sep 18, 2025

Copy link
Copy Markdown
Contributor

Concept ACK. As long as -DWERROR is supported, it should work correctly.

Discussion about dropping it in favour of other solutions should be considered separately (and existing branches should get fixed even if it's dropped in newer versions)

Comment thread cmake/secp256k1.cmake Resolved
cmake: reuse working_compiler_werror_flag in secp256k1
@jmoik
jmoik force-pushed the cmake_inherit_Werror_secp256k1 branch from 9dac748 to 18d3d67 Compare September 26, 2025 10:18
@kevkevinpal

Copy link
Copy Markdown
Contributor

Concept ACK 18d3d67

I agree with luke-jr that even if we decided to drop this in favor of another solution that should be considered separately

@DrahtBot

Copy link
Copy Markdown
Contributor

Guix builds (on x86_64) [untrusted test-only build, possibly unsafe, not for production use]

File commit 9bd9ec0
(master)
commit e8706d44c3f1ff9ed006584db307b8751106c2ad
(pull/33297/merge)
*-aarch64-linux-gnu-debug.tar.gz 39491c8f786e7433... 9e396b4c35b0234f...
*-aarch64-linux-gnu.tar.gz 6b4cd3a61274e09c... 1a4327c9c547be46...
*-arm-linux-gnueabihf-debug.tar.gz c19f9ccbaba54b1b... d1d043354738c3d8...
*-arm-linux-gnueabihf.tar.gz 5a46113170a1ab44... 96d43647e5a62a44...
*-arm64-apple-darwin-codesigning.tar.gz fc2c929486eaaff2... cd0388c3b2169f46...
*-arm64-apple-darwin-unsigned.tar.gz 8c0e6ea6f59703ca... becefb9f2f19154b...
*-arm64-apple-darwin-unsigned.zip d8965f444b9d0148... b2361e0bcab3fcbf...
*-powerpc64-linux-gnu-debug.tar.gz bac029b01741ca08... d58d8baf029849ee...
*-powerpc64-linux-gnu.tar.gz b3015cebaef5fac7... 529b33202d301c20...
*-riscv64-linux-gnu-debug.tar.gz 66ae4d3e10476456... 15441fb05518309c...
*-riscv64-linux-gnu.tar.gz 3289dcbbd32665b2... 1c1cfc846e01df55...
*-x86_64-apple-darwin-codesigning.tar.gz 732175723416f91e... 957c5fe95f861e55...
*-x86_64-apple-darwin-unsigned.tar.gz 1e08a4cab4e74a8a... 73cc4641a13a1fae...
*-x86_64-apple-darwin-unsigned.zip ef2e63e642b7651a... 9fb201d6151e98f6...
*-x86_64-linux-gnu-debug.tar.gz 7c6529022baa8fd7... 10fb7a49ec735b4e...
*-x86_64-linux-gnu.tar.gz c9ced5093b39a67e... 0a003e8f16e9b56e...
*.tar.gz b2cc2a6e20f7262e... 7a801b124b5d610c...
SHA256SUMS.part 35bda47a741887da... b01e07c3ea1d6ed7...
guix_build.log 54b83c941ea6d76c... ed2e3bee4090992d...
guix_build.log.diff 9b1a77e7db7b2dcb...

@fanquake

fanquake commented Feb 4, 2026

Copy link
Copy Markdown
Member

Given there doesn't seem to be agreement here, I've opened an alternative in #34504.

@fanquake

fanquake commented Feb 5, 2026

Copy link
Copy Markdown
Member

There seems to be more agreement with #34504, so closing this for now.

@fanquake fanquake closed this Feb 5, 2026
hebasto added a commit that referenced this pull request Feb 5, 2026
…ERROR`

322c4ec build: replace WERROR with CMAKE_COMPILE_WARNING_AS_ERROR (fanquake)

Pull request description:

  `CMAKE_COMPILE_WARNING_AS_ERROR` was added to CMake in 3.24.

  `--compile-no-warning-as-error` can be used, if needed, in future, to
  suppress the `CMAKE_COMPILE_WARNING_AS_ERROR` behaviour from a CI
  config.

  Potential alternative to #33297. Closes #33284.

  See https://cmake.org/cmake/help/latest/prop_tgt/COMPILE_WARNING_AS_ERROR.html.

ACKs for top commit:
  purpleKarrot:
    re-ACK 322c4ec
  maflcko:
    review ACK 322c4ec 📩
  hebasto:
    re-ACK 322c4ec.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants