]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
mesa: do not rely on native llvm-config in target sysroot
authorAlexander Kanavin <alex.kanavin@gmail.com>
Mon, 14 Nov 2022 19:00:56 +0000 (20:00 +0100)
committerSteve Sakoman <steve@sakoman.com>
Fri, 25 Nov 2022 16:16:14 +0000 (06:16 -1000)
Sadly the magic is not perfect: llvm-config contains a hardcoded
value for the libdir from the native configuration, and things will
break if the target build installs libraries somewhere else (e.g. lib64).

llvm-config in target bindir also needs a rpath adjustment,
otherwise it simply won't even run when e.g. building for arm on x86.

To avoid patching llvm-source let's simply add more cases to the
llvm-config wrapper script, so that falling through to llvm-config binary
is avoided. Fortunately those cases are all static in what they return,
even though llvm-config binary does poke around the file tree to arrive
at them (which is where breakage happens if native and target don't match
exactly wrt libdir).

I verified that this works by building mesa with llvm enabled for
qemuarm64 and with baselib set to 'lib64' - so that both the target
architecture and target libdir differ from native ones.

Upstream tickets:
https://github.com/llvm/llvm-project/issues/58984
https://github.com/mesonbuild/meson/issues/11043

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
(cherry picked from commit 056431883e94296b767a479d029b914392e4fd7c)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
meta/recipes-devtools/llvm/llvm/llvm-config
meta/recipes-graphics/mesa/mesa.inc

index a45f38c650a3543b0b16c85011e8b6eaab4cd840..5e4ded2da5bc95d429c6f717a2f25223bbbe210e 100644 (file)
@@ -29,6 +29,15 @@ for arg in "$@"; do
     --ldflags)
       output="${output} ${LDFLAGS}"
       ;;
+    --shared-mode)
+      output="${output} shared"
+      ;;
+    --libs)
+      output="${output} -lLLVM"
+      ;;
+    --link-shared)
+      break
+      ;;
     *)
       remain="${remain} ${arg}"
       ;;
index 3754bb14dec8a87acb954f0f86487cb39d540e29..f9007f31875f595a121982f3fecd9c3d6d5fdd12 100644 (file)
@@ -54,17 +54,7 @@ ANY_OF_DISTRO_FEATURES:class-target = "opengl vulkan"
 
 PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)}"
 
-# By placing llvm-config in the target sysroot bindir, it will then map values
-# to the target libdir magically. We can safely add to path as there are no other binaries
-# there.
-PATH:prepend = "${STAGING_BINDIR_CROSS}:${STAGING_BINDIR}:"
 MESA_LLVM_RELEASE ?= "${LLVMVERSION}"
-do_configure:prepend () {
-       if [ -e ${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE} ]; then
-               cp ${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE} ${STAGING_BINDIR}
-               cp ${STAGING_BINDIR_NATIVE}/llvm-config ${STAGING_BINDIR}
-       fi
-}
 
 # set the MESA_BUILD_TYPE to either 'release' (default) or 'debug'
 # by default the upstream mesa sources build a debug release