Skip to content

Commit

Permalink
unix: switch to Ubuntu 24.10 in Dockerfile
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Meidan Li <[email protected]>
Reviewed-by: Dmitri Shuralyov <[email protected]>
LUCI-TryBot-Result: Go LUCI <[email protected]>
Reviewed-by: Tobias Klauser <[email protected]>
Reviewed-by: Ian Lance Taylor <[email protected]>
  • Loading branch information
abner-chenc authored and gopherbot committed Oct 14, 2024
1 parent 2dfefb6 commit 3932916
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
18 changes: 2 additions & 16 deletions unix/linux/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:20.04
FROM ubuntu:24.10

# Disable interactive prompts on package installation
ENV DEBIAN_FRONTEND noninteractive
Expand Down Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions unix/linux/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
10 changes: 10 additions & 0 deletions unix/mkerrors.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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__)
Expand Down

0 comments on commit 3932916

Please sign in to comment.