Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 939803 - =media-libs/mesa-24.2.2 build fails with bindgen-0.70.1: attempt to compute `4_usize - 8_usize`, which would overflow
Summary: =media-libs/mesa-24.2.2 build fails with bindgen-0.70.1: attempt to compute `...
Status: IN_PROGRESS
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords: PATCH
: 939668 939824 942043 (view as bug list)
Depends on: 943148
Blocks:
  Show dependency tree
 
Reported: 2024-09-18 05:44 UTC by tdr
Modified: 2024-12-02 11:40 UTC (History)
22 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge --info (emerge--info.txt,6.23 KB, text/plain)
2024-09-18 05:45 UTC, tdr
Details
mesa-24.2.2-build-fail.log (mesa-24.2.2-build-fail.log.gz,137.18 KB, text/plain)
2024-09-18 05:47 UTC, tdr
Details
build fail with rust downgrade to rust-1.80.1 (mesa-24.2.2-with-rust-1.80.1-build-fail.log.gz,137.51 KB, text/plain)
2024-09-19 06:40 UTC, tdr
Details
Commit from mesa-24.2.0, prerequisite for patching mesa-24.1.7 (mesa-24.1.7-bindgen-cl-vector-fix-prerequisite.patch,7.45 KB, patch)
2024-11-10 08:46 UTC, Anon Emuss
Details | Diff
Commit from mesa-24.2.3, appears to fix the problem (mesa-24.1.7-bindgen-cl-vector-fix.patch,2.35 KB, patch)
2024-11-10 08:49 UTC, Anon Emuss
Details | Diff
Sample ebuild applying the above patches (mesa-24.1.7.ebuild,13.75 KB, text/plain)
2024-11-10 08:51 UTC, Anon Emuss
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tdr 2024-09-18 05:44:51 UTC
=media-libs:mesa-24.2.2 build fails to build after upgrade to rust-1.81.0

Reproducible: Always

Steps to Reproduce:
install/update to rust-1.81.0
emerge =mesa-mesa-24.2.2
Actual Results:  
FAILED: src/gallium/frontends/rusticl/librusticl_opencl_gen.rlib
rustc -C linker=x86_64-pc-linux-gnu-gcc --color=always -C debug-assertions=no -C overflow-checks=no --crate-type rlib --edition=2021 --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:7030:31
     |
7030 |     ["Alignment of cl_char8"][::std::mem::align_of::<cl_char8>() - 8usize];
     |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
    --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:7180:10
     |
7180 |         [::std::mem::align_of::<cl_char16__bindgen_ty_3>() - 8usize];
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
    --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:7471:32
     |
7471 |     ["Alignment of cl_uchar8"][::std::mem::align_of::<cl_uchar8>() - 8usize];
     |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
    --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:7624:10
     |
7624 |         [::std::mem::align_of::<cl_uchar16__bindgen_ty_3>() - 8usize];
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
    --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:7809:32
     |
7809 |     ["Alignment of cl_short4"][::std::mem::align_of::<cl_short4>() - 8usize];
     |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
    --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:7900:10
     |
7900 |         [::std::mem::align_of::<cl_short8__bindgen_ty_3>() - 8usize];
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
    --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:8264:33
     |
8264 |     ["Alignment of cl_ushort4"][::std::mem::align_of::<cl_ushort4>() - 8usize];
     |                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
    --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:8358:10
     |
8358 |         [::std::mem::align_of::<cl_ushort8__bindgen_ty_3>() - 8usize];
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
    --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:9060:30
     |
9060 |     ["Alignment of cl_int2"][::std::mem::align_of::<cl_int2>() - 8usize];
     |                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
    --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:9138:10
     |
9138 |         [::std::mem::align_of::<cl_int4__bindgen_ty_3>() - 8usize];
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
    --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:9511:31
     |
9511 |     ["Alignment of cl_uint2"][::std::mem::align_of::<cl_uint2>() - 8usize];
     |                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
    --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:9589:10
     |
9589 |         [::std::mem::align_of::<cl_uint4__bindgen_ty_3>() - 8usize];
     |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
     --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:10862:32
      |
10862 |     ["Alignment of cl_float2"][::std::mem::align_of::<cl_float2>() - 8usize];
      |                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error[E0080]: evaluation of constant value failed
     --> src/gallium/frontends/rusticl/rusticl_opencl_bindings.rs:10940:10
      |
10940 |         [::std::mem::align_of::<cl_float4__bindgen_ty_3>() - 8usize];
      |          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ attempt to compute `4_usize - 8_usize`, which would overflow

error: aborting due to 14 previous errors

For more information about this error, try `rustc --explain E0080`.


systen is full ~arch
bug was found during emerge -e @world that include the rust upgrade
Comment 1 tdr 2024-09-18 05:45:23 UTC
Created attachment 903243 [details]
emerge --info
Comment 2 tdr 2024-09-18 05:47:18 UTC
Created attachment 903244 [details]
mesa-24.2.2-build-fail.log
Comment 3 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-09-18 05:49:15 UTC
Surely rust-1.81.0 breakage.
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-09-19 03:54:03 UTC
*** Bug 939824 has been marked as a duplicate of this bug. ***
Comment 5 tdr 2024-09-19 06:40:29 UTC
Created attachment 903300 [details]
build fail with rust downgrade to rust-1.80.1
Comment 6 tdr 2024-09-19 07:19:05 UTC
Downgraded bindgen to =dev-util/bindgen-0.69.4

mesa built successfully with =rust-1.80.1
updated rust to rust-1.81.0 

bindgen-0.70.1 was the problem package
Comment 7 Alex Buell 2024-09-28 10:25:59 UTC
I can confirm this also happens with mesa 24.1.7 and latest bindgen-0.70.1.
Downgrading to bindgen-0.69.4 fixes the issue.
Comment 8 Ben 2024-10-18 18:19:30 UTC
Ran into this as well, Freedesktop has a bug on this I think.

https://gitlab.freedesktop.org/mesa/mesa/-/issues/11722
Comment 9 Fat-Zer 2024-10-21 16:26:42 UTC
It seems the problem was fixed in media-libs/mesa-24.2.5
Comment 10 Ghiunhan Mamut 2024-10-21 16:38:15 UTC
I can't build mesa 24.2.5 with bindgen 0.70.1, and I masked it on my system. Downgrading it allows mesa to build. So I don't think is fixed.
Comment 11 Fat-Zer 2024-10-22 02:07:41 UTC
(In reply to Ghiunhan Mamut from comment #10)
> I can't build mesa 24.2.5 with bindgen 0.70.1, and I masked it on my system.
> Downgrading it allows mesa to build. So I don't think is fixed.

Hm... it works for me though:

amd64 / rust-1.81.0 / bindgen-0.70.1 / mesa-24.2.5 - builds fine
mesa-24.1.7 - fails with the above message

My USE="X abi_x86_32 abi_x86_64 amd64 cpu_flags_x86_sse2 elibc_glibc kernel_linux llvm llvm_slot_18 lm-sensors opencl opengl osmesa proprietary-codecs vaapi vdpau video_cards_intel vulkan wayland xa zstd"
Comment 12 APN-Pucky 2024-10-22 12:57:49 UTC
I also got this error with media-libs/mesa-24.1.7 when adding ABI_X68="32". Using media-libs/mesa-24.2.5 instead it installs fine.
Comment 13 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-10-24 03:24:16 UTC
*** Bug 942043 has been marked as a duplicate of this bug. ***
Comment 14 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-06 11:40:09 UTC
*** Bug 939668 has been marked as a duplicate of this bug. ***
Comment 15 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-11-06 11:42:28 UTC
https://gitlab.freedesktop.org/mesa/mesa/-/commit/3b938aa4cd508456c96843ac6d7b720c0b2d451d is in >=24.2.3.

Stable still needs fixing or we stable 24.2.x.
Comment 16 Filip Kobierski 2024-11-06 11:49:06 UTC
Here's what happens for me (rust-bin 1.81.0)

- 24.1.7[-opencl] -- works
- 24.1.7[opencl] -- fails with this bug
- 24.2.6 -- works for both USE flags
Comment 17 CaptainBlood 2024-11-09 23:22:54 UTC
same here on media-libs/mesa-24.1.7-r1
with dev-util/bindgen-0.70.1-r1

     Installed versions:  24.1.7^t(15:27:28 19/09/2024)(X llvm opencl opengl vaapi vdpau wayland zstd -d3d9 -debug -lm-sensors -osmesa -proprietary-codecs -selinux -test -unwind -valgrind -vulkan -vulkan-overlay -xa ABI_MIPS="-n32 -n64 -o32" ABI_S390="-32 -64" ABI_X86="64 -32 -x32" CPU_FLAGS_X86="sse2" LLVM_SLOT="18 -15 -16 -17" VIDEO_CARDS="intel -d3d12 -freedreno -lavapipe -lima -nouveau -nvk -panfrost -r300 -r600 -radeon -radeonsi -v3d -vc4 -virgl -vivante -vmware -zink")
Comment 18 galen_42@protonmail.com 2024-11-10 01:56:03 UTC
Can confirm that package builds -opencl use flag.
Comment 19 Anon Emuss 2024-11-10 08:46:13 UTC
Created attachment 908355 [details, diff]
Commit from mesa-24.2.0, prerequisite for patching mesa-24.1.7

I can confirm that the commit mentioned earlier appears to fix the problem for me.  However, it does not apply directly to the mesa-24.1.7 build.  To fix that, I am attaching a commit from mesa-24.2.0; when used to patch mesa-24.1.7, the commit that appears to fix the problem will apply.

This is a commit taken directly from a release branch of mesa, and so should fall under the same licensing as mesa.
Comment 20 Anon Emuss 2024-11-10 08:49:27 UTC
Created attachment 908356 [details, diff]
Commit from mesa-24.2.3, appears to fix the problem

This is a commit from mesa-24.2.3 (the commit ID is in the patch file).  When applied to mesa-24.1.7, it appears to fix the problem for me (also mentioned above as a potential fix).  However, it does not apply directly to the mesa-24.1.7 tree; it does appear to apply if the prerequisite commit (above) is applied first.

This patch is taken directly from a commit from a release build branch of mesa, and so should fall under the same licensing.
Comment 21 Anon Emuss 2024-11-10 08:51:57 UTC
Created attachment 908357 [details]
Sample ebuild applying the above patches

This is an example of a modification of the mesa-24.1.7.ebuild that applies the above patches in the proper order.  For me, at least, this appears to fix the problem.  I will leave it to others to decide if they prefer any alternatives, including using USE=-opencl, stabilizing/keywording a newer version of mesa, or applying the above patches using /etc/portage/patches/.
Comment 22 Fat-Zer 2024-11-10 09:39:34 UTC
(In reply to Anon Emuss from comment #21)
> Created attachment 908357 [details]
> Sample ebuild applying the above patches
> 

I believe it's decided to stabilize 24.2.6 and call it a day rather than patch older versions.
Comment 23 Martin Rott 2024-11-12 07:15:03 UTC
FYI - 
even with mesa-24.6.2, I had to mask >=bindgen-0.70 for opencl USE and nvk+nouveau VIDEO_CARDS
Comment 24 Florian Manschwetus 2024-12-02 11:40:22 UTC
Is a similar workaround doable in the ebuild?
https://github.com/Frogging-Family/mesa-git/pull/50

According to latest updates this seems to be a meson cross-build issue.