1
0
mirror of https://github.com/kata-containers/kata-containers.git synced 2025-05-09 08:57:25 +00:00

build: Fix powerpc64le target_arch

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]:  (comment)

Fixes: 

Signed-off-by: Christophe de Dinechin <dinechin@redhat.com>
[emlima: fix some more occurences and typos]
Signed-off-by: Emanuel Lima <emlima@redhat.com>
[stevenhorsman: fix some more occurences and typos]
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
This commit is contained in:
stevenhorsman 2025-02-05 13:38:16 +00:00
parent 429b2654f4
commit 4c006c707a
6 changed files with 10 additions and 10 deletions
src
dragonball
libs/kata-sys-util/src
tools/kata-ctl/src/arch
mod.rs
powerpc64
tools/packaging/static-build/qemu
utils.mk

View File

@ -6,7 +6,7 @@ include ../../utils.mk
PROJECT_DIRS := $(shell find . -name Cargo.toml -printf '%h\n' | sort -u)
ifeq ($(ARCH), $(filter $(ARCH), s390x ppc64le))
ifeq ($(ARCH), $(filter $(ARCH), s390x powerpc64le))
default build check test clippy vendor:
@echo "$(ARCH) is not support currently"
exit 0
@ -34,7 +34,7 @@ vendor:
format:
@echo "INFO: rust fmt..."
# This is kinda dirty step here simply because cargo fmt --all will apply fmt to all dependencies of dragonball which will include /src/libs/protocols with some file generated during compilation time and could not be formatted when you use cargo fmt --all before building the whole project. In order to avoid this problem, we do fmt check in this following way.
# This is kinda dirty step here simply because cargo fmt --all will apply fmt to all dependencies of dragonball which will include /src/libs/protocols with some file generated during compilation time and could not be formatted when you use cargo fmt --all before building the whole project. In order to avoid this problem, we do fmt check in this following way.
rustfmt --edition 2018 ./src/dbs_address_space/src/lib.rs ./src/dbs_allocator/src/lib.rs ./src/dbs_arch/src/lib.rs ./src/dbs_boot/src/lib.rs ./src/dbs_device/src/lib.rs ./src/dbs_interrupt/src/lib.rs ./src/dbs_legacy_devices/src/lib.rs ./src/dbs_pci/src/lib.rs ./src/dbs_upcall/src/lib.rs ./src/dbs_utils/src/lib.rs ./src/dbs_virtio_devices/src/lib.rs ./src/lib.rs --check
clean:

View File

@ -14,7 +14,7 @@ use std::path::Path;
use std::path::PathBuf;
use thiserror::Error;
#[cfg(any(target_arch = "s390x", target_arch = "powerpc64le"))]
#[cfg(any(target_arch = "s390x", target_arch = "powerpc64"))]
use nix::unistd::Uid;
#[cfg(target_arch = "x86_64")]

View File

@ -8,10 +8,10 @@ pub mod aarch64;
#[cfg(target_arch = "aarch64")]
pub use aarch64 as arch_specific;
#[cfg(target_arch = "powerpc64le")]
pub mod powerpc64le;
#[cfg(target_arch = "powerpc64le")]
pub use powerpc64le as arch_specific;
#[cfg(target_arch = "powerpc64")]
pub mod powerpc64;
#[cfg(target_arch = "powerpc64")]
pub use powerpc64 as arch_specific;
#[cfg(target_arch = "s390x")]
pub mod s390x;
@ -25,7 +25,7 @@ pub use x86_64 as arch_specific;
#[cfg(not(any(
target_arch = "aarch64",
target_arch = "powerpc64le",
target_arch = "powerpc64",
target_arch = "s390x",
target_arch = "x86_64"
)))]

View File

@ -4,7 +4,7 @@
//
use crate::types::*;
#[cfg(target_arch = "powerpc64le")]
#[cfg(target_arch = "powerpc64")]
pub use arch_specific::*;
mod arch_specific {

View File

@ -70,4 +70,3 @@ RUN apt-get update && apt-get upgrade -y && \
GCC_ARCH="${ARCH}" && if [ "${ARCH}" = "ppc64le" ]; then GCC_ARCH="powerpc64le"; fi && \
if [ "${ARCH}" != "$(uname -m)" ]; then apt-get install --no-install-recommends -y gcc-"${GCC_ARCH}"-linux-gnu; fi && \
apt-get clean && rm -rf /var/lib/apt/lists/

View File

@ -147,6 +147,7 @@ endif
ifeq ($(ARCH), ppc64le)
override LIBC = gnu
override ARCH = powerpc64le
$(warning "WARNING: powerpc64le-unknown-linux-musl target is unavailable")
endif