[NVK] fail to compile src/nouveau/vulkan/libvulkan_nouveau.so (ld.lld: error: src/nouveau/compiler/libnak_ir_proc.so is incompatible with elf32-i386)
When compiling mesa with nouveau and vulkan support on the lastest master, libvulkan_nouveau.so fails to compile because of a linker problem with src/nouveau/compiler/libnak_ir_proc.so
:
FAILED: src/nouveau/vulkan/libvulkan_nouveau.so
clang++-18 -m32 -mfpmath=sse -o src/nouveau/vulkan/libvulkan_nouveau.so -flto=thin -Wl,--as-needed -Wl,--no-undefined -shared -fPIC -Wl,-soname,libvulkan_nouveau.so -Wl,--whole-archive -Wl,--start-group src/nouveau/vulkan/libnvk.a -Wl,--no-whole-archive -stdlib=libc++ -march=native -O3 -pipe -fdiagnostics-color=always -Wl,-O1 -Wl,--as-needed -Wl,--as-needed -fuse-ld=lld -rtlib=compiler-rt -unwindlib=libunwind -latomic -Wl,--as-needed src/nouveau/codegen/libnouveau_codegen.a src/util/libmesa_util.a src/util/libmesa_util_sse41.a src/util/blake3/libblake3.a src/c11/impl/libmesa_util_c11.a src/nouveau/compiler/libnak.a src/nouveau/compiler/libnak_rs.a src/nouveau/compiler/libbitview.rlib src/nouveau/compiler/libnak_bindings.rlib src/nouveau/compiler/libnak_ir_proc.so src/nouveau/headers/libnvidia_headers.a src/nouveau/nil/libnil.a src/nouveau/winsys/libnouveau_ws.a src/compiler/nir/libnir.a src/compiler/libcompiler.a src/nouveau/mme/libnouveau_mme.a src/vulkan/util/libvulkan_util.a src/compiler/spirv/libvtn.a src/loader/libloader_wayland_helper.a src/util/libxmlconfig.a -Wl,--build-id=sha1 /usr/lib/libdrm.so /usr/lib/libz.so -pthread -lm /usr/lib/libzstd.so /usr/lib/libxcb.so /usr/lib/libX11-xcb.so /usr/lib/libX11.so /usr/lib/libxcb-dri3.so /usr/lib/libxcb-present.so /usr/lib/libxcb-xfixes.so /usr/lib/libxcb-sync.so /usr/lib/libxcb-randr.so /usr/lib/libxcb-shm.so /usr/lib/libxshmfence.so /usr/lib/libxcb-keysyms.so /usr/lib/libwayland-client.so /usr/lib/libXrandr.so /usr/lib/libudev.so -lrt -lpthread -ldl -lutil /usr/lib/libexpat.so -Wl,--end-group
ld.lld: error: src/nouveau/compiler/libnak_ir_proc.so is incompatible with elf32-i386
clang++-18: error: linker command failed with exit code 1 (use -v to see invocation)
Here is the full build log: build-log-mesa-9999.log
The last good commit I compile was 1bc25f47, by checking the last time I compiled mesa (failed compiles are not register):
Thu Mar 14 10:54:48 2024 >>> media-libs/mesa-9999
merge time: 19 minutes and 19 seconds.
Note: The 2 small hacks that exist in the ebuild I use, also need to be done when manually compiling.
The frist it to fix rust compilation for the multilib, by adding '--target=i686-unknown-linux-gnu' to rustc binaries:
rust_fix.ini
--------------------------------------------------
[binaries]
rust = ['rustc', '--target=i686-unknown-linux-gnu']
and then fix the generated build.ninja to not give a failure:
sed -i -E '{N; s/(rule rust_COMPILER_FOR_BUILD\n command = rustc) --target=[a-zA-Z0-9=:-]+ (.*) -C link-arg=-m[[:digit:]]+/\1 \2/g}' build.ninja