When cross compiling media-libs/mesa, LLVM_CONFIG is not set for cross compilation and builds fail. The llvm-config is actually a compiled binary, so it will fail to execute unless qemu-user and binfmt_misc are setup, but with those two in place, setting LLVM_CONFIG externally works. I don't have a fix in LLVM yet, but I am opening this so that it can block the tracker bug for cross compilation issues. If the x11 team is okay with me patching the ebuild, I could probably write an ebuild patch to fix the issue and punt the problem entirely to mesa.
I'm not interested in fixing any issues related to the autotools build system. 18.2.0 will be released soon and it will use Meson in Gentoo.
(In reply to Matt Turner from comment #1) > I'm not interested in fixing any issues related to the autotools build > system. 18.2.0 will be released soon and it will use Meson in Gentoo. The behavior is the same whether it is autotools or meson. I was thinking that the ebuild could have a small detection function that it could use to set the variable in the environment to handle it. No build system changes would be necessary, provided llvm-config gets switched to use a script.
*** Bug 679960 has been marked as a duplicate of this bug. ***
Could you post the ebuild patch, if you happen to have made one up in the meantime?
Created attachment 575344 [details, diff] Patch against sys-devel/llvm I try very hard to avoid QEMU when cross-compiling as it can throw up a lot of other issues. I initially thought llvm-config would return the wrong paths anyway but I now know that it returns paths relative to itself so it may work in that respect. I've taken a different approach though by writing a poor man's shell script equivalent of llvm-config to use when cross-compiling. It's quite small and relatively accurate. I'm not sure mgorny will buy it though.
*** Bug 736450 has been marked as a duplicate of this bug. ***
Regarding #736450 which was marked as a duplicate of this bug, the final build error with the edited llvm.eclass is caused by the inclusion of a multilib-wrapped header, llvm-config.h, which conditionally includes 'real' llvm-config headers for {i686,x86_64}-pc-linux-gnu targets but not any for the LLVM_TARGETS flags (I have set AArch64,AMDGPU,ARM,BPF) Not currently in a position to reupload the data from the dup'd bug, but there's some info there which may be of use to solving the issue.
Another bit of information. using llvm-config.h from the cross-sysroot and manually editing the wrapped header to use it, in addition to using get_llvm_config -b in llvm.eclass allows compilation to get further along, up to the linking phase, but fails finding -lLLVM-10. Will be attaching info when I'm back to my primary machine.
I don't see this fixed: FAILED: src/gallium/drivers/llvmpipe/libllvmpipe.a.p/lp_state_fs.c.o In file included from ../mesa-9999/src/gallium/auxiliary/gallivm/lp_bld.h:49, from ../mesa-9999/src/gallium/auxiliary/gallivm/lp_bld_type.h:42, from ../mesa-9999/src/gallium/drivers/llvmpipe/lp_state_fs.c:77: /usr/lib/llvm/12/include/llvm/Config/llvm-config.h:43:3: error: #error "No ABI matched, please report a bug to bugs.gentoo.org" 43 | # error "No ABI matched, please report a bug to bugs.gentoo.org" | ^~~~~