Failed to cross-compile Mesa-24.2 & Rusticl with bindgen 0.65.1 and rustc 1.80.0
System information
- OS: Ubuntu 22.04.4 LTS(build machine)
- Kernel: Linux Vilrigin 6.8.0-40-generic #40 (moved)~22.04.3-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 30 17:30:19 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
- Mesa version: 24.2
Environment information
- Host machine OS: Debian Bookworm
- llvm & clang version: 15.0
- bindgen version: 0.65.1
- rustc version: rustc 1.80.0 (051478957 2024-07-21)
- meson version: 1.5.1
- ninja version: 1.10.1
Description
I'm cross-compiling the Mesa-24.2 as well as Rusticl onto an aarch64 platform with meson and ninja. The cross compiling configure file for meson is as followed, which is named as cross_file.txt
.
[host_machine]
system = 'linux'
cpu_family = 'aarch64'
cpu = 'ARMv8'
endian = 'little'
[properties]
skip_sanity_check = true
sys_root = '/sysroot'
platform = 'generic'
[binaries]
c = 'aarch64-linux-gnu-gcc'
cpp = 'aarch64-linux-gnu-g++'
ar = 'aarch64-linux-gnu-ar'
ld = 'aarch64-linux-gnu-ld'
objcopy = 'aarch64-linux-gnu-objcopy'
strip = 'aarch64-linux-gnu-strip'
cmake = 'cmake'
rust = ['rustc', '--target=aarch64-unknown-linux-gnu', '-C', 'linker=aarch64-linux-gnu-gcc']
llvm-config = 'llvm-config-15'
I used the following command to configure the project:
meson setup \
-Db_ndebug=true \
-Dopengl=false \
-Dshared-glapi=disabled \
-Dgles1=disabled \
-Dgles2=disabled \
-Degl=disabled \
-Dplatforms= \
-Dvulkan-drivers=panfrost \
-Dgallium-drivers=panfrost \
-Dgallium-opencl=icd \
-Dgallium-rusticl=true \
--cross-file cross_file.txt \
--prefix=/usr \
builddir/
The output of this command can be accessed here.
There are some confusing warnings in the output.
Program bindgen found: YES (/home/bg6vml/.cargo/bin/bindgen)
Program bindgen found: YES (/home/bg6vml/.cargo/bin/bindgen)
../src/gallium/frontends/rusticl/meson.build:177: WARNING: Project targets '>= 1.1.0' but uses feature introduced in '1.3.0': rust_abi arg in static_library.
../src/gallium/frontends/rusticl/meson.build:212: WARNING: Project targets '>= 1.1.0' but uses feature introduced in '1.3.0': rust_abi arg in static_library.
../src/gallium/frontends/rusticl/meson.build:245: WARNING: Project targets '>= 1.1.0' but uses feature introduced in '1.4.0': output_inline_wrapper arg in rust.bindgen.
../src/gallium/frontends/rusticl/meson.build:340: WARNING: Project targets '>= 1.1.0' but uses feature introduced in '1.3.0': fs.relative_to.
Compiler for C supports arguments -Wno-missing-prototypes: YES (cached)
../src/gallium/frontends/rusticl/meson.build:364: WARNING: Project targets '>= 1.1.0' but uses feature introduced in '1.3.0': rust_abi arg in static_library.
../src/gallium/frontends/rusticl/meson.build:380: WARNING: Project targets '>= 1.1.0' but uses feature introduced in '1.3.0': rust_abi arg in static_library.
../src/gallium/frontends/rusticl/meson.build:390: WARNING: Project targets '>= 1.1.0' but uses feature introduced in '1.3.0': rust_abi arg in static_library.
../src/gallium/frontends/rusticl/meson.build:400: WARNING: Project targets '>= 1.1.0' but uses feature introduced in '1.3.0': rust_abi arg in static_library.
../src/gallium/frontends/rusticl/meson.build:416: WARNING: Project targets '>= 1.1.0' but uses feature introduced in '1.3.0': rust.proc_macro.
../src/gallium/frontends/rusticl/meson.build:424: WARNING: Project targets '>= 1.1.0' but uses feature introduced in '1.3.0': rust_abi arg in static_library.
Then I used the following command to build.
DESTDIR=/sysroot ninja -C builddir install
However, the ninja failed to build the project and show 14 same ERRORs. One of them is as followed.
FAILED: src/gallium/frontends/rusticl/librusticl_opencl_gen.rlib
rustc --target=aarch64-unknown-linux-gnu -C linker=aarch64-linux-gnu-gcc -C linker=aarch64-linux-gnu-gcc --color=always -C debug-assertions=no -C overflow-checks=no --crate-type rlib --edition=2021 -C opt-level=2 -g --crate-name rusticl_opencl_gen --emit dep-info=src/gallium/frontends/rusticl/rusticl_opencl_gen.d --emit link=src/gallium/frontends/rusticl/librusticl_opencl_gen.rlib --out-dir src/gallium/frontends/rusticl/librusticl_opencl_gen.rlib.p -C metadata=b863b06@@rusticl_opencl_gen@sta -Aclippy::all -Aimproper_ctypes -Aunused_unsafe -Anon_camel_case_types -Anon_snake_case -Anon_upper_case_globals src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs
error[E0080]: evaluation of constant value failed
--> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:7018:31
|
7018 | ["Alignment of cl_char8"][::std::mem::align_of::<cl_char8>() - 8usize];
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow
The full building log can be accessed here.
I have no idea about how to deal with it. I've tried with bindgen 0.65.1, 0.69.3 and 0.70.0 but have no progress.
Regression
Once I was confronted with the same problem when I was cross-compiling the Mesa-24.0 as well as Rusticl with bindgen 0.65.1. But I successfully solved the problem by downgrading the bindgen from 0.65.1 to 0.62.0. This trick seems not to be effective because the Rusticl needs bindgen that is higher than 0.65.0.