Buildroot Archive mirror
 help / color / mirror / Atom feed
From: Edgar Bonet <bonet@grenoble.cnrs.fr>
To: buildroot@buildroot.org
Cc: Samuel Martin <s.martin49@gmail.com>
Subject: Re: [Buildroot] Nginx fails to build with GCC 14
Date: Wed, 15 May 2024 17:31:15 +0200	[thread overview]
Message-ID: <4c9e89d1-48f6-48a7-b7af-0d429e2256cc@grenoble.cnrs.fr> (raw)
In-Reply-To: <5647a701-8c5a-4ce6-92c3-3c252e1cd91b@grenoble.cnrs.fr>

Hello all!

On 2024-05-14, I wrote:
> Building nginx with GCC 14 fails at the configure step with:
>
>     ./configure: error: libatomic_ops library was not found.

It turns out the issue is in a tiny test program that the configure
script tries to compile in order to probe for the atomic_ops library.
The compilation fails on an “incompatible pointer type” error. Up to
GCC 13, implicitly casting between incompatible pointer types only
issued a warning. Since GCC 14, this is an error.[1]

I fixed the issue with the meta-patch (patch adding a patch) below. May
I now submit this to buildroot? Should I instead attempt to upstream the
inner patch before submitting here the meta-patch? Any comments on these
patches are welcome.

Regards,

Edgar.

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

-- >8 --
Subject: [PATCH 1/1] package/nginx: 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]

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 | 40 +++++++++++++++++++
 1 file changed, 40 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..f8160a1da2
--- /dev/null
+++ b/package/nginx/0011-Fix-compile-error-in-configure-script.patch
@@ -0,0 +1,40 @@
+From e1bcac837f6aeabc4ddece06ecbcf2bcca8dd651 Mon Sep 17 00:00:00 2001
+From: Edgar Bonet <bonet@grenoble.cnrs.fr>
+Date: Wed, 15 May 2024 16:35:27 +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>
+---
+ 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="volatile size_t  n = 0;
+                       if (!AO_compare_and_swap(&n, 0, 1))
+                           return 1;
+                       if (AO_fetch_and_add(&n, 1) != 1)
+-- 
+2.34.1
+
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

  reply	other threads:[~2024-05-15 15:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-14 20:28 [Buildroot] Nginx fails to build with GCC 14 Edgar Bonet
2024-05-15 15:31 ` Edgar Bonet [this message]
2024-05-15 19:19   ` Arnout Vandecappelle via buildroot
2024-05-16  8:38     ` Edgar Bonet

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4c9e89d1-48f6-48a7-b7af-0d429e2256cc@grenoble.cnrs.fr \
    --to=bonet@grenoble.cnrs.fr \
    --cc=buildroot@buildroot.org \
    --cc=s.martin49@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).