Skip to content

Commit

Permalink
package/nginx: fix compile error in configure script
Browse files Browse the repository at this point in the history
Building with GCC 14 fails at the configure step with:

    ./configure: error: libatomic_ops library was not found.

The error is not caused by a missing library, but by an unrelated
"incompatible pointer type" error in the test program:

    ...
    checking for atomic_ops library
    objs/autotest.c: In function 'main':
    objs/autotest.c:9:48: error: passing argument 1 of 'AO_compare_and_swap' from incompatible pointer type [-Wincompatible-pointer-types]

This used to be a warning, but it is an error since GCC 14.[1]

Fix this by patching the test program in order to use the correct
pointer types.

Fixes: http://autobuild.buildroot.net/results/a3d/a3d8c6fd631b31e272e4d8cc6c3318f2e4151882

[1] https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types

Signed-off-by: Edgar Bonet <[email protected]>
Signed-off-by: Arnout Vandecappelle <[email protected]>
  • Loading branch information
edgar-bonet authored and arnout committed Jun 6, 2024
1 parent e6b30e2 commit 7d249da
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions package/nginx/0011-Fix-compile-error-in-configure-script.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
From e1bcac837f6aeabc4ddece06ecbcf2bcca8dd651 Mon Sep 17 00:00:00 2001
From: Edgar Bonet <[email protected]>
Date: Thu, 16 May 2024 11:15:10 +0200
Subject: [PATCH] Configure: fixed building libatomic test.

Using "long *" instead of "AO_t *" leads either to -Wincompatible-pointer-types
or -Wpointer-sign warnings, depending on whether long and size_t are compatible
types (e.g., ILP32 versus LP64 data models). Notably, -Wpointer-sign warnings
are enabled by default in Clang only, and -Wincompatible-pointer-types is an
error starting from GCC 14.

Signed-off-by: Edgar Bonet <[email protected]>
Upstream: https://hg.nginx.org/nginx/rev/f58b6f636238
---
auto/lib/libatomic/conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/auto/lib/libatomic/conf b/auto/lib/libatomic/conf
index d1e484a..0f12b9c 100644
--- a/auto/lib/libatomic/conf
+++ b/auto/lib/libatomic/conf
@@ -20,7 +20,7 @@ else
#include <atomic_ops.h>"
ngx_feature_path=
ngx_feature_libs="-latomic_ops"
- ngx_feature_test="long n = 0;
+ ngx_feature_test="AO_t n = 0;
if (!AO_compare_and_swap(&n, 0, 1))
return 1;
if (AO_fetch_and_add(&n, 1) != 1)
--
2.34.1

0 comments on commit 7d249da

Please sign in to comment.