containers / libkrun

A dynamic library providing Virtualization-based process isolation capabilities
Apache License 2.0
809 stars 67 forks source link

build failure on aarch64 #105

Closed fcrozat closed 1 year ago

fcrozat commented 1 year ago

Since version 1.4.7 (still present in 1.4.9), libkrun doesn't build anymore on aarch64 on openSUSE Tumbleweed:

[   84s]    Compiling serde v1.0.149
[   84s]    Compiling arch_gen v0.1.0 (/home/abuild/rpmbuild/BUILD/libkrun-1.4.8/src/arch_gen)
[   84s]    Compiling arch v0.1.0 (/home/abuild/rpmbuild/BUILD/libkrun-1.4.8/src/arch)
[   84s] error[E0308]: mismatched types
[   84s]     --> src/arch/src/aarch64/linux/regs.rs:128:47
[   84s]      |
[   84s] 128  |     vcpu.set_one_reg(arm64_core_reg!(pstate), PSTATE_FAULT_BITS_64)
[   84s]      |          -----------                          ^^^^^^^^^^^^^^^^^^^^ expected `u128`, found `u64`
[   84s]      |          |
[   84s]      |          arguments to this function are incorrect
[   84s]      |
[   84s] note: associated function defined here
[   84s]     --> /home/abuild/rpmbuild/BUILD/libkrun-1.4.8/vendor/kvm-ioctls/src/ioctls/vcpu.rs:1199:12
[   84s]      |
[   84s] 1199 |     pub fn set_one_reg(&self, reg_id: u64, data: u128) -> Result<()> {
[   84s]      |            ^^^^^^^^^^^
[   84s] help: you can convert a `u64` to a `u128`
[   84s]      |
[   84s] 128  |     vcpu.set_one_reg(arm64_core_reg!(pstate), PSTATE_FAULT_BITS_64.into())
[   84s]      |                                                                   +++++++
[   84s] 
[   84s] error[E0308]: mismatched types
[   84s]     --> src/arch/src/aarch64/linux/regs.rs:135:47
[   84s]      |
[   84s] 135  |         vcpu.set_one_reg(arm64_core_reg!(pc), boot_ip)
[   84s]      |              -----------                      ^^^^^^^ expected `u128`, found `u64`
[   84s]      |              |
[   84s]      |              arguments to this function are incorrect
[   84s]      |
[   84s] note: associated function defined here
[   84s]     --> /home/abuild/rpmbuild/BUILD/libkrun-1.4.8/vendor/kvm-ioctls/src/ioctls/vcpu.rs:1199:12
[   84s]      |
[   84s] 1199 |     pub fn set_one_reg(&self, reg_id: u64, data: u128) -> Result<()> {
[   84s]      |            ^^^^^^^^^^^
[   84s] help: you can convert a `u64` to a `u128`
[   84s]      |
[   84s] 135  |         vcpu.set_one_reg(arm64_core_reg!(pc), boot_ip.into())
[   84s]      |                                                      +++++++
[   84s] 
[   84s] error[E0308]: mismatched types
[   84s]     --> src/arch/src/aarch64/linux/regs.rs:143:49
[   84s]      |
[   84s] 143  |         vcpu.set_one_reg(arm64_core_reg!(regs), get_fdt_addr(mem) as u64)
[   84s]      |              -----------                        ^^^^^^^^^^^^^^^^^^^^^^^^ expected `u128`, found `u64`
[   84s]      |              |
[   84s]      |              arguments to this function are incorrect
[   84s]      |
[   84s] note: associated function defined here
[   84s]     --> /home/abuild/rpmbuild/BUILD/libkrun-1.4.8/vendor/kvm-ioctls/src/ioctls/vcpu.rs:1199:12
[   84s]      |
[   84s] 1199 |     pub fn set_one_reg(&self, reg_id: u64, data: u128) -> Result<()> {
[   84s]      |            ^^^^^^^^^^^
[   84s] help: you can convert a `u64` to a `u128`
[   84s]      |
[   84s] 143  |         vcpu.set_one_reg(arm64_core_reg!(regs), (get_fdt_addr(mem) as u64).into())
[   84s]      |                                                 +                        ++++++++
[   84s] 
[   84s] error[E0308]: mismatched types
[   84s]    --> src/arch/src/aarch64/linux/regs.rs:155:5
[   84s]     |
[   84s] 154 | pub fn read_mpidr(vcpu: &VcpuFd) -> Result<u64> {
[   84s]     |                                     ----------- expected `std::result::Result<u64, regs::Error>` because of return type
[   84s] 155 |     vcpu.get_one_reg(MPIDR_EL1).map_err(Error::GetSysRegister)
[   84s]     |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `u128`
[   84s]     |
[   84s]     = note: expected enum `std::result::Result<u64, _>`
[   84s]                found enum `std::result::Result<u128, _>`
[   84s] 
[   84s] For more information about this error, try `rustc --explain E0308`.
slp commented 1 year ago

I guess the rpmbuild process is removing Cargo.lock and building grabbing the latest packages, including kvm-ioctls 0.12.0 which seems to have introduced breaking changes into its API (this is why I hate zero versions). We'll need to update libkrun to support the latest kvm-ioctls.

fcrozat commented 1 year ago

OBS link for the build: https://build.opensuse.org/package/show/home:fcrozat:branches:Virtualization/libkrun

fcrozat commented 1 year ago

(there is no network access during build, all dependencies are vendored at commit time in OBS)

slp commented 1 year ago

This should have been fixed in v1.4.10. Please reopen if that's not the case.