Bug 13806 - Building host-localedef fails on fedora 34/gcc 11
Summary: Building host-localedef fails on fedora 34/gcc 11
Status: RESOLVED FIXED
Alias: None
Product: buildroot
Classification: Unclassified
Component: Other (show other bugs)
Version: 2021.02.2
Hardware: PC Linux
: P5 major
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-14 10:19 UTC by Dr I J Ormshaw
Modified: 2021-05-18 21:31 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:


Attachments
error from build output (5.32 KB, text/plain)
2021-05-14 10:19 UTC, Dr I J Ormshaw
Details
temporary fix (669 bytes, patch)
2021-05-14 13:24 UTC, Dr I J Ormshaw
Details
Patch applied (11.89 KB, patch)
2021-05-17 06:10 UTC, Dr I J Ormshaw
Details
Latest patch tested (11.89 KB, patch)
2021-05-17 08:50 UTC, Dr I J Ormshaw
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dr I J Ormshaw 2021-05-14 10:19:46 UTC
Created attachment 8946 [details]
error from build output

When building under fedora 34 x86_64 with gcc (GCC) 11.1.1 20210428 (Red Hat 11.1.1-1)
compilation fails with the attached error.  I haven't seen this before so I assume it is a gcc 11 specific issue.
Comment 1 Dr I J Ormshaw 2021-05-14 13:24:50 UTC
Created attachment 8951 [details]
temporary fix

I've applied the attached patch to temperately circumvent the problem
Comment 2 Peter Seiderer 2021-05-14 17:59:13 UTC
Seems the problem is fixed upstream with the following two patches:

- Fix GCC 11 -Warray-parameter warning for __sigsetjmp (bug 26647) [1]

- Avoid -Wstringop-overflow warning in pthread_cleanup_push macros [2]

Can you test the following buildroot patch (backporting thr two commits for the localedef package)?

https://patchwork.ozlabs.org/project/buildroot/patch/20210514175429.20552-1-ps.report@gmx.net/

[1] https://github.com/bminor/glibc/commit/19302b27bdacfe87e861ff46fc0fbad60dd6602d

[2] https://github.com/bminor/glibc/commit/548f467fa14ffe7d955beeb31b30e2aeae4467e0
Comment 3 Yann E. MORIN 2021-05-15 11:29:59 UTC
Hello,

Thanks for reporting this issue. We believe it has been fixed thanks to the
patch from Peter, applied upstream as commit 4174f79a5718.

Regards,
Yann E. MORIN.
Comment 4 Dr I J Ormshaw 2021-05-17 06:10:49 UTC
Created attachment 8956 [details]
Patch applied
Comment 5 Dr I J Ormshaw 2021-05-17 06:13:19 UTC
I've downloaded the patch you suggested (attached) and rebuilt.  The patch appears to have been applied:

make[1]: Entering directory '/home/ian/projects/hiwire-linux/source/buildroot'
glibc-2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2.tar.gz: OK (sha256: f4710e9a435a7b83e1d23dd75434f0d36b898eba9b4249c946c32b467d852fd4)
>>> host-localedef 2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 Extracting
gzip -d -c /home/ian/build/download/glibc/glibc-2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2.tar.gz | tar --strip-components=1 -C /home/ian/build/hiwire-linux-5c671c59-x86_64/buildroot/build/host-localedef-2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2   -xf -
>>> host-localedef 2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 Patching

Applying 0001-HACK-only-build-and-install-localedef.patch using patch: 
patching file Rules
Hunk #1 succeeded at 212 (offset 22 lines).
patching file locale/Makefile
Hunk #1 succeeded at 33 (offset 1 line).

Applying 0002-relax-dependency-on-GCC-to-4.8-and-binutils-to-2.24.patch using patch: 
patching file configure
Hunk #1 succeeded at 4566 (offset -35 lines).
Hunk #2 succeeded at 4696 (offset -35 lines).
Hunk #3 succeeded at 5105 (offset -35 lines).

Applying 0004.patch using patch: 
patching file package/localedef/2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2/0003-Fix-GCC-11-Warray-parameter-warning-for-__sigsetjmp-.patch
patching file package/localedef/2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2/0004-Avoid-Wstringop-overflow-warning-in-pthread_cleanup_.patch
>>> host-localedef 2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 Updating config.sub and config.guess
for file in config.guess config.sub; do for i in $(find /home/ian/build/hiwire-linux-5c671c59-x86_64/buildroot/build/host-localedef-2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 -name $file); do cp support/gnuconfig/$file $i; done; done
>>> host-localedef 2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 Patching libtool
>>> host-localedef 2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 Configuring
mkdir -p /home/ian/build/hiwire-linux-5c671c59-x86_64/buildroot/build/host-localedef-2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2/build

But I am still seeing an error:

make[1]: Entering directory '/home/ian/projects/hiwire-linux/source/buildroot'
glibc-2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2.tar.gz: OK (sha256: f4710e9a435a7b83e1d23dd75434f0d36b898eba9b4249c946c32b467d852fd4)
>>> host-localedef 2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 Extracting
gzip -d -c /home/ian/build/download/glibc/glibc-2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2.tar.gz | tar --strip-components=1 -C /home/ian/build/hiwire-linux-5c671c59-x86_64/buildroot/build/host-localedef-2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2   -xf -
>>> host-localedef 2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 Patching

Applying 0001-HACK-only-build-and-install-localedef.patch using patch: 
patching file Rules
Hunk #1 succeeded at 212 (offset 22 lines).
patching file locale/Makefile
Hunk #1 succeeded at 33 (offset 1 line).

Applying 0002-relax-dependency-on-GCC-to-4.8-and-binutils-to-2.24.patch using patch: 
patching file configure
Hunk #1 succeeded at 4566 (offset -35 lines).
Hunk #2 succeeded at 4696 (offset -35 lines).
Hunk #3 succeeded at 5105 (offset -35 lines).

Applying 0004.patch using patch: 
patching file package/localedef/2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2/0003-Fix-GCC-11-Warray-parameter-warning-for-__sigsetjmp-.patch
patching file package/localedef/2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2/0004-Avoid-Wstringop-overflow-warning-in-pthread_cleanup_.patch
>>> host-localedef 2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 Updating config.sub and config.guess
for file in config.guess config.sub; do for i in $(find /home/ian/build/hiwire-linux-5c671c59-x86_64/buildroot/build/host-localedef-2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 -name $file); do cp support/gnuconfig/$file $i; done; done
>>> host-localedef 2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 Patching libtool
>>> host-localedef 2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2 Configuring
mkdir -p /home/ian/build/hiwire-linux-5c671c59-x86_64/buildroot/build/host-localedef-2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2/build
Comment 6 Dr I J Ormshaw 2021-05-17 08:50:40 UTC
Created attachment 8961 [details]
Latest patch tested
Comment 7 Dr I J Ormshaw 2021-05-17 08:53:05 UTC
Looks like I got confused by the external links.  I think I now have the intended pathch, but still the same result:

Applying 0003-v1-package-localedef-fix-host-gcc-11.x-compile.patch using patch: 
patching file package/localedef/2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2/0003-Fix-GCC-11-Warray-parameter-warning-for-__sigsetjmp-.patch
patching file package/localedef/2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2/0004-Avoid-Wstringop-overflow-warning-in-pthread_cleanup_.patch

...

In file included from ../include/pthread.h:1,
                 from ../sysdeps/nptl/thread_db.h:25,
                 from ../nptl/descr.h:32,
                 from ../sysdeps/x86_64/nptl/tls.h:130,
                 from ../sysdeps/generic/libc-tsd.h:44,
                 from ./localeinfo.h:224,
                 from programs/ld-ctype.c:37:
../sysdeps/nptl/pthread.h:734:47: error: argument 1 of type ‘struct __jmp_buf_tag *’ declared as a pointer [-Werror=array-parameter=]
  734 | extern int __sigsetjmp (struct __jmp_buf_tag *__env, int __savemask) __THROWNL;
      |                         ~~~~~~~~~~~~~~~~~~~~~~^~~~~
In file included from ../include/setjmp.h:2,
                 from ../nptl/descr.h:24,
                 from ../sysdeps/x86_64/nptl/tls.h:130,
                 from ../sysdeps/generic/libc-tsd.h:44,
                 from ./localeinfo.h:224,
                 from programs/ld-ctype.c:37:
../setjmp/setjmp.h:54:46: note: previously declared as an array ‘struct __jmp_buf_tag[1]’
   54 | extern int __sigsetjmp (struct __jmp_buf_tag __env[1], int __savemask) __THROWNL;
      |                         ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
cc1: all warnings being treated as errors
Comment 8 Peter Seiderer 2021-05-17 18:29:06 UTC
(In reply to Dr I J Ormshaw from comment #7)

> Applying 0003-v1-package-localedef-fix-host-gcc-11.x-compile.patch using patch: 
> patching file package/localedef/2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2/0003-Fix-GCC-11-Warray-parameter-warning-for-__sigsetjmp-.patch
> patching file package/localedef/2.32-37-g760e1d287825fa91d4d5a0cc921340c740d803e2/0004-Avoid-Wstringop-overflow-warning-in-pthread_cleanup_.patch

This looks wrong...., your patch is patching the buildroot sources and not the host-localedef ones...., the output should look like the following:

[...]
Applying 0003-Fix-GCC-11-Warray-parameter-warning-for-__sigsetjmp-.patch using patch:
patching file include/bits/types/struct___jmp_buf_tag.h
patching file setjmp/Makefile
patching file setjmp/bits/types/struct___jmp_buf_tag.h
patching file setjmp/setjmp.h
patching file sysdeps/nptl/pthread.h

Applying 0004-Avoid-Wstringop-overflow-warning-in-pthread_cleanup_.patch using patch:
patching file misc/sys/cdefs.h
patching file sysdeps/nptl/pthread.h
[...]

Howto apply a patch from patchwork:

    $ wget https://buildroot.org/downloads/buildroot-2021.02.2.tar.gz
    $ tar -xvzf buildroot-2021.02.2.tar.gz
    $ curl -O -J https://patchwork.ozlabs.org/project/buildroot/patch/20210514175429.20552-1-ps.report@gmx.net/mbox/
    $ cd buildroot-2021.02.2
    $ patch -p 1 < ../v1-package-localedef-fix-host-gcc-11.x-compile.patch
Comment 9 Dr I J Ormshaw 2021-05-18 06:17:48 UTC
To test the patch in the environment in which it was discovered, I applied the patch to my existing source tree, which contains a sub-module that is the clone of the buildroot repo checked out to the 2021.02.2 tag.  With the patch applied the build completed successfully.  Thanks for you patience and help.
Comment 10 Peter Seiderer 2021-05-18 21:31:43 UTC
(In reply to Dr I J Ormshaw from comment #9)

Thanks for reporting, testing and specially for conforming that the patch solves the reported problem ;-)