diff --git a/meta/recipes-graphics/mesa/mesa.inc b/meta/recipes-graphics/mesa/mesa.inc
index 77f9a5c81d..76247932ec 100644
--- a/meta/recipes-graphics/mesa/mesa.inc
+++ b/meta/recipes-graphics/mesa/mesa.inc
@@ -72,6 +72,14 @@ do_configure:prepend () {
 	fi
 }
 
+do_configure:prepend:x86-64:class-target () {
+	# mesa's meson requires the llvm-config --libdir command which in turn
+	# returns ${STAGING_EXECPREFIXDIR}/lib, but on an x86_64 bit machine
+	# libs are located at ${STAGING_EXECPREFIXDIR}/lib64. Symlink directories
+	# so that the when llvm-config --libdir is called proper libraries are located.
+	ln -fs ${STAGING_LIBDIR} ${STAGING_EXECPREFIXDIR}/lib
+}
+
 # set the MESA_BUILD_TYPE to either 'release' (default) or 'debug'
 # by default the upstream mesa sources build a debug release
 # here we assume the user will want a release build by default
