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

            Bug ID: 105225
           Summary: build failure with musl libc 1.2.3 due to sysinfo.go
                    error: redefinition of 'SYS_SECCOMP'
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: go
          Assignee: ian at airs dot com
          Reporter: ncopa at alpinelinux dot org
                CC: cmang at google dot com
  Target Milestone: ---

Building gcc 11.2.1 with musl libc 1.2.3 fails with:

11.2.1_git20220219/libgo/go/syscall/time_nofake.go
/home/ncopa/aports/main/gcc/src/gcc-11.2.1_git20220219/libgo/go/syscall/timestruct.go
libcalls.go sysinfo.go syscall_arch.go syscall_linknames.go epoll.go  -fPIC -o
.libs/syscall.o
sysinfo.go:6606:7: error: redefinition of 'SYS_SECCOMP'
 6606 | const SYS_SECCOMP = _SYS_SECCOMP
      |       ^
sysinfo.go:6600:7: note: previous definition of 'SYS_SECCOMP' was here
 6600 | const SYS_SECCOMP = _SYS_seccomp
      |       ^
make[2]: *** [Makefile:3001: syscall.lo] Error 1

The generation of sysinfo.go will try extract syscalls and convert them to
uppercase. It gets duplicated by the uppercase SYS_SECCOMP introduced in with
musl commit:
https://git.musl-libc.org/cgit/musl/commit/?id=3dcbd896907d9d474da811b7c6b769342abaf651

A possible fix is to only grep for syscalls with lowercase letters:
diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
index 6fef104..06289a4 100755
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -126,7 +126,7 @@ if ! grep '^const SIGCLD ' ${OUT} >/dev/null 2>&1; then
 fi

 # The syscall numbers.  We force the names to upper case.
-grep '^const _SYS_' gen-sysinfo.go | \
+grep '^const _SYS_[a-z]' gen-sysinfo.go | \
   sed -e 's/const _\(SYS_[^= ]*\).*$/\1/' | \
   while read sys; do
     sup=`echo $sys | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ`

Reply via email to