Skip to content

Upgrade to musl 1.1.24 in CI #1588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions ci/docker/mips-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,23 @@ FROM ubuntu:19.04

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
bzip2
xz-utils patch

RUN mkdir /toolchain

# Note that this originally came from:
# https://downloads.openwrt.org/snapshots/trunk/ar71xx/generic/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
RUN curl --retry 5 -L https://ci-mirrors.rust-lang.org/libc/OpenWrt-SDK-ar71xx-generic_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
tar xjf - -C /toolchain --strip-components=1
# Linux kernel version: 4.14.151
# See build_dir/target-mips_24kc_musl/linux-ar71xx_generic/linux-4.14.151
# Musl version: 1.1.24
# See staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/info.mk
RUN curl --retry 5 -L https://downloads.openwrt.org/releases/19.07.0-rc1/targets/ar71xx/generic/openwrt-sdk-19.07.0-rc1-ar71xx-generic_gcc-7.4.0_musl.Linux-x86_64.tar.xz | \
tar xJf - -C /toolchain --strip-components=1

ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15/bin \
CC_mips_unknown_linux_musl=mips-openwrt-linux-gcc \
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-gcc \
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_34kc_gcc-5.3.0_musl-1.1.15"
# See https://lkml.org/lkml/2014/3/14/269
COPY sysinfo_guard.patch /toolchain
RUN patch /toolchain/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/include/linux/kernel.h </toolchain/sysinfo_guard.patch

ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl/bin \
STAGING_DIR=/toolchain/staging_dir \
CC_mips_unknown_linux_musl=mips-openwrt-linux-musl-gcc \
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_LINKER=mips-openwrt-linux-musl-gcc \
CARGO_TARGET_MIPS_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mips -L /toolchain/staging_dir/toolchain-mips_24kc_gcc-7.4.0_musl"
27 changes: 17 additions & 10 deletions ci/docker/mipsel-unknown-linux-musl/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,24 @@
FROM ubuntu:19.04

RUN apt-get update && apt-get install -y --no-install-recommends \
gcc libc6-dev qemu-user ca-certificates qemu-system-mips curl \
bzip2
gcc libc6-dev qemu-user ca-certificates qemu-system-mipsel curl \
xz-utils patch

RUN mkdir /toolchain

# Note that this originally came from:
# https://downloads.openwrt.org/snapshots/trunk/malta/generic/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2
RUN curl --retry 5 -L https://ci-mirrors.rust-lang.org/libc/OpenWrt-Toolchain-malta-le_gcc-5.3.0_musl-1.1.15.Linux-x86_64.tar.bz2 | \
tar xjf - -C /toolchain --strip-components=2
# Linux kernel version: 4.14.151
# See build_dir/target-mipsel_mips32_musl/linux-brcm47xx_generic/linux-4.14.151
# Musl version: 1.1.24
# See staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl/info.mk
RUN curl --retry 5 -L https://downloads.openwrt.org/releases/19.07.0-rc1/targets/brcm47xx/generic/openwrt-sdk-19.07.0-rc1-brcm47xx-generic_gcc-7.4.0_musl.Linux-x86_64.tar.xz | \
tar xJf - -C /toolchain --strip-components=1

ENV PATH=$PATH:/rust/bin:/toolchain/bin \
CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain"
# See https://lkml.org/lkml/2014/3/14/269
COPY sysinfo_guard.patch /toolchain
RUN patch /toolchain/staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl/include/linux/kernel.h </toolchain/sysinfo_guard.patch

ENV PATH=$PATH:/rust/bin:/toolchain/staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl/bin \
STAGING_DIR=/toolchain/staging_dir \
CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-musl-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_LINKER=mipsel-openwrt-linux-musl-gcc \
CARGO_TARGET_MIPSEL_UNKNOWN_LINUX_MUSL_RUNNER="qemu-mipsel -L /toolchain/staging_dir/toolchain-mipsel_mips32_gcc-7.4.0_musl"
2 changes: 1 addition & 1 deletion ci/install-musl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set -ex

MUSL_VERSION=1.1.22
MUSL_VERSION=1.1.24
MUSL="musl-${MUSL_VERSION}"

# Download, configure, build, and install musl:
Expand Down
10 changes: 10 additions & 0 deletions ci/sysinfo_guard.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@@ -2,7 +2,9 @@
#ifndef _LINUX_KERNEL_H
#define _LINUX_KERNEL_H

+#ifdef __GLIBC__
#include <linux/sysinfo.h>
+#endif

/*
* 'kernel.h' contains some often-used function prototypes etc
29 changes: 15 additions & 14 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2061,14 +2061,14 @@ fn test_linux(target: &str) {
let i686 = target.contains("i686");
let mips = target.contains("mips");
let mips32 = mips && !target.contains("64");
let mips32_musl = mips32 && musl;
let mips64 = mips && target.contains("64");
let ppc64 = target.contains("powerpc64");
let s390x = target.contains("s390x");
let sparc64 = target.contains("sparc64");
let x32 = target.contains("x32");
let x86_32 = target.contains("i686");
let x86_64 = target.contains("x86_64");
let aarch64_musl = target.contains("aarch64") && musl;

let mut cfg = ctest_cfg();
cfg.define("_GNU_SOURCE", None);
Expand Down Expand Up @@ -2132,8 +2132,7 @@ fn test_linux(target: &str) {
"sys/prctl.h",
"sys/ptrace.h",
"sys/quota.h",
// FIXME: the mips-musl CI build jobs use ancient musl 1.0.15:
[!mips32_musl]: "sys/random.h",
"sys/random.h",
"sys/reboot.h",
"sys/resource.h",
"sys/sem.h",
Expand Down Expand Up @@ -2187,8 +2186,7 @@ fn test_linux(target: &str) {
"linux/fs.h",
"linux/futex.h",
"linux/genetlink.h",
// FIXME: musl version 1.0.15 used by mips build jobs is ancient
[!mips32_musl]: "linux/if.h",
"linux/if.h",
"linux/if_addr.h",
"linux/if_alg.h",
"linux/if_ether.h",
Expand Down Expand Up @@ -2303,9 +2301,6 @@ fn test_linux(target: &str) {
// structs.
"termios2" => true,

// FIXME: musl version using by mips build jobs 1.0.15 is ancient:
"ifmap" | "ifreq" | "ifconf" if mips32_musl => true,

// FIXME: remove once Ubuntu 20.04 LTS is released, somewhere in 2020.
// ucontext_t added a new field as of glibc 2.28; our struct definition is
// conservative and omits the field, but that means the size doesn't match for newer
Expand Down Expand Up @@ -2349,7 +2344,7 @@ fn test_linux(target: &str) {
// Require Linux kernel 5.1:
"F_SEAL_FUTURE_WRITE" => true,

// The musl version 1.0.22 used in CI does not
// The musl version 1.1.24 used in CI does not
// contain these glibc constants yet:
| "RLIMIT_RTTIME" // should be in `resource.h`
| "TCP_COOKIE_TRANSACTIONS" // should be in the `netinet/tcp.h` header
Expand All @@ -2371,10 +2366,6 @@ fn test_linux(target: &str) {
// - these constants are used by the glibc implementation.
n if musl && n.contains("__SIZEOF_PTHREAD") => true,

// FIXME: musl version 1.0.15 used by mips build jobs is ancient
t if mips32_musl && t.starts_with("IFF") => true,
"MFD_HUGETLB" | "AF_XDP" | "PF_XDP" if mips32_musl => true,

_ => false,
}
});
Expand Down Expand Up @@ -2458,7 +2449,17 @@ fn test_linux(target: &str) {
field == "_pad2" ||
field == "ssi_syscall" ||
field == "ssi_call_addr" ||
field == "ssi_arch"))
field == "ssi_arch")) ||
// FIXME: After musl 1.1.24, it have only one field `sched_priority`,
// while other fields become reserved.
Copy link
Contributor

@gnzlbg gnzlbg Nov 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate here in a comment on what this means? Did the fields of this struct change? Some fields became "private" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I placed the diff of musl in the initial comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, there are functions for mapping Rust field names to C field names in ctest, e.g., https://docs.rs/ctest/0.2.22/ctest/struct.TestGenerator.html#method.field_name . So maybe we can just translate the Rust names to the new __reservedX names for now ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnzlbg

So maybe we can just translate the Rust names to the new __reservedX names for now ?

This does not work for struct { time_t __reserved1; long __reserved2; } __reserved2[2];.
The anonymous struct does not match struct timespec. Build log

We still need to skip these fields at least.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right.

(struct_ == "sched_param" && [
"sched_ss_low_priority",
"sched_ss_repl_period",
"sched_ss_init_budget",
"sched_ss_max_repl",
].contains(&field) && musl) ||
// FIXME: After musl 1.1.24, the type becomes `int` instead of `unsigned short`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means that musl 1.1 has ABI breaking changes with respect to musl 1.0.x ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gnzlbg Oh, sorry. It may not be an ABI breaking change. The struct layout is kept and just some fields are renamed to reserved.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that refer to the change in type of ipc_perm.__seq field from unsigned short to int on aarch64 ? Do you have a musl diff for this change?

Copy link
Contributor

@mati865 mati865 Nov 20, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC it was unsupported bminor/musl@827aa8f
But still it's breaking change between 1.1.23 and 1.1.24
Edit: replied to wrong comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Relevant commit for this change bminor/musl@319b2d0

(struct_ == "ipc_perm" && field == "__seq" && aarch64_musl)
});

cfg.skip_roundtrip(move |s| match s {
Expand Down