kraj / meta-clang

Clang C/C++ cross compiler and runtime for OpenEmbedded/Yocto Project
MIT License
160 stars 206 forks source link

Dunfell: Mesa 20.0.2+llvmpipe fails to configure with multilib(aarch64) enabled. (meta-clang/dunfell - clang 10.0.1) #643

Open ErrrOrrr503 opened 2 years ago

ErrrOrrr503 commented 2 years ago

While do_configure meson fails with:

...
|   File "/home/build/yocto-owrt-luci2021_swu/build/tanowrt-glibc/work/aarch64-oe-linux/mesa/2_20.0.2-r0owen13/recipe-sysroot-native/usr/lib/python3.8/site-packages/mesonbuild/dependencies/base.py", line 2237, in find_external_dependency
|     d = c()
|   File "/home/build/yocto-owrt-luci2021_swu/build/tanowrt-glibc/work/aarch64-oe-linux/mesa/2_20.0.2-r0owen13/recipe-sysroot-native/usr/lib/python3.8/site-packages/mesonbuild/dependencies/dev.py", line 239, in __init__
|     self._set_new_link_args(environment)
|   File "/home/build/yocto-owrt-luci2021_swu/build/tanowrt-glibc/work/aarch64-oe-linux/mesa/2_20.0.2-r0owen13/recipe-sysroot-native/usr/lib/python3.8/site-packages/mesonbuild/dependencies/dev.py", line 287, in _set_new_link_args
|     mode = self.get_config_value(['--shared-mode'], 'link_args')[0]
| IndexError: list index out of range
| Checking for function "clock_gettime" : YES
| Run-time dependency zlib found: YES 1.2.11
| Run-time dependency libzstd found: NO (tried pkgconfig and cmake)
| Run-time dependency threads found: YES
| Checking for function "pthread_setaffinity_np" with dependency threads: YES
| Checking for function "pthread_setaffinity_np" with dependency threads: NO
| Run-time dependency expat found: YES 2.2.9
| Library m found: YES
| Run-time dependency libdrm_radeon found: YES 2.4.101
| Run-time dependency libdrm_nouveau found: YES 2.4.101
| Run-time dependency libdrm found: YES 2.4.101
| llvm-config found: YES (/home/build/yocto-owrt-luci2021_swu/build/tanowrt-glibc/work/aarch64-oe-linux/mesa/2_20.0.2-r0owen13/recipe-sysroot-native/usr/bin/llvm-config10.0.1) 10.0.1

The problem is similar to https://bugzilla.yoctoproject.org/show_bug.cgi?id=13937.

The inbuilt patch 0007-llvm-allow-env-override-of-exe-path.patch does not work. I corrected the patch according to this: new patch. But that was not enough.

According to mesa.inc:

export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
export YOCTO_ALTERNATE_MULTILIB_NAME = "${base_libdir}"
export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}"
export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"

Mesa sets env variables itself and does not need llvm-config wrapper, only patch. Adding echos to mesa's do_configure showed, that YOCTO_ALTERNATE_EXE_PATH was set incorrectly, as ...recipe-sysroot/usr/lib64/llvm-config, not as ...recipe-sysroot/usr/lib64/llvm10.0.1/llvm-config Redefining YOCTO_ALTERNATE_EXE_PATH in mesa_20.0.2.bbappend in my layer (that is above meta-clang) solved the problem.

P.S. old patch does not work with redefinition. P.P.S. in my case gcc can't build mesa+llvmpipe, clang toolchain worked.

kraj commented 2 years ago

We now have https://github.com/kraj/meta-clang/tree/dunfell-clang12 branch as well which uses clang 12.x for dunfell. Can you try that and see if you still have similar issues.