unix: switch to Ubuntu 24.10 in Dockerfile

ubuntu 24.04 introduced support for qemu-loongarch64, and ubuntu 24.10
introduced support for the cross-compiler gcc-loongarch64-linux-gnu, so
we can temporarily switch to ubuntu 24.10 to discard the extra links
introduced by loong64 and switch to it when the next ubuntu LTS version
is released.

Change-Id: I96de123df0cf50d6ba0331eeb02fc1e8c48ce304
Reviewed-on: https://go-review.googlesource.com/c/sys/+/618075
Auto-Submit: Ian Lance Taylor <iant@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Tobias Klauser <tobias.klauser@gmail.com>
Reviewed-by: Ian Lance Taylor <iant@google.com>
This commit is contained in:
Guoqi Chen
2024-10-05 10:33:39 +08:00
committed by Gopher Robot
parent 2dfefb6832
commit 3932916d5c
3 changed files with 27 additions and 16 deletions

View File

@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:24.10
# Disable interactive prompts on package installation
ENV DEBIAN_FRONTEND noninteractive
@@ -48,24 +48,10 @@ RUN apt-get update && apt-get install -y \
gcc-powerpc-linux-gnu gcc-powerpc64-linux-gnu \
gcc-powerpc64le-linux-gnu gcc-riscv64-linux-gnu \
gcc-s390x-linux-gnu gcc-sparc64-linux-gnu \
gcc-loongarch64-linux-gnu \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Only for loong64, getting tools of qemu-user and gcc-cross-compiler
ENV LOONG64_BASE_URL https://github.com/loongson/build-tools/releases/download/2023.08.08
ENV LOONG64_GCC CLFS-loongarch64-8.1-x86_64-cross-tools-gcc-glibc.tar.xz
ENV LOONG64_QEMU qemu-loongarch64
ENV LOONG64_GCC_DOWNLOAD_URL $LOONG64_BASE_URL/$LOONG64_GCC
ENV LOONG64_QEMU_DOWNLOAD_URL $LOONG64_BASE_URL/$LOONG64_QEMU
RUN apt-get update && apt-get install xz-utils -y && mkdir /loong64 && cd /loong64 \
&& curl -fsSL "$LOONG64_QEMU_DOWNLOAD_URL" -o /usr/bin/"$LOONG64_QEMU" \
&& chmod +x /usr/bin/"$LOONG64_QEMU" \
&& curl -fsSL "$LOONG64_GCC_DOWNLOAD_URL" -o "$LOONG64_GCC" \
&& tar xf "$LOONG64_GCC" -C /usr/local/ \
&& ln -s /usr/local/cross-tools/bin/loongarch64-unknown-linux-gnu-gcc /usr/bin/loongarch64-linux-gnu-gcc \
&& rm -rf /loong64
# Let the scripts know they are in the docker environment
ENV GOLANG_SYS_BUILD docker
WORKDIR /build/unix

View File

@@ -20,6 +20,21 @@ package unix
#define _FILE_OFFSET_BITS 64
#define _GNU_SOURCE
// Ref: include/linux/time32.h
//
// On Linux, in order to solve the overflow problem of time_t type variables on
// 32-bit arm, mips, and powerpc in 2038, the definition of time_t is switched
// from a 32-bit field to a 64-bit field. For backward compatibility, we force
// the use of 32-bit fields.
#if defined(__ARM_EABI__) || \
(defined(__mips__) && (_MIPS_SIM == _ABIO32)) || \
(defined(__powerpc__) && (!defined(__powerpc64__)))
# ifdef _TIME_BITS
# undef _TIME_BITS
# endif
# define _TIME_BITS 32
#endif
#include <dirent.h>
#include <fcntl.h>
#include <poll.h>

View File

@@ -158,6 +158,16 @@ includes_Linux='
#endif
#define _GNU_SOURCE
// See the description in unix/linux/types.go
#if defined(__ARM_EABI__) || \
(defined(__mips__) && (_MIPS_SIM == _ABIO32)) || \
(defined(__powerpc__) && (!defined(__powerpc64__)))
# ifdef _TIME_BITS
# undef _TIME_BITS
# endif
# define _TIME_BITS 32
#endif
// <sys/ioctl.h> is broken on powerpc64, as it fails to include definitions of
// these structures. We just include them copied from <bits/termios.h>.
#if defined(__powerpc__)