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)

Reply via email to