gcc-snapshot: FTBFS on hurd-i386 (and other archs?)

2023-01-16 Thread Svante Signell via Gcc-bugs
Source: gcc-snapshot
Version: 20230108-1
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd
X-Debbugs-CC: debian-h...@lists.debian.org

Hi,

gcc-snapshot in sid FTBFS on hurd-i386 due to that some patches are not
applied when building gcc-snapshot. After the statement in rules.patch
ifeq ($(single_package),yes)
  debian_patches =
endif
previously defined patches are cleared, causing the build failure, see
below.

debian/ files causing the problem:

debian/rules.defs:
ifneq (,$(findstring gcc-snapshot, $(PKGSOURCE)))
  single_package = yes
  trunk_build = yes

debian/rules.patch:
ifeq ($(single_package),yes)
  debian_patches =
endif

Thanks!




gcc-11: FTBFS on hurd-i386

2023-01-03 Thread Svante Signell via Gcc-bugs
Source: gcc-11
Version: 11.3.0-10
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd
Affects: gcc-11, gcc-snapshot
X-Debbugs-CC: debian-h...@lists.debian.org

Hi,

gcc-11-11.3.0-10 in sid FTBFS on hurd-i386 due to failing linkage of
pthread_once (same error already fixed in gcc-12 and gcc-13):
/<>/build/i686-gnu/libstdc++-v3/include/i686-gnu/bits/gthr-
default.h:700: undefined reference to `pthread_once'
and more.

The patch at hand is: libstdc++-hurd.diff, attached here for convenience.

Thanks!

This is notably needed because in glibc 2.34, the move of pthread functions
into libc.so happened for Linux only, not GNU/Hurd.

The pthread_self() function can also always be used fine as it is on
GNU/Hurd.

libstdc++-v3/ChangeLog:

* config/os/gnu-linux/os_defines.h [!__linux__]
  (_GLIBCXX_NATIVE_THREAD_ID, _GLIBCXX_GTHREAD_USE_WEAK): Do not define.

--- a/libstdc++-v3/config/os/gnu-linux/os_defines.h
+++ b/libstdc++-v3/config/os/gnu-linux/os_defines.h
@@ -49,22 +49,24 @@
 // version dynamically in case it has changed since libstdc++ was configured.
 #define _GLIBCXX_NO_OBSOLETE_ISINF_ISNAN_DYNAMIC __GLIBC_PREREQ(2,23)
 
-#if __GLIBC_PREREQ(2, 27)
-// Since glibc 2.27 pthread_self() is usable without linking to libpthread.
-# define _GLIBCXX_NATIVE_THREAD_ID pthread_self()
-#else
+#ifdef __linux__
+# if __GLIBC_PREREQ(2, 27)
+// Since glibc 2.27 Linux' pthread_self() is usable without linking to libpthread.
+#  define _GLIBCXX_NATIVE_THREAD_ID pthread_self()
+# else
 // Before then it was in libc.so.6 but not libc.a, and always returns 0,
 // which breaks the invariant this_thread::get_id() != thread::id{}.
 // So only use it if we know the libpthread version is available.
 // Otherwise use (__gthread_t)1 as the ID of the main (and only) thread.
-# define _GLIBCXX_NATIVE_THREAD_ID \
-  (__gthread_active_p() ? __gthread_self() : (__gthread_t)1)
-#endif
+#  define _GLIBCXX_NATIVE_THREAD_ID \
+   (__gthread_active_p() ? __gthread_self() : (__gthread_t)1)
+# endif
 
-#if __GLIBC_PREREQ(2, 34)
-// Since glibc 2.34 all pthreads functions are usable without linking to
+# if __GLIBC_PREREQ(2, 34)
+// Since glibc 2.34 all Linux pthreads functions are usable without linking to
 // libpthread.
-# define _GLIBCXX_GTHREAD_USE_WEAK 0
+#  define _GLIBCXX_GTHREAD_USE_WEAK 0
+# endif
 #endif
 
 #endif


gcc-12: FTBFS on hurd-i386

2022-10-06 Thread Svante Signell via Gcc-bugs
Source: gcc-12
Version: 12_12.2.0-5
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd
Affects: gcc-11, gcc-snapshot
X-Debbugs-CC: debian-h...@lists.debian.org

Hi,

gcc-12-12.2.0-4/5 in sid FTBFS on hurd-i386 due to failing linkage of
pthread_once (same error for gcc-11, gcc-12, gcc-snapshot):
/<>/build/i686-gnu/libstdc++-v3/include/i686-gnu/bits/gthr-
default.h:700: undefined reference to `pthread_once'

Patches have already submitted upstream by Samuel Thibault in August and
September, see
https://gcc.gnu.org/pipermail/gcc-patches/2022-August/600469.html
https://gcc.gnu.org/pipermail/gcc-patches/2022-September/601754.html

Unfortunately upstream is not very responsive. Therefore I have taken the time
to send these patches to Debian in the mean time.

Patches extracted and attached from that mail message are:
1.diff-6.diff. Note that 1.diff does not apply to gcc-12, it is related to the
git repo. This is reflected in attached debian_rules.patch by commenting out
1.diff.

Just a reflection: Matthias you are really doing a great job with the
gcc releases: Kudos!

Thanks!

diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog
index ba5939d9003..dd288cce2ca 100644
--- a/src/libstdc++-v3/ChangeLog
+++ b/src/libstdc++-v3/ChangeLog
@@ -1,3 +1,11 @@
+2022-08-28  Samuel Thibault  
+
+   * config/os/gnu/os_defines.h: New file.
+   * config/os/gnu/ctype_base.h: New file.
+   * config/os/gnu/ctype_configure_char.cc: New file.
+   * config/os/gnu/ctype_inline.h: New file.
+   * configure.host: On gnu* host, use os/gnu instead of os/gnu-linux.
+
 2022-08-27  Patrick Palka  
diff --git a/src/libstdc++-v3/config/os/gnu/ctype_base.h b/src/libstdc++-v3/config/os/gnu/ctype_base.h
new file mode 100644
index 000..955146543db
--- /dev/null
+++ b/src/libstdc++-v3/config/os/gnu/ctype_base.h
@@ -0,0 +1,66 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 1997-2022 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// Under Section 7 of GPL version 3, you are granted additional
+// permissions described in the GCC Runtime Library Exception, version
+// 3.1, as published by the Free Software Foundation.
+
+// You should have received a copy of the GNU General Public License and
+// a copy of the GCC Runtime Library Exception along with this program;
+// see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see
+// .
+
+/** @file bits/ctype_base.h
+ *  This is an internal header file, included by other library headers.
+ *  Do not attempt to use it directly. @headername{locale}
+ */
+
+//
+// ISO C++ 14882: 22.1  Locales
+//
+
+// Information as gleaned from /usr/include/ctype.h
+
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+  /// @brief  Base class for ctype.
+  struct ctype_base
+  {
+// Non-standard typedefs.
+typedef const int* 		__to_type;
+
+// NB: Offsets into ctype::_M_table force a particular size
+// on the mask type. Because of this, we don't use an enum.
+typedef unsigned short 	mask;
+static const mask upper	= _ISupper;
+static const mask lower 	= _ISlower;
+static const mask alpha 	= _ISalpha;
+static const mask digit 	= _ISdigit;
+static const mask xdigit 	= _ISxdigit;
+static const mask space 	= _ISspace;
+static const mask print 	= _ISprint;
+static const mask graph 	= _ISalpha | _ISdigit | _ISpunct;
+static const mask cntrl 	= _IScntrl;
+static const mask punct 	= _ISpunct;
+static const mask alnum 	= _ISalpha | _ISdigit;
+#if __cplusplus >= 201103L
+static const mask blank	= _ISblank;
+#endif
+  };
+
+_GLIBCXX_END_NAMESPACE_VERSION
+} // namespace
diff --git a/src/libstdc++-v3/config/os/gnu/ctype_configure_char.cc b/src/libstdc++-v3/config/os/gnu/ctype_configure_char.cc
new file mode 100644
index 000..5a88fc11ab3
--- /dev/null
+++ b/src/libstdc++-v3/config/os/gnu/ctype_configure_char.cc
@@ -0,0 +1,196 @@
+// Locale support -*- C++ -*-
+
+// Copyright (C) 2011-2022 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 3, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but 

Re: Bug#1005297: gcc-12-12-20220214: FTBFS on hurd-i386; Was: gcc-12-12-20220206: FTBFS on hurd-i386

2022-02-18 Thread Svante Signell via Gcc-bugs
retitle 1005297 gcc-12-12-29229214: FTBFS on hurd-i386
thanks

On Thu, 2022-02-10 at 19:34 +0100, Svante Signell wrote:
> Source: gcc-12
> Version: 12_12-20220206-1
> Severity: important
> Tags: patch
> User: debian-h...@lists.debian.org
> Usertags: hurd

Hi again,

Attached are patches to successfully build gcc-12-12-20220214-1 from source:

debian_rules.patch.patch: Adds hurd-specific patches to to debian/rules.patch.
gcc_config_gnu.h.diff: Re-enables split-stack support.

The patches below are needed for a successful build of libgo.so.21.0.0:
libgo_go_net_unixsock_readmsg_cloexec.go.diff
libgo_go_runtime_netpoll_hurd.go.diff
libgo_go_runtime_os_hurd.go.diff
libgo_go_syscall_exec_bsd.go.diff
libgo_go_syscall_exec_hurd.go.diff
libgo_go_os_user_cgo_listgroups_unix.go.diff
libgo_go_os_user_getgrouplist_unix.go.diff
libgo_go_internal_testenv_testenv_unix.go.diff
libgo_go_os_exec_internal_fdtest_exists_unix.go.diff

Makefile.in.diff: This patch is modified from the upstream patch
src_Makefile.in.diff since the Debian-specific patch gm2.diff makes changes to
src/Makefile.in before Makefile.in.diff is applied.

All patches have been submitted upstream in 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104290

The patch, libgo_go_net_unixsock_readmsg_cloexec.go.diff, has already been
committed upstream by Ian.

Thanks!
--- a/debian/rules.patch	2022-02-15 23:07:04.0 +0100
+++ b/debian/rules.patch	2022-02-15 23:14:51.0 +0100
@@ -192,6 +192,17 @@
 
 ifeq ($(DEB_TARGET_ARCH_OS),hurd)
   debian_patches += hurd-changes
+  debian_patches += gcc_config_gnu.h
+  debian_patches += libgo_go_net_unixsock_readmsg_cloexec.go
+  debian_patches += libgo_go_runtime_netpoll_hurd.go
+  debian_patches += libgo_go_runtime_os_hurd.go
+  debian_patches += libgo_go_syscall_exec_bsd.go
+  debian_patches += libgo_go_syscall_exec_hurd.go
+  debian_patches += libgo_go_os_user_cgo_listgroups_unix.go
+  debian_patches += libgo_go_os_user_getgrouplist_unix.go
+  debian_patches += libgo_go_internal_testenv_testenv_unix.go
+  debian_patches += libgo_go_os_exec_internal_fdtest_exists_unix.go
+  debian-patches += Makefile.in
 endif
 
 debian_patches += gcc-ice-dump
--- a/src/gcc/config/gnu.h	2022-02-06 11:59:41.0 +0100
+++ b/src/gcc/config/gnu.h	2022-02-06 12:00:19.0 +0100
@@ -19,6 +19,9 @@
 along with GCC.  If not, see .
 */
 
+#define OPTION_GLIBC_P(opts)	(DEFAULT_LIBC == LIBC_GLIBC)
+#define OPTION_GLIBC		OPTION_GLIBC_P (_options)
+
 #undef GNU_USER_TARGET_OS_CPP_BUILTINS
 #define GNU_USER_TARGET_OS_CPP_BUILTINS()		\
 do {	\
--- a/src/libgo/go/internal/testenv/testenv_unix.go	2022-02-14 03:23:21.0 +0100
+++ b/src/libgo/go/internal/testenv/testenv_unix.go	2022-02-15 13:06:16.0 +0100
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
+//go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris
 
 package testenv
 
--- a/src/libgo/go/net/unixsock_readmsg_cloexec.go	2022-02-15 00:27:45.0 +0100
+++ b/src/libgo/go/net/unixsock_readmsg_cloexec.go	2022-02-15 00:29:01.0 +0100
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build aix || darwin || freebsd || solaris
+//go:build aix || darwin || freebsd || hurd || solaris
 
 package net
 
--- a/src/libgo/go/os/exec/internal/fdtest/exists_unix.go	2022-02-14 03:23:21.0 +0100
+++ b/src/libgo/go/os/exec/internal/fdtest/exists_unix.go	2022-02-15 13:38:42.0 +0100
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
+//go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris
 
 // Package fdtest provides test helpers for working with file descriptors across exec.
 package fdtest
--- a/src/libgo/go/os/user/cgo_listgroups_unix.go	2022-02-14 03:23:22.0 +0100
+++ b/src/libgo/go/os/user/cgo_listgroups_unix.go	2022-02-15 12:13:35.0 +0100
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-//go:build (dragonfly || darwin || freebsd || (!android && linux) || netbsd || openbsd || (solaris && !illumos)) && cgo && !osusergo
+//go:build (dragonfly || darwin || freebsd || hurd || (!android && linux) || netbsd || openbsd || (solaris && !illumos)) && cgo && !osusergo
 
 package user
 
--- a/src/libgo/go/os/user/getgrouplist_unix.go	2022-02-14 03:23:22.0 +0100
+++ b/src/libgo/go/os/user/getgrouplist_unix.go	2022-02-15 12:17:12.0 +0100
@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found 

gcc-12-12-20220206: FTBFS on hurd-i386

2022-02-10 Thread Svante Signell via Gcc-bugs
Source: gcc-12
Version: 12_12-20220206-1
Severity: important
Tags: patch
User: debian-h...@lists.debian.org
Usertags: hurd

Hi,

gcc-12-12-20220206 in experimental FTBFS on hurd-i386 due to missing
patches for gccgo, gnu.h and an yet unresolved bug in src/Makefile.in.
Attached are patches needed for a successful build.

This bug has been reported by Mathias and assigned upstream, see
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104290
but no patches are yet committed.

debian_rules.patch.patch patches debian/rules.patch to include the two
patches: gcc_config_gnu.h.diff fixing the split-stack problem when
building gotools and libgo_go_net_unixsock_readmsg_cloexec.go.diff
fixing the build of libgo. The last patch src_Makefile.in.patch, is for
src/Makefile.in moving 
all-target-libgo: maybe-all-target-libbacktrace
all-target-libgo: maybe-all-target-libatomic
outside of the
@unless gcc-bootstrap
@endunless gcc-bootstrap
pair. This patch is not part of the debian_rules.patch since I'm unsure
if this a patch is needed for all architectures or GNU/Hurd only.

BTW: Creating a new src/Makefile.in by
(cd src; autogen Makefile.def) does still create a buggy Makefile.in.
The reason of why some dependencies are within the @unless/@endunless
pair is still unknown. configure{,.ac} has the following note:

# Do not nest @if/@endif or @unless/@endunless pairs, because
# configure will not warn you at all.

Googling around did not help much, I've found no documentation of it's
use and how to encounter it.

Just a reflection: Matthias you are really doing a great job with the
gcc releases: Kudos!

Thanks!

--- a/debian/rules.patch	2022-01-26 11:49:06.0 +0100
+++ b/debian/rules.patch	2022-02-02 13:08:44.0 +0100
@@ -192,6 +192,8 @@
 
 ifeq ($(DEB_TARGET_ARCH_OS),hurd)
   debian_patches += hurd-changes
+  debian_patches += gcc_config_gnu.h
+  debian_patches += libgo_go_net_unixsock_readmsg_cloexec.go
 endif
 
 debian_patches += gcc-ice-dump
--- a/src/gcc/config/gnu.h	2022-02-06 11:59:41.0 +0100
+++ b/src/gcc/config/gnu.h	2022-02-06 12:00:19.0 +0100
@@ -19,6 +19,9 @@
 along with GCC.  If not, see .
 */
 
+#define OPTION_GLIBC_P(opts)	(DEFAULT_LIBC == LIBC_GLIBC)
+#define OPTION_GLIBC		OPTION_GLIBC_P (_options)
+
 #undef GNU_USER_TARGET_OS_CPP_BUILTINS
 #define GNU_USER_TARGET_OS_CPP_BUILTINS()		\
 do {	\
--- a/src/libgo/go/net/unixsock_readmsg_cloexec.go	2021-08-25 14:06:31.0 +0200
+++ b/src/libgo/go/net/unixsock_readmsg_cloexec.go	2022-02-01 16:10:01.0 +0100
@@ -3,7 +3,7 @@
 // license that can be found in the LICENSE file.
 
 //go:build aix || darwin || freebsd || solaris
-// +build aix darwin freebsd solaris
+// +build aix darwin freebsd hurd solaris
 
 package net
 
--- a/src/Makefile.in	2022-02-08 23:25:36.0 +0100
+++ b/src/Makefile.in	2022-02-09 12:37:13.0 +0100
@@ -67372,6 +67372,8 @@
 all-m4: maybe-all-build-texinfo
 configure-target-libgo: maybe-configure-target-libffi
 all-target-libgo: maybe-all-target-libffi
+all-target-libgo: maybe-all-target-libbacktrace
+all-target-libgo: maybe-all-target-libatomic
 configure-target-libphobos: maybe-configure-target-libbacktrace
 configure-stage1-target-libphobos: maybe-configure-stage1-target-libbacktrace
 configure-stage2-target-libphobos: maybe-configure-stage2-target-libbacktrace
@@ -67541,8 +67543,6 @@
 configure-target-fastjar: maybe-configure-target-zlib
 all-target-fastjar: maybe-all-target-zlib
 configure-target-libgo: maybe-all-target-libstdc++-v3
-all-target-libgo: maybe-all-target-libbacktrace
-all-target-libgo: maybe-all-target-libatomic
 configure-target-libgm2: maybe-all-target-libstdc++-v3
 all-target-libgm2: maybe-all-target-libatomic
 configure-target-liboffloadmic: maybe-configure-target-libgomp