Skip to content

Commit 4e03a79

Browse files
Emanuel Limastevenhorsman
authored andcommitted
build: Fix compilation failure with Rust v1.80
Starting with version 1.80, the Rust linter does not accept an invalid value for `target_arch` in configuration checks: ``` Compiling kata-sys-util v0.1.0 (/home/ddd/Work/kata/kata-containers/src/libs/kata-sys-util) error: unexpected `cfg` condition value: `powerpc64le` --> /home/ddd/Work/kata/kata-containers/src/libs/kata-sys-util/src/protection.rs:17:34 | 17 | #[cfg(any(target_arch = "s390x", target_arch = "powerpc64le"))] | ^^^^^^^^^^^^^^------------- | | | help: there is a expected value with a similar name: `"powerpc64"` | = note: expected values for `target_arch` are: `aarch64`, `arm`, `arm64ec`, `avr`, `bpf`, `csky`, `hexagon`, `loongarch64`, `m68k`, `mips`, `mips32r6`, `mips64`, `mips64r6`, `msp430`, `nvptx64`, `powerpc`, `powerpc64`, `riscv32`, `riscv64`, `s390x`, `sparc`, `sparc64`, `wasm32`, `wasm64`, `x86`, and `x86_64` = note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg/cargo-specifics.html> for more information about checking conditional configuration = note: `-D unexpected-cfgs` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(unexpected_cfgs)]` ``` According [to GitHub user @Urgau][explain], this is a new warning introduced in Rust 1.80, but the problem exists before. The correct architecture name should be `powerpc64`, and the differentiation between `powerpc64le` and `powerpc64` should use the `target_endian = "little"` check. [explain]: kata-containers#10072 (comment) Fixes: kata-containers#10067 Signed-off-by: Christophe de Dinechin <[email protected]> [emlima: fix some more occurences and typos] Signed-off-by: Emanuel Lima <[email protected]>
1 parent b4e99b9 commit 4e03a79

File tree

26 files changed

+42
-43
lines changed

26 files changed

+42
-43
lines changed

docs/Developer-Guide.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ The agent is built with a statically linked `musl.` The default `libc` used is `
239239
```bash
240240
$ export ARCH="$(uname -m)"
241241
$ if [ "$ARCH" = "ppc64le" -o "$ARCH" = "s390x" ]; then export LIBC=gnu; else export LIBC=musl; fi
242-
$ [ "${ARCH}" == "ppc64le" ] && export ARCH=powerpc64le
242+
$ [ "${ARCH}" == "ppc64le" ] && export ARCH=powerpc64
243243
$ rustup target add "${ARCH}-unknown-linux-${LIBC}"
244244
```
245245

@@ -415,11 +415,11 @@ $ script -fec 'sudo -E AGENT_INIT=yes USE_DOCKER=true SECCOMP=no ./rootfs.sh "${
415415
> - Check the [compatibility matrix](../tools/osbuilder/README.md#platform-distro-compatibility-matrix) before creating rootfs.
416416
417417
Optionally, add your custom agent binary to the rootfs with the following commands. The default `$LIBC` used
418-
is `musl`, but on ppc64le and s390x, `gnu` should be used. Also, Rust refers to ppc64le as `powerpc64le`:
418+
is `musl`, but on ppc64le and s390x, `gnu` should be used. Also, Rust refers to ppc64le as `powerpc64`:
419419
```bash
420420
$ export ARCH="$(uname -m)"
421421
$ [ "${ARCH}" == "ppc64le" ] || [ "${ARCH}" == "s390x" ] && export LIBC=gnu || export LIBC=musl
422-
$ [ "${ARCH}" == "ppc64le" ] && export ARCH=powerpc64le
422+
$ [ "${ARCH}" == "ppc64le" ] && export ARCH=powerpc64
423423
$ sudo install -o root -g root -m 0550 -T "${ROOTFS_DIR}/../../../../src/agent/target/${ARCH}-unknown-linux-${LIBC}/release/kata-agent" "${ROOTFS_DIR}/sbin/init"
424424
```
425425

src/agent/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ endif
5454
include ../../utils.mk
5555

5656
ifeq ($(ARCH), ppc64le)
57-
override ARCH = powerpc64le
57+
override ARCH = powerpc64
5858
endif
5959

6060
##VAR STANDARD_OCI_RUNTIME=yes|no define if agent enables standard oci runtime feature

src/libs/kata-sys-util/src/protection.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::path::Path;
1414
use std::path::PathBuf;
1515
use thiserror::Error;
1616

17-
#[cfg(any(target_arch = "s390x", target_arch = "powerpc64le"))]
17+
#[cfg(any(target_arch = "s390x", target_arch = "powerpc64"))]
1818
use nix::unistd::Uid;
1919

2020
#[cfg(target_arch = "x86_64")]
@@ -234,7 +234,7 @@ pub fn available_guest_protection() -> Result<GuestProtection, ProtectionError>
234234
Ok(GuestProtection::Se)
235235
}
236236

237-
#[cfg(target_arch = "powerpc64le")]
237+
#[cfg(all(target_arch = "powerpc64"))]
238238
pub fn available_guest_protection() -> Result<check::GuestProtection, check::ProtectionError> {
239239
if !Uid::effective().is_root() {
240240
return Err(check::ProtectionError::NoPerms);

src/runtime-rs/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ CONTAINERD_RUNTIME_NAME = io.containerd.kata.v2
1818
include ../../utils.mk
1919

2020
ifeq ($(ARCH), ppc64le)
21-
override ARCH = powerpc64le
21+
override ARCH = powerpc64
2222
endif
2323

2424
ARCH_DIR = arch
@@ -31,7 +31,7 @@ test:
3131
@echo "s390x is not currently supported"
3232
exit 0
3333
install: install-runtime install-configs
34-
else ifeq ($(ARCH), powerpc64le)
34+
else ifeq ($(ARCH), powerpc64)
3535
default:
3636
@echo "PowerPC 64 LE is not currently supported"
3737
exit 0

src/tools/agent-ctl/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
include ../../../utils.mk
77

88
ifeq ($(ARCH), ppc64le)
9-
override ARCH = powerpc64le
9+
override ARCH = powerpc64
1010
endif
1111

1212
.DEFAULT_GOAL := default

src/tools/genpolicy/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
include ../../../utils.mk
88

99
ifeq ($(ARCH), ppc64le)
10-
override ARCH = powerpc64le
10+
override ARCH = powerpc64
1111
endif
1212

1313
COMMIT_HASH := $(shell git rev-parse HEAD 2>/dev/null || true)

src/tools/kata-ctl/Cross.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ pre-build = ["dpkg --add-architecture arm64 && apt-get update && apt-get install
88
pre-build = ["dpkg --add-architecture amd64 && apt-get update && apt-get install -y libssl-dev:amd64"]
99

1010
# Powerpc compile seems to be broken, due to `ring` crate not being supported on powerpc.
11-
[target.powerpc64le-unknown-linux-gnu]
11+
[target.powerpc64-unknown-linux-gnu]
1212
pre-build = ["dpkg --add-architecture ppc64le && apt-get update && apt-get install -y libssl-dev:ppc64le"]

src/tools/kata-ctl/src/arch/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ pub mod aarch64;
88
#[cfg(target_arch = "aarch64")]
99
pub use aarch64 as arch_specific;
1010

11-
#[cfg(target_arch = "powerpc64le")]
12-
pub mod powerpc64le;
13-
#[cfg(target_arch = "powerpc64le")]
14-
pub use powerpc64le as arch_specific;
11+
#[cfg(all(target_arch = "powerpc64"))]
12+
pub mod powerpc64;
13+
#[cfg(all(target_arch = "powerpc64"))]
14+
pub use powerpc64 as arch_specific;
1515

1616
#[cfg(target_arch = "s390x")]
1717
pub mod s390x;
@@ -25,7 +25,7 @@ pub use x86_64 as arch_specific;
2525

2626
#[cfg(not(any(
2727
target_arch = "aarch64",
28-
target_arch = "powerpc64le",
28+
target_arch = "powerpc64",
2929
target_arch = "s390x",
3030
target_arch = "x86_64"
3131
)))]

src/tools/kata-ctl/src/arch/powerpc64le/mod.rs renamed to src/tools/kata-ctl/src/arch/powerpc64/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
//
55

66
use crate::types::*;
7-
#[cfg(target_arch = "powerpc64le")]
7+
#[cfg(all(target_arch = "powerpc64"))]
88
pub use arch_specific::*;
99

1010
mod arch_specific {
@@ -16,7 +16,7 @@ mod arch_specific {
1616
pub const ARCH_CPU_MODEL_FIELD: &str = "model";
1717

1818
pub fn check() -> Result<()> {
19-
unimplemented!("Check not implemented in powerpc64le");
19+
unimplemented!("Check not implemented in powerpc64");
2020
}
2121

2222
pub fn get_checks() -> Option<&'static [CheckItem<'static>]> {

src/tools/runk/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ LIBC ?= gnu
99
include ../../../utils.mk
1010

1111
ifeq ($(ARCH), ppc64le)
12-
override ARCH = powerpc64le
12+
override ARCH = powerpc64
1313
endif
1414

1515
TARGET = runk

0 commit comments

Comments
 (0)