[PATCH] Fix compile error in configure script

Sergey Kandaurov pluknet at nginx.com
Fri May 17 17:41:39 UTC 2024


> On 16 May 2024, at 13:25, Edgar Bonet <bonet at grenoble.cnrs.fr> wrote:
> 
> # HG changeset patch
> # User Edgar Bonet <bonet at grenoble.cnrs.fr>
> # Date 1715850910 -7200
> #      Thu May 16 11:15:10 2024 +0200
> # Node ID c2c3b0d74b1a7d3f967421c72760b5c573afcd81
> # Parent  89093b003fcb54c7f8dc66042f17bc4dea4e7709
> 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]
> 

Where did you try to build?
Usually, long and size_t (a "common default" for AO_t) have the same
underlying type, unless you build with something like MSVC.

So far I only get signedness warnings with -Wpointer-sign on both
Clang and GCC 14 prerelease, and it is disabled by default on GCC.
The patch addresses them.
This warning option is documented to enable warnings other than
-Wincompatible-pointer-types.  It might have been changed in the
released version though.

> Fix the error by using the correct pointer types.
> 
> Signed-off-by: Edgar Bonet <bonet at grenoble.cnrs.fr>
> 
> diff -r 89093b003fcb -r c2c3b0d74b1a auto/lib/libatomic/conf
> --- a/auto/lib/libatomic/conf Fri May 03 20:26:05 2024 +0400
> +++ b/auto/lib/libatomic/conf Thu May 16 11:15:10 2024 +0200
> @@ -19,7 +19,7 @@
>                       #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)
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> https://mailman.nginx.org/mailman/listinfo/nginx-devel

-- 
Sergey Kandaurov


More information about the nginx-devel mailing list