Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: disable default NDEBUG differently #988

Merged
merged 1 commit into from
Jan 29, 2024

Conversation

vszakats
Copy link
Contributor

This method allows to set it via custom flags.

This method allows to set it via custom flags.
vszakats added a commit to curl/curl-for-win that referenced this pull request Jan 2, 2024
Turned out that the official Windows ARM64 curl.exe exited with an
assert when run with a simple command like: `curl https://example.org`.
```
Assertion failed: (i == BN_BITS2) || (h <= (BN_ULONG)1 << i), file \crypto\bn\bn_div.c, line 96
```
Ref: libressl/portable#987
This issue was masked at build time, because `NDEBUG` is force-disable
in CMake builds. PR to fix that (or at least allow to set NDEBUG manually:
libressl/portable#988

When building with `NDEBUG`, there are is a list of compiler warnings:
```
In file included from libressl/crypto/bn/bn_add.c:65:
libressl/crypto/bn/arch/aarch64/bn_arch.h:35:16: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
   35 |             : [n]"=r"(n)
      |                       ^
libressl/crypto/bn/arch/aarch64/bn_arch.h:34:18: note: use constraint modifier "w"
   34 |         __asm__ ("clz   %[n], %[w]"
      |                         ^~~~
      |                         %w[n]
libressl/crypto/bn/arch/aarch64/bn_arch.h:36:15: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
   36 |             : [w]"r"(w));
      |                      ^
libressl/crypto/bn/arch/aarch64/bn_arch.h:34:24: note: use constraint modifier "w"
   34 |         __asm__ ("clz   %[n], %[w]"
      |                               ^~~~
      |                               %w[w]
libressl/crypto/bn/arch/aarch64/bn_arch.h:51:37: warning: value size does not match register size specified by the constraint and modifier [-Wasm-operand-widths]
   51 |             : [carry]"=r"(carry), [r0]"=r"(r0)
      |                                            ^
[...]
```

Such builds will hang with the same command instead of showing the
assert, meaning that ASM support is clearly not ready for Windows
ARM64, but this issue was masked by the NDEBUG build issue.

autotools builds have ASM disabled by default for this build case.
@busterb
Copy link
Contributor

busterb commented Jan 8, 2024

Thanks. I was just looking at build logs for another diff, being slightly annoyed there wasn't a better way to override NDEBUG without a bunch of warnings.

@vszakats
Copy link
Contributor Author

Is there something to do, or any pending concern with this PR to get merged?

@botovq botovq merged commit c9c2137 into libressl:master Jan 29, 2024
35 checks passed
@botovq
Copy link
Contributor

botovq commented Jan 29, 2024 via email

@vszakats vszakats deleted the cmake-let-ndebug branch January 29, 2024 09:21
vszakats added a commit to curl/curl-for-win that referenced this pull request Jan 29, 2024
@vszakats
Copy link
Contributor Author

vszakats commented Mar 11, 2024

This patch was merged, yet surprisingly, it's missing from master and from both 3.8.3 and 3.9.0.

Was it intended?

vszakats added a commit to vszakats/libressl-portable that referenced this pull request Mar 11, 2024
Before this patch `NDEBUG` was force-disabled, preventing a build with
debug asserts disabled.

After this patch `NDEBUG` works again when passed as a custom build
option, e.g.: `-DCMAKE_C_FLAGS=-DNDEBUG`

Previously submitted as libressl#988, which was merged, but the commit vanished
from master and ended up missing from both 3.8.3 and 3.9.0 releases.
@busterb
Copy link
Contributor

busterb commented Mar 13, 2024

I wonder if this got merged to the github mirror only, then was overwritten when we synced up. I only see it referred to in the PR branch in the actual source tree, and there wasn't a revert that I can see.

@vszakats
Copy link
Contributor Author

Yes, that's possible.

I've opened #1016 to try one more time. Or the previous patch
can also be re-applied, whichever is more convenient.

busterb pushed a commit that referenced this pull request Mar 17, 2024
Before this patch `NDEBUG` was force-disabled, preventing a build with
debug asserts disabled.

After this patch `NDEBUG` works again when passed as a custom build
option, e.g.: `-DCMAKE_C_FLAGS=-DNDEBUG`

Previously submitted as #988, which was merged, but the commit vanished
from master and ended up missing from both 3.8.3 and 3.9.0 releases.
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.

3 participants