diff mbox series

[1/1] package/nginx: fix compile error in configure script

Message ID 1ed351b7-0e04-436d-9ce3-ca70f4d3ff74@grenoble.cnrs.fr
State New
Headers show
Series [1/1] package/nginx: fix compile error in configure script | expand

Commit Message

Edgar Bonet May 16, 2024, 10:06 a.m. UTC
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.

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

Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
---
 ...ix-compile-error-in-configure-script.patch | 41 +++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 package/nginx/0011-Fix-compile-error-in-configure-script.patch

Comments

Edgar Bonet May 21, 2024, 11:56 a.m. UTC | #1
Hello all!

On 2024-05-16, I wrote:
> 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.
> 
> [1] https://gcc.gnu.org/gcc-14/porting_to.html#incompatible-pointer-types
> 
> Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
> ---
>  ...ix-compile-error-in-configure-script.patch | 41 +++++++++++++++++++
>  1 file changed, 41 insertions(+)
>  create mode 100644 package/nginx/0011-Fix-compile-error-in-configure-script.patch
> 
> diff --git a/package/nginx/0011-Fix-compile-error-in-configure-script.patch b/package/nginx/0011-Fix-compile-error-in-configure-script.patch
> new file mode 100644
> index 0000000000..2e719928ce
> --- /dev/null
> +++ b/package/nginx/0011-Fix-compile-error-in-configure-script.patch
> @@ -0,0 +1,41 @@
> +From e1bcac837f6aeabc4ddece06ecbcf2bcca8dd651 Mon Sep 17 00:00:00 2001
> +From: Edgar Bonet <bonet@grenoble.cnrs.fr>
> +Date: Thu, 16 May 2024 11:15:10 +0200
> +Subject: [PATCH] Fix compile error in configure script
> +
> +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]
> +
> +Fix the error by using the correct pointer types.
> +
> +Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
> +Upstream: https://mailman.nginx.org/pipermail/nginx-devel/2024-May/LF5H73UPOIS64TVQUN5N6S2A4IACBRPT.html
> +---
> + 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
> +

The inner patch just landed, with a reworded commit message,
on nginx's mercurial repo:

https://hg.nginx.org/nginx/rev/f58b6f636238

Should I re-spin this patch?

Regards,

Edgar.
diff mbox series

Patch

diff --git a/package/nginx/0011-Fix-compile-error-in-configure-script.patch b/package/nginx/0011-Fix-compile-error-in-configure-script.patch
new file mode 100644
index 0000000000..2e719928ce
--- /dev/null
+++ b/package/nginx/0011-Fix-compile-error-in-configure-script.patch
@@ -0,0 +1,41 @@ 
+From e1bcac837f6aeabc4ddece06ecbcf2bcca8dd651 Mon Sep 17 00:00:00 2001
+From: Edgar Bonet <bonet@grenoble.cnrs.fr>
+Date: Thu, 16 May 2024 11:15:10 +0200
+Subject: [PATCH] Fix compile error in configure script
+
+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]
+
+Fix the error by using the correct pointer types.
+
+Signed-off-by: Edgar Bonet <bonet@grenoble.cnrs.fr>
+Upstream: https://mailman.nginx.org/pipermail/nginx-devel/2024-May/LF5H73UPOIS64TVQUN5N6S2A4IACBRPT.html
+---
+ 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
+