Skip to contentSkip to conversation

mesa: fix runpath with native llvm-config in target sysroot

PATCH In review [email protected] 3 participants 6 messages Nov 9, 2022 – Nov 10, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mesa: fix runpath with native llvm-config in target sysroot

From: Maxime Roussin-Bélanger <[email protected]>

llvm-config is copied from native to target sysroot, it shouldn't be allowed to use target shared libraries when it loads.

Remove all runpath so it uses shared library from host system since native llvm-config is compiled with hosttools compiler.

---
 meta/recipes-graphics/mesa/mesa.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-graphics/mesa/mesa.inc +1 -0
index 67cfb4f6c1..abc2c3f4c4 100644
@@ -61,6 +61,7 @@ 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}
+		chrpath -d ${STAGING_BINDIR}/llvm-config
 	fi
 }
 
Signature · 1 line
2.36.0
#1 lore raw

Hello,

Quoted 8 lines · Maxime Roussin-B�langer

From: Maxime Roussin-B�langer <[email protected]>

llvm-config is copied from native to target sysroot, it shouldn't be allowed to use target shared libraries when it loads.

Remove all runpath so it uses shared library from host system since native llvm-config is compiled with hosttools compiler.

I believe this is the cause of:
https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/6139/steps/32/logs/stdio

I'm currently checking

Quoted 30 lines
---
 meta/recipes-graphics/mesa/mesa.inc | 1 +
 1 file changed, 1 insertion(+)
meta/recipes-graphics/mesa/mesa.inc +1 -0
index 67cfb4f6c1..abc2c3f4c4 100644
@@ -61,6 +61,7 @@ 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}
+		chrpath -d ${STAGING_BINDIR}/llvm-config
 	fi
 }
 
Signature · 11 lines
2.36.0



-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#173009): https://lists.openembedded.org/g/openembedded-core/message/173009
Mute This Topic: https://lists.openembedded.org/mt/94906155/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

Hi, (sorry for 2nd message Alex, forgot to cc the list)

Quoted 8 lines · Alexandre Belloni

Hello,

Quoted 5 lines · Maxime Roussin-Bélanger

From: Maxime Roussin-Bélanger <[email protected]>

llvm-config is copied from native to target sysroot, it shouldn't be allowed to use target shared libraries when it loads.

Quoted 7 lines
Quoted 3 lines

Remove all runpath so it uses shared library from host system since native llvm-config is compiled with hosttools compiler.

I believe this is the cause of:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/6139/steps/32/logs/stdio

The patch does fix that problem on my end.

Quoted 47 lines

I'm currently checking

Review

Quoted 7 lines
---
 meta/recipes-graphics/mesa/mesa.inc | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/meta/recipes-graphics/mesa/mesa.inc

meta/recipes-graphics/mesa/mesa.inc do_configure:prepend () { · line 61

Quoted 5 lines

index 67cfb4f6c1..abc2c3f4c4 100644

meta/recipes-graphics/mesa/mesa.inc +0 -0
@@ -61,6 +61,7 @@ do_configure:prepend () {
      if [ -e ${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}

]; then

meta/recipes-graphics/mesa/mesa.inc do_configure:prepend () { · line 62

Quoted 1 line
meta/recipes-graphics/mesa/mesa.inc +0 -0
              cp

${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE} ${STAGING_BINDIR}

Quoted 10 lines
meta/recipes-graphics/mesa/mesa.inc +1 -1
              cp ${STAGING_BINDIR_NATIVE}/llvm-config ${STAGING_BINDIR}
+             chrpath -d ${STAGING_BINDIR}/llvm-config
      fi
 }
 
--

2.36.0

Quoted 3 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#173009):

https://lists.openembedded.org/g/openembedded-core/message/173009

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/94906155/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#3 lore raw
Quoted 17 lines · Maxime Roussin-B�langer

Hi, (sorry for 2nd message Alex, forgot to cc the list)

Quoted 12 lines · Alexandre Belloni

Hello,

Quoted 8 lines · Maxime Roussin-B�langer

From: Maxime Roussin-B�langer <[email protected]>

llvm-config is copied from native to target sysroot, it shouldn't be allowed to use target shared libraries when it loads.

Remove all runpath so it uses shared library from host system since native llvm-config is compiled with hosttools compiler.

Quoted 7 lines
Quoted 3 lines

I believe this is the cause of:

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/6139/steps/32/logs/stdio

The patch does fix that problem on my end.

Well, it doesn't seem to be the cause but it doesn't fix it either... I'm going to run it again using the same worker.

Quoted 50 lines
Quoted 35 lines

I'm currently checking

Review

Quoted 7 lines
---
 meta/recipes-graphics/mesa/mesa.inc | 1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/meta/recipes-graphics/mesa/mesa.inc

meta/recipes-graphics/mesa/mesa.inc do_configure:prepend () { · line 61

Quoted 5 lines

index 67cfb4f6c1..abc2c3f4c4 100644

meta/recipes-graphics/mesa/mesa.inc +0 -0
@@ -61,6 +61,7 @@ do_configure:prepend () {
      if [ -e ${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}

]; then

meta/recipes-graphics/mesa/mesa.inc do_configure:prepend () { · line 62

Quoted 1 line
meta/recipes-graphics/mesa/mesa.inc +0 -0
              cp

${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE} ${STAGING_BINDIR}

Quoted 6 lines
meta/recipes-graphics/mesa/mesa.inc +1 -1
              cp ${STAGING_BINDIR_NATIVE}/llvm-config ${STAGING_BINDIR}
+             chrpath -d ${STAGING_BINDIR}/llvm-config
      fi
 }
 
--
Quoted 6 lines

2.36.0

Quoted 5 lines

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#173058): https://lists.openembedded.org/g/openembedded-core/message/173058
Mute This Topic: https://lists.openembedded.org/mt/94906155/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Signature · 3 lines
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw
Quoted 21 lines · Alexandre Belloni
Quoted 20 lines · Maxime Roussin-Bélanger

Hi, (sorry for 2nd message Alex, forgot to cc the list)

Quoted 15 lines · Alexandre Belloni

Hello,

Quoted 8 lines · Maxime Roussin-Bélanger

From: Maxime Roussin-Bélanger <[email protected]>

llvm-config is copied from native to target sysroot, it shouldn't be allowed to use target shared libraries when it loads.

Remove all runpath so it uses shared library from host system since native llvm-config is compiled with hosttools compiler.

I believe this is the cause of:

Quoted 9 lines

https://autobuilder.yoctoproject.org/typhoon/#/builders/72/builds/6139/steps/32/logs/stdio

Quoted 4 lines

The patch does fix that problem on my end.

Well, it doesn't seem to be the cause but it doesn't fix it either... I'm going to run it again using the same worker.

From what I gathered when debugging this, llvm-config was loading shared libraries of the target sysroot because
of runpath. When mesa is configuring with gallium it invokes llvm-config which can fail for illegal instructions because
of shared libraries of the target sysroot.

By removing runpath from the binary it should load libraries from thost where native llvm-config is built from.

Max.

Quoted 64 lines
Quoted 7 lines
Quoted 7 lines

I'm currently checking

Quoted 1 line
Signed-off-by Maxime Roussin-Bélanger <

[email protected]

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
---
 meta/recipes-graphics/mesa/mesa.inc | 1 +
 1 file changed, 1 insertion(+)
Quoted 7 lines
Quoted 7 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/meta/recipes-graphics/mesa/mesa.inc

meta/recipes-graphics/mesa/mesa.inc do_configure:prepend () { · line 61

Quoted 5 lines

index 67cfb4f6c1..abc2c3f4c4 100644

meta/recipes-graphics/mesa/mesa.inc +0 -0
@@ -61,6 +61,7 @@ do_configure:prepend () {
      if [ -e

${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}

Quoted 3 lines
Quoted 3 lines

]; then

meta/recipes-graphics/mesa/mesa.inc do_configure:prepend () { · line 62

Quoted 1 line
meta/recipes-graphics/mesa/mesa.inc +0 -0
              cp

${STAGING_BINDIR_NATIVE}/llvm-config${MESA_LLVM_RELEASE}

${STAGING_BINDIR}

Quoted 1 line
Quoted 1 line

meta/recipes-graphics/mesa/mesa.inc do_configure:prepend () { · line 63

Quoted 1 line
meta/recipes-graphics/mesa/mesa.inc +0 -0
              cp ${STAGING_BINDIR_NATIVE}/llvm-config

${STAGING_BINDIR}

Quoted 20 lines
Quoted 13 lines
Quoted 11 lines
meta/recipes-graphics/mesa/mesa.inc +1 -1
+             chrpath -d ${STAGING_BINDIR}/llvm-config
      fi
 }
 
--

2.36.0

Quoted 5 lines

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

Quoted 3 lines

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#173058):

https://lists.openembedded.org/g/openembedded-core/message/173058

Quoted 3 lines

Mute This Topic: https://lists.openembedded.org/mt/94906155/3617179
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [

[email protected]]

Quoted 2 lines

-=-=-=-=-=-=-=-=-=-=-=-

--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#5 lore raw

Haven't tested, but seems as above might fix the other gallium-llvm mesa issue I ran into when build for an x86_64 MACHINE.

# meson configure fails when the llvm-config --shared-mode command fails to find libs in ${STAGING_LIBDIR}
# Temp solution copy files from recipe-sysroot/usr/lib64 to recipe-sysroot/usr/lib where llvm-config
# command can find libraries.
do_configure:prepend() {
install -d "${STAGING_LIBDIR}/../lib"
cp -ra ${STAGING_LIBDIR}/* ${STAGING_LIBDIR}/../lib
}