public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libcc1/104799] New: Header issue with x86_64-linux-musl based cross-compiler
@ 2022-03-05 17:25 fxcoudert at gcc dot gnu.org
  2022-03-05 17:27 ` [Bug libcc1/104799] " fxcoudert at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2022-03-05 17:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104799

            Bug ID: 104799
           Summary: Header issue with x86_64-linux-musl based
                    cross-compiler
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libcc1
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fxcoudert at gcc dot gnu.org
  Target Milestone: ---

Trying to build a cross-compiler for build == host == x86_64-linux-musl (Alpine
Linux 3.15) and target == aarch64-apple-darwin leads to the following build
error:

[12:57:48] libtool: compile:  x86_64-linux-musl-g++ -DHAVE_CONFIG_H -I.
-I/workspace/srcdir/gcc-darwin-arm64/libcc1 -I
/workspace/srcdir/gcc-darwin-arm64/libcc1/../include -I
/workspace/srcdir/gcc-darwin-arm64/libcc1/../libgcc -I ../gcc
-I/workspace/srcdir/gcc-darwin-arm64/libcc1/../gcc -I
/workspace/srcdir/gcc-darwin-arm64/libcc1/../gcc/c
-I/workspace/srcdir/gcc_build/./gmp -I/workspace/srcdir/gcc-darwin-arm64/gmp
-I/workspace/srcdir/gcc_build/./mpfr/src
-I/workspace/srcdir/gcc-darwin-arm64/mpfr/src
-I/workspace/srcdir/gcc-darwin-arm64/mpc/src -I
/workspace/srcdir/gcc-darwin-arm64/libcc1/../gcc/c-family -I
/workspace/srcdir/gcc-darwin-arm64/libcc1/../libcpp/include -W -Wall
-fvisibility=hidden -fcf-protection -g -O2 -MT libcc1plugin.lo -MD -MP -MF
.deps/libcc1plugin.Tpo -c
/workspace/srcdir/gcc-darwin-arm64/libcc1/libcc1plugin.cc  -fPIC -DPIC -o
.libs/libcc1plugin.o
[12:57:49] In file included from /usr/include/pthread.h:30,
[12:57:49]                  from
/usr/include/c++/10.3.1/x86_64-alpine-linux-musl/bits/gthr-default.h:35,
[12:57:49]                  from
/usr/include/c++/10.3.1/x86_64-alpine-linux-musl/bits/gthr.h:148,
[12:57:49]                  from /usr/include/c++/10.3.1/ext/atomicity.h:35,
[12:57:49]                  from /usr/include/c++/10.3.1/memory:75,
[12:57:49]                  from
/workspace/srcdir/gcc-darwin-arm64/libcc1/deleter.hh:23,
[12:57:49]                  from
/workspace/srcdir/gcc-darwin-arm64/libcc1/rpc.hh:25,
[12:57:49]                  from
/workspace/srcdir/gcc-darwin-arm64/libcc1/libcc1plugin.cc:67:
[12:57:49] /usr/include/sched.h:84:7: error: attempt to use poisoned "calloc"
[12:57:49]    84 | void *calloc(size_t, size_t);
[12:57:49]       |       ^
[12:57:49] /usr/include/sched.h:124:36: error: attempt to use poisoned "calloc"
[12:57:49]   124 | #define CPU_ALLOC(n) ((cpu_set_t
*)calloc(1,CPU_ALLOC_SIZE(n)))
[12:57:49]       |                                    ^


This was reported on the Iain Sandoe's GCC branch, but appears to be generic
(i.e., not specific to aarch64 at all). It seems like it's an issue with musl
headers, and there has been a similar issue reported in libgccjit before, at
gentoo: https://bugs.gentoo.org/828580 (for which Alpine is shipping a patch:
https://git.alpinelinux.org/aports/tree/main/gcc/0039-Fix-attempt-to-use-poisoned-calloc-error-in-libgccji.patch?id=dae75528cea4d8ea8e110dd4a2fbd454cc686d15)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libcc1/104799] Header issue with x86_64-linux-musl based cross-compiler
  2022-03-05 17:25 [Bug libcc1/104799] New: Header issue with x86_64-linux-musl based cross-compiler fxcoudert at gcc dot gnu.org
@ 2022-03-05 17:27 ` fxcoudert at gcc dot gnu.org
  2022-03-05 18:37 ` mose at gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: fxcoudert at gcc dot gnu.org @ 2022-03-05 17:27 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104799

--- Comment #1 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> ---
Should have added a link to the original report:
https://github.com/iains/gcc-darwin-arm64/issues/84

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libcc1/104799] Header issue with x86_64-linux-musl based cross-compiler
  2022-03-05 17:25 [Bug libcc1/104799] New: Header issue with x86_64-linux-musl based cross-compiler fxcoudert at gcc dot gnu.org
  2022-03-05 17:27 ` [Bug libcc1/104799] " fxcoudert at gcc dot gnu.org
@ 2022-03-05 18:37 ` mose at gnu dot org
  2022-05-25 14:39 ` lancethepants at gmail dot com
  2022-07-02 15:35 ` slyfox at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mose at gnu dot org @ 2022-03-05 18:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104799

--- Comment #2 from Mosè Giordano <mose at gnu dot org> ---
Created attachment 52568
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=52568&action=edit
Patch for poisoned calloc on Musl systems

Following the example of
https://git.alpinelinux.org/aports/tree/main/gcc/0042-Fix-attempt-to-use-poisoned-calloc-error-in-libgccji.patch,
reported in https://bugs.gentoo.org/828580, I wrote the attached patch for
libcc1, which seems to solve the issue for me.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libcc1/104799] Header issue with x86_64-linux-musl based cross-compiler
  2022-03-05 17:25 [Bug libcc1/104799] New: Header issue with x86_64-linux-musl based cross-compiler fxcoudert at gcc dot gnu.org
  2022-03-05 17:27 ` [Bug libcc1/104799] " fxcoudert at gcc dot gnu.org
  2022-03-05 18:37 ` mose at gnu dot org
@ 2022-05-25 14:39 ` lancethepants at gmail dot com
  2022-07-02 15:35 ` slyfox at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: lancethepants at gmail dot com @ 2022-05-25 14:39 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104799

Lance Fredrickson <lancethepants at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |lancethepants at gmail dot com

--- Comment #3 from Lance Fredrickson <lancethepants at gmail dot com> ---
Similar? to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105632

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug libcc1/104799] Header issue with x86_64-linux-musl based cross-compiler
  2022-03-05 17:25 [Bug libcc1/104799] New: Header issue with x86_64-linux-musl based cross-compiler fxcoudert at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2022-05-25 14:39 ` lancethepants at gmail dot com
@ 2022-07-02 15:35 ` slyfox at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: slyfox at gcc dot gnu.org @ 2022-07-02 15:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104799

Sergei Trofimovich <slyfox at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
   Target Milestone|---                         |12.2
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #4 from Sergei Trofimovich <slyfox at gcc dot gnu.org> ---
> libcc1/libcc1plugin.cc

(In reply to Mosè Giordano from comment #2)
> Created attachment 52568 [details]
> Patch for poisoned calloc on Musl systems
> 
> Following the example of
> https://git.alpinelinux.org/aports/tree/main/gcc/0042-Fix-attempt-to-use-
> poisoned-calloc-error-in-libgccji.patch, reported in
> https://bugs.gentoo.org/828580, I wrote the attached patch for libcc1, which
> seems to solve the issue for me.

I think the change looks reasonable. Should be fixed by "c++: avoid <memory>
poisoning on musl [PR106102]" patch from PR106102 in master and gcc-12
branches.

Can you give it a try?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-07-02 15:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-05 17:25 [Bug libcc1/104799] New: Header issue with x86_64-linux-musl based cross-compiler fxcoudert at gcc dot gnu.org
2022-03-05 17:27 ` [Bug libcc1/104799] " fxcoudert at gcc dot gnu.org
2022-03-05 18:37 ` mose at gnu dot org
2022-05-25 14:39 ` lancethepants at gmail dot com
2022-07-02 15:35 ` slyfox at gcc dot gnu.org

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).