Skip to content
This repository has been archived by the owner on Feb 1, 2023. It is now read-only.

Commit

Permalink
Trac #29674: fedora-32: If gcc 10 is found, install gcc spkg; fix bui…
Browse files Browse the repository at this point in the history
…lding gcc (9.2.0) spkg with gcc 10

To work around build failures of some SPKGs with gcc 10, in particular
on fedora-32 (#29456),
we reject system gcc 10 and build the gcc spkg instead.

That itself requires patches, which we get from
https://bugs.gentoo.org/708346, for the following error:
{{{
libtool: compile:  /sage/local/var/tmp/sage/build/gcc-9.2.0/gcc-
build/./gcc/xgcc -shared-libgcc
-B/sage/local/var/tmp/sage/build/gcc-9.2.0/gcc-build/./gcc -nostdinc++
-L/sage/local/var/tmp/sage/build/gcc-9.2.0/gcc-build/x86_64-pc-linux-
gnu/libstdc++-v3/src -L/sage/local/var/tmp/sage/build/gcc-9.2.0/gcc-
build/x86_64-pc-linux-gnu/libstdc++-v3/src/.libs
-L/sage/local/var/tmp/sage/build/gcc-9.2.0/gcc-build/x86_64-pc-linux-
gnu/libstdc++-v3/libsupc++/.libs -B/sage/local/x86_64-pc-linux-gnu/bin/
-B/sage/local/x86_64-pc-linux-gnu/lib/ -isystem /sage/local/x86_64-pc-
linux-gnu/include -isystem /sage/local/x86_64-pc-linux-gnu/sys-include
-D_GNU_SOURCE -D_DEBUG -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS
-D__STDC_LIMIT_MACROS -DHAVE_RPC_XDR_H=0 -DHAVE_TIRPC_RPC_XDR_H=0 -I.
-I../../../../src/libsanitizer/sanitizer_common -I.. -I
../../../../src/libsanitizer/include -isystem
../../../../src/libsanitizer/include/system -Wall -W -Wno-unused-
parameter -Wwrite-strings -pedantic -Wno-long-long -fPIC -fno-builtin
-fno-exceptions -fno-rtti -fomit-frame-pointer -funwind-tables
-fvisibility=hidden -Wno-variadic-macros -I../../libstdc++-v3/include
-I../../libstdc++-v3/include/x86_64-pc-linux-gnu
-I../../../../src/libsanitizer/../libstdc++-v3/libsupc++ -std=gnu++11
-DSANITIZER_LIBBACKTRACE -DSANITIZER_CP_DEMANGLE -I
../../../../src/libsanitizer/../libbacktrace -I ../libbacktrace -I
../../../../src/libsanitizer/../include -include
../../../../src/libsanitizer/libbacktrace/backtrace-rename.h -g -O2
-D_GNU_SOURCE -MT sanitizer_posix.lo -MD -MP -MF
.deps/sanitizer_posix.Tpo -c
../../../../src/libsanitizer/sanitizer_common/sanitizer_posix.cc  -fPIC
-DPIC -o .libs/sanitizer_posix.o
In file included from ../../../../src/libsanitizer/sanitizer_common/sani
tizer_platform_limits_posix.cc:193:
../../../../src/libsanitizer/sanitizer_common/sanitizer_internal_defs.h:
339:72: error: narrowing conversion of '-1' from 'int' to 'long unsigned
int' [-Wnarrowing]
  339 |     typedef char IMPL_PASTE(assertion_failed_##_,
line)[2*(int)(pred)-1]
      |
^
}}}

To reproduce:
{{{
  tox -e docker-fedora-32-standard-gcc_spkg
}}}

See also:
- https://bugzilla.redhat.com/show_bug.cgi?id=1774798

URL: https://trac.sagemath.org/29674
Reported by: mkoeppe
Ticket author(s): Matthias Koeppe
Reviewer(s): Michael Orlitzky
  • Loading branch information
Release Manager committed May 12, 2020
2 parents c5c78af + ca0d8a4 commit d15ac82
Show file tree
Hide file tree
Showing 4 changed files with 255 additions and 0 deletions.
132 changes: 132 additions & 0 deletions .github/workflows/tox-gcc_spkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
name: Run SAGE_ROOT/tox.ini

## This GitHub Actions workflow runs SAGE_ROOT/tox.ini with select environments,
## whenever a GitHub pull request is opened or synchronized in a repository
## where GitHub Actions are enabled.
##
## It builds and checks some sage spkgs as defined in TARGETS.
##
## A job succeeds if there is no error.
##
## The build is run with "make V=0", so the build logs of individual packages are suppressed.
##
## At the end, all package build logs that contain an error are printed out.
##
## After all jobs have finished (or are canceled) and a short delay,
## tar files of all logs are made available as "build artifacts".

#on: [push, pull_request]

on:
pull_request:
types: [opened, synchronize]
push:
tags:
- '*'

env:
TARGETS_PRE: sagelib-build-deps
TARGETS: build doc-html
TARGETS_OPTIONAL: ptest

jobs:
docker:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tox_system_factor: [ubuntu-trusty, ubuntu-xenial, ubuntu-bionic, ubuntu-eoan, ubuntu-focal, debian-jessie, debian-stretch, debian-buster, debian-bullseye, debian-sid, linuxmint-17, linuxmint-18, linuxmint-19, linuxmint-19.3, fedora-26, fedora-27, fedora-28, fedora-29, fedora-30, fedora-31, fedora-32, centos-7, centos-8, archlinux-latest, slackware-14.2, conda-forge, ubuntu-bionic-i386, ubuntu-eoan-i386, debian-buster-i386, centos-7-i386]
tox_packages_factor: [minimal-gcc_spkg, standard-gcc_spkg, standard-python2-gcc_spkg]
env:
TOX_ENV: docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}
LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-docker-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}
DOCKER_TARGETS: configured with-targets with-targets-optional
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 500
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: free disk space
run: |
sudo swapoff -a
sudo rm -f /swapfile
sudo apt clean
docker rmi $(docker image ls -aq)
df -h
- name: Install test prerequisites
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install python-tox
- run: |
set -o pipefail; EXTRA_DOCKER_BUILD_ARGS="--build-arg USE_MAKEFLAGS=\"-k V=0 SAGE_NUM_THREADS=3\"" tox -e $TOX_ENV -- $TARGETS 2>&1 | sed "/^configure: notice:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: warning:/s|^|::warning file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;/^configure: error:/s|^|::error file=artifacts/$LOGS_ARTIFACT_NAME/config.log::|;"
- name: Copy logs from the docker image or build container
run: |
mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"
cp -r .tox/$TOX_ENV/Dockerfile .tox/$TOX_ENV/log "artifacts/$LOGS_ARTIFACT_NAME"
if [ -f .tox/$TOX_ENV/Dockertags ]; then CONTAINERS=$(docker create $(tail -1 .tox/$TOX_ENV/Dockertags) /bin/bash || true); fi
if [ -n "$CONTAINERS" ]; then for CONTAINER in $CONTAINERS; do for ARTIFACT in /sage/logs; do docker cp $CONTAINER:$ARTIFACT artifacts/$LOGS_ARTIFACT_NAME && HAVE_LOG=1; done; if [ -n "$HAVE_LOG" ]; then break; fi; done; fi
if: always()
- uses: actions/upload-artifact@v1
with:
path: artifacts
name: ${{ env.LOGS_ARTIFACT_NAME }}
if: always()
- name: Print out logs for immediate inspection
# and markup the output with GitHub Actions logging commands
run: |
.github/workflows/scan-logs.sh "artifacts/$LOGS_ARTIFACT_NAME"
if: always()
- name: Push docker images
run: |
if [ -f .tox/$TOX_ENV/Dockertags ]; then
TOKEN="${{ secrets.DOCKER_PKG_GITHUB_TOKEN }}"
if [ -z "$TOKEN" ]; then
TOKEN="${{ secrets.GITHUB_TOKEN }}"
fi
echo "$TOKEN" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
for a in $(cat .tox/$TOX_ENV/Dockertags); do
FULL_TAG=docker.pkg.github.com/${{ github.repository }}/$a
docker tag $a $FULL_TAG
echo Pushing $FULL_TAG
docker push $FULL_TAG
done || echo "(Ignoring errors)"
fi
if: always()

local-ubuntu:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tox_system_factor: [conda-forge-ubuntu]
tox_packages_factor: [minimal-gcc_spkg, standard-gcc_spkg, standard-python2-gcc_spkg]
env:
TOX_ENV: local-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}
LOGS_ARTIFACT_NAME: logs-commit-${{ github.sha }}-tox-local-${{ matrix.tox_system_factor }}-${{ matrix.tox_packages_factor }}
steps:
- uses: actions/checkout@v2
- name: Install test prerequisites
run: |
sudo DEBIAN_FRONTEND=noninteractive apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install python-tox
- name: Build and test with tox
# We use a high parallelization on purpose in order to catch possible parallelization bugs in the build scripts.
# For doctesting, we use a lower parallelization to avoid timeouts.
run: |
MAKE="make -j12" tox -e $TOX_ENV -- SAGE_NUM_THREADS=4 $TARGETS
- name: Prepare logs artifact
run: |
mkdir -p "artifacts/$LOGS_ARTIFACT_NAME"; cp -r .tox/*/log "artifacts/$LOGS_ARTIFACT_NAME"
if: always()
- uses: actions/upload-artifact@v1
with:
path: artifacts
name: ${{ env.LOGS_ARTIFACT_NAME }}
if: always()
- name: Print out logs for immediate inspection
# and markup the output with GitHub Actions logging commands
run: |
.github/workflows/scan-logs.sh "artifacts/$LOGS_ARTIFACT_NAME"
if: always()
40 changes: 40 additions & 0 deletions build/pkgs/gcc/patches/35_all_glibc-2.31-libsanitizer-1.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
https://bugs.gentoo.org/708346

From ce9568e9e9cf6094be30e748821421e703754ffc Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 8 Nov 2019 19:53:18 +0100
Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
bootstrap due to libsanitizer)

Backported from mainline
2019-10-22 Tamar Christina <tamar.christina@arm.com>

PR sanitizer/92154
* sanitizer_common/sanitizer_platform_limits_posix.cc:
Cherry-pick compiler-rt revision r375220.

From-SVN: r277981
---
libsanitizer/ChangeLog | 9 +++++++++
.../sanitizer_common/sanitizer_platform_limits_posix.cc | 6 +++++-
2 files changed, 14 insertions(+), 1 deletion(-)

--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1156,8 +1156,12 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if !defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)
+#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
+ !defined(__arm__)
/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
+/* On Arm glibc 2.31 and later provide a different mode field, this field is
+ never used by libsanitizer so we can simply ignore this assert for all glibc
+ versions. */
CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
#endif

--
2.25.0

76 changes: 76 additions & 0 deletions build/pkgs/gcc/patches/36_all_glibc-2.31-libsanitizer-2.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
https://bugs.gentoo.org/708346

From 75003cdd23c310ec385344e8040d490e8dd6d2be Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Fri, 20 Dec 2019 17:58:35 +0100
Subject: [PATCH] backport: re PR sanitizer/92154 (new glibc breaks arm
bootstrap due to libsanitizer)

Backported from mainline
2019-11-26 Jakub Jelinek <jakub@redhat.com>

PR sanitizer/92154
* sanitizer_common/sanitizer_platform_limits_posix.h: Cherry-pick
llvm-project revision 947f9692440836dcb8d88b74b69dd379d85974ce.
* sanitizer_common/sanitizer_platform_limits_posix.cc: Likewise.

From-SVN: r279653
---
libsanitizer/ChangeLog | 10 ++++++++++
.../sanitizer_platform_limits_posix.cc | 9 +++------
.../sanitizer_platform_limits_posix.h | 15 +--------------
3 files changed, 14 insertions(+), 20 deletions(-)

--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
@@ -1156,12 +1156,9 @@ CHECK_SIZE_AND_OFFSET(ipc_perm, uid);
CHECK_SIZE_AND_OFFSET(ipc_perm, gid);
CHECK_SIZE_AND_OFFSET(ipc_perm, cuid);
CHECK_SIZE_AND_OFFSET(ipc_perm, cgid);
-#if (!defined(__aarch64__) || !SANITIZER_LINUX || __GLIBC_PREREQ (2, 21)) && \
- !defined(__arm__)
-/* On aarch64 glibc 2.20 and earlier provided incorrect mode field. */
-/* On Arm glibc 2.31 and later provide a different mode field, this field is
- never used by libsanitizer so we can simply ignore this assert for all glibc
- versions. */
+#if !SANITIZER_LINUX || __GLIBC_PREREQ (2, 31)
+/* glibc 2.30 and earlier provided 16-bit mode field instead of 32-bit
+ on many architectures. */
CHECK_SIZE_AND_OFFSET(ipc_perm, mode);
#endif

diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index 73af92af1e8..6a673a7c995 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -211,26 +211,13 @@ namespace __sanitizer {
u64 __unused1;
u64 __unused2;
#elif defined(__sparc__)
-#if defined(__arch64__)
unsigned mode;
- unsigned short __pad1;
-#else
- unsigned short __pad1;
- unsigned short mode;
unsigned short __pad2;
-#endif
unsigned short __seq;
unsigned long long __unused1;
unsigned long long __unused2;
-#elif defined(__mips__) || defined(__aarch64__) || defined(__s390x__)
- unsigned int mode;
- unsigned short __seq;
- unsigned short __pad1;
- unsigned long __unused1;
- unsigned long __unused2;
#else
- unsigned short mode;
- unsigned short __pad1;
+ unsigned int mode;
unsigned short __seq;
unsigned short __pad2;
#if defined(__x86_64__) && !defined(_LP64)
--
2.25.0

7 changes: 7 additions & 0 deletions build/pkgs/gcc/spkg-configure.m4
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,13 @@ SAGE_SPKG_CONFIGURE_BASE([gcc], [
fi
# Figuring out if we are using clang instead of gcc.
AC_LANG_PUSH(C)
AX_COMPILER_VENDOR()
IS_REALLY_GCC=no
if test "x$ax_cv_c_compiler_vendor" = xgnu ; then
IS_REALLY_GCC=yes
fi
AC_LANG_POP()
# Save the value of CXX without special flags to enable C++11 support
AS_VAR_SET([SAGE_CXX_WITHOUT_STD], [$CXX])
Expand Down Expand Up @@ -144,6 +146,11 @@ SAGE_SPKG_CONFIGURE_BASE([gcc], [
[[[0-3]].*|4.[[0-7]].*], [
# Install our own GCC if the system-provided one is older than gcc-4.8.
SAGE_SHOULD_INSTALL_GCC([you have $CXX version $GXX_VERSION, which is quite old])
],
[1?.*], [
# Install our own GCC if the system-provided one is newer than 9.x.
# See https://trac.sagemath.org/ticket/29456
SAGE_SHOULD_INSTALL_GCC([$CXX is g++ version $GXX_VERSION, which is too recent for this version of Sage])
])
fi
Expand Down

0 comments on commit d15ac82

Please sign in to comment.