Skip to contentSkip to conversation

mesa,llvm: Use native version of llvm-config

PATCH Superseded Khem Raj 2 participants 4 messages Aug 1, 2017

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 mesa,llvm: Use native version of llvm-config

We have a variable YOCTO_ALTERNATE_EXE_PATH to point to target sysroot, utilize this in mesa to use native version of llvm-config to report values from target sysroot.

Its in a way similar to --sysroot option

strip out rpath since its absolute path and incorrect thusly

---
 meta/recipes-devtools/llvm/llvm_git.bb | 12 +++++++-----
 meta/recipes-graphics/mesa/mesa.inc    | 13 +++++++------
 2 files changed, 14 insertions(+), 11 deletions(-)
meta/recipes-devtools/llvm/llvm_git.bb +7 -5
index 5dcb508c23..5e754e45dc 100644
@@ -87,12 +87,12 @@ do_compile() {
 }
 
 do_compile_class-native() {
-	NINJA_STATUS="[%p] " ninja -v ${PARALLEL_MAKE} llvm-tblgen
+	NINJA_STATUS="[%p] " ninja -v ${PARALLEL_MAKE} llvm-config llvm-tblgen
 }
 
 do_install() {
 	NINJA_STATUS="[%p] " DESTDIR=${LLVM_INSTALL_DIR} ninja -v install
-	install -D -m 0755 ${B}/NATIVE/bin/llvm-config ${D}${libdir}/${LLVM_DIR}/llvm-config-host
+	install -D -m 0755 ${B}/bin/llvm-config ${D}${libdir}/${LLVM_DIR}/llvm-config
 
 	install -d ${D}${bindir}/${LLVM_DIR}
 	cp -r ${LLVM_INSTALL_DIR}${bindir}/* ${D}${bindir}/${LLVM_DIR}/
@@ -121,7 +121,9 @@ do_install() {
 	rm -rf ${D}${libdir}/${LLVM_DIR}/libLTO.so
 }
 do_install_class-native() {
-	install -D -m 0755 ${B}/bin/llvm-tblgen ${D}${bindir}/llvm-tblgen
+	install -D -m 0755 ${B}/bin/llvm-tblgen ${D}${bindir}/llvm-tblgen-5.0
+	install -D -m 0755 ${B}/bin/llvm-config ${D}${bindir}/llvm-config-5.0
+	install -D -m 0755 ${B}/lib/libLLVM-5.0.so ${D}${libdir}/libLLVM-5.0.so
 }
 
 PACKAGES += "${PN}-bugpointpasses ${PN}-llvmhello"
@@ -134,14 +136,14 @@ FILES_${PN}-dbg = " \
     ${libdir}/${LLVM_DIR}/.debug/BugpointPasses.so \
     ${libdir}/${LLVM_DIR}/.debug/LLVMHello.so \
     ${libdir}/${LLVM_DIR}/.debug/libLTO.so* \
-    ${libdir}/${LLVM_DIR}/.debug/llvm-config-host \
+    ${libdir}/${LLVM_DIR}/.debug/llvm-config \
     /usr/src/debug \
 "
 
 FILES_${PN}-dev = " \
     ${bindir}/${LLVM_DIR} \
     ${includedir}/${LLVM_DIR} \
-    ${libdir}/${LLVM_DIR}/llvm-config-host \
+    ${libdir}/${LLVM_DIR}/llvm-config \
 "
 
 RRECOMMENDS_${PN}-dev += "${PN}-bugpointpasses ${PN}-llvmhello"
meta/recipes-graphics/mesa/mesa.inc +7 -6
index c9b67d4966..5c1957fdc6 100644
@@ -14,8 +14,8 @@ LIC_FILES_CHKSUM = "file://docs/license.html;md5=725f991a1cc322aa7a0cd3a2016621c
 
 PE = "2"
 
-DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib"
-
+DEPENDS = "expat makedepend-native flex-native bison-native libxml2-native zlib chrpath-replacement-native"
+EXTRANATIVEPATH += "chrpath-native"
 PROVIDES = "virtual/libgl virtual/libgles1 virtual/libgles2 virtual/egl virtual/mesa"
 
 inherit autotools pkgconfig gettext distro_features_check
@@ -25,8 +25,8 @@ REQUIRED_DISTRO_FEATURES = "opengl"
 PLATFORMS ??= "${@bb.utils.filter('PACKAGECONFIG', 'x11 wayland', d)} \
                ${@bb.utils.contains('PACKAGECONFIG', 'gbm', 'drm', '', d)}"
 
-export LLVM_CONFIG = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config-host"
-
+export LLVM_CONFIG = "${STAGING_BINDIR_NATIVE}/llvm-config-${MESA_LLVM_RELEASE}"
+export YOCTO_ALTERNATE_EXE_PATH = "${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE}/llvm-config"
 EXTRA_OECONF = "--enable-shared-glapi \
                 --disable-opencl \
                 --with-llvm-prefix=${STAGING_LIBDIR}/llvm${MESA_LLVM_RELEASE} \
@@ -75,7 +75,7 @@ GALLIUMDRIVERS_append_x86-64 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-l
 # keep --with-gallium-drivers separate, because when only one of gallium versions is enabled, other 2 were adding --without-gallium-drivers
 PACKAGECONFIG[gallium]      = "--enable-texture-float --with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers"
 MESA_LLVM_RELEASE ?= "5.0"
-PACKAGECONFIG[gallium-llvm] = "--enable-llvm --enable-llvm-shared-libs, --disable-llvm, llvm${MESA_LLVM_RELEASE} \
+PACKAGECONFIG[gallium-llvm] = "--enable-llvm --enable-llvm-shared-libs, --disable-llvm, llvm${MESA_LLVM_RELEASE} llvm-native \
                                ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
 export WANT_LLVM_RELEASE = "${MESA_LLVM_RELEASE}"
 PACKAGECONFIG[xa]  = "--enable-xa, --disable-xa"
@@ -118,9 +118,10 @@ do_install_append () {
     rm -f ${D}${libdir}/egl/*.la
     rm -f ${D}${libdir}/gallium-pipe/*.la
     rm -f ${D}${libdir}/gbm/*.la
-    
+
     # it was packaged in libdricore9.1.3-1 and preventing upgrades when debian.bbclass was used 
     rm -f ${D}${sysconfdir}/drirc
+    chrpath --delete ${D}${libdir}/dri/*_dri.so
 }
 
 # For the packages that make up the OpenGL interfaces, inject variables so that
Signature · 1 line
2.13.3
#1 lore raw

Re: [PATCH V2] mesa, llvm: Use native version of llvm-config

Quoted 8 lines · Khem Raj

We have a variable YOCTO_ALTERNATE_EXE_PATH to point to target sysroot, utilize this in mesa to use native version of llvm-config to report values from target sysroot.

Its in a way similar to --sysroot option

strip out rpath since its absolute path and incorrect thusly

I'd say that this needs to be three commits. One to llvm, one to mesa to use llvm-native, and one to mesa to chrpath.

Ross

#2 lore raw

Re: [PATCH V2] mesa, llvm: Use native version of llvm-config

In reply to Khem Raj

ERROR: llvm-5.0-r0 do_compile: Function failed: do_compile (log file is
located at /data/poky-tmp/master/build/work/corei7-64-poky-linux/llvm/5.0-r0/temp/log.do_compile.4542)
ERROR: Logfile of failure stored in:
/data/poky-tmp/master/build/work/corei7-64-poky-linux/llvm/5.0-r0/temp/log.do_compile.4542 Log data follows:
| DEBUG: Executing shell function do_compile
| ninja: error:
'/data/poky-tmp/master/build/work/corei7-64-poky-linux/llvm/5.0-r0/recipe-sysroot-native/usr/bin/llvm-tblgen', needed by 'include/llvm/IR/Attributes.gen.tmp', missing and no known rule
to make it
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /data/poky-tmp/master/build/work/corei7-64-poky-linux/llvm/5.0-r0/temp/log.do_compile.4542)
ERROR: Task (/home/ross/Yocto/poky/meta/recipes-devtools/llvm/llvm_git.bb:do_compile)
failed with exit code '1'

Ross

author
#3 lore raw

Re: [PATCH V2] mesa, llvm: Use native version of llvm-config

Quoted 9 lines · Ross

ERROR: llvm-5.0-r0 do_compile: Function failed: do_compile (log file is
located at /data/poky-tmp/master/build/work/corei7-64-poky-linux/llvm/5.0-r0/temp/log.do_compile.4542)
ERROR: Logfile of failure stored in:
/data/poky-tmp/master/build/work/corei7-64-poky-linux/llvm/5.0-r0/temp/log.do_compile.4542 Log data follows:
| DEBUG: Executing shell function do_compile
| ninja: error:
'/data/poky-tmp/master/build/work/corei7-64-poky-linux/llvm/5.0-r0/recipe-sysroot-native/usr/bin/llvm-tblgen',

Quoted 8 lines

needed by 'include/llvm/IR/Attributes.gen.tmp', missing and no known rule to make it
| WARNING: exit code 1 from a shell command.
| ERROR: Function failed: do_compile (log file is located at /data/poky-tmp/master/build/work/corei7-64-poky-linux/llvm/5.0-r0/temp/log.do_compile.4542)
ERROR: Task (/home/ross/Yocto/poky/meta/recipes-devtools/llvm/llvm_git.bb:do_compile) failed with exit code '1'

yes, just realized that I was building it with a build where meta-clang is included and TOOLCHAIN = "clang"
so it was getting llvm-tblgen from clang when llvm-native version got renamed so it kept on building for me.
I have sent a next rev of the patches which addresses this issue as well as your comment.