Skip to contentSkip to conversation

fix qemu segfault with nVidia proprietary driver

PATCH In review Zhai Edwin 2 participants 4 messages Mar 16, 2011

lore
Share & tools
lore

Zhai Edwin

author
#0 lore raw

cover fix qemu segfault with nVidia proprietary driver

From: Zhai Edwin <[email protected]>

Saul,
When linked with nVidia's libGL, qemu get segfault. Patch 1 give warnings to end user if nVidia's libGL installed. Patch 2 use original libGL to avoid segfault.

Scott can comment on patch 2 if something better to do this.

Thanks for Kevin's help.

Best Rgds,
edwin

Pull URL: git://git.pokylinux.org/poky-contrib.git
Branch: gzhai/fix2
Browse: http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=gzhai/fix2

Thanks,
Zhai Edwin <[email protected]>
---

Zhai Edwin (2):
qemu: Give warnings when running qemu if nVidia GL library installed
on host
qemu: Use mesa's libGL rather than nVidia's to avoid segfault of qemu

 scripts/poky-qemu |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)
author
#1 lore raw

PATCH 1/2 qemu: Give warnings when running qemu if nVidia GL library installed on host

From: Zhai Edwin <[email protected]>

---
 scripts/poky-qemu |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
scripts/poky-qemu +12 -0
index c76b3ab..2d94a11 100755
@@ -394,6 +394,18 @@ if [ "$libgl" != 'yes' ]; then
     exit 1;
 fi
 
+# qemu got segfault if linked with nVidia's libgl
+nv_libgl='no'
+
+test -e /usr/lib/nvidia*/libGL.so && nv_libgl='yes'
+test -e /usr/lib64/nvidia*/libGL.so && nv_libgl='yes'
+
+if [ "$nv_libgl" == 'yes' ]; then
+    echo "************** !!!Warning!!! **************
+    You installed nVidia's libGL.so that probably lead qemu segfault!
+    Pls. uninstall proprietary nVidia driver or make mesa libgl precede nvidia's."
+fi
+
 INTERNAL_SCRIPT=`which poky-qemu-internal`
 
 . $INTERNAL_SCRIPT
Signature · 1 line
1.7.1
author
#2 lore raw

PATCH 2/2 qemu: Use mesa's libGL rather than nVidia's to avoid segfault of qemu

In reply to Zhai Edwin

From: Zhai Edwin <[email protected]>

Proprietary nVidia driver introduce its own libGL that precede mesa's. qemu has segfault if linked with it. This fix try to use mesa's libGL in such case.

[YOCTO #649]
[YOCTO #698]

---
 scripts/poky-qemu |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
scripts/poky-qemu +4 -0
index 2d94a11..1d04c37 100755
@@ -404,6 +404,10 @@ if [ "$nv_libgl" == 'yes' ]; then
     echo "************** !!!Warning!!! **************
     You installed nVidia's libGL.so that probably lead qemu segfault!
     Pls. uninstall proprietary nVidia driver or make mesa libgl precede nvidia's."
+
+    # To avoid segfault of qemu, skip nVidia's libGL and use mesa's instead
+    echo "Skip nVidia's libGL!"
+    export LD_PRELOAD="/usr/lib/libGL.so $LD_PRELOAD"
 fi
 
 INTERNAL_SCRIPT=`which poky-qemu-internal`
Signature · 1 line
1.7.1
Acked-by on v1 2/2
#3 lore raw

Re: [PATCH 2/2] qemu: Use mesa's libGL rather than nVidia's to avoid segfault of qemu

Quoted 10 lines · Zhai Edwin

From: Zhai Edwin<[email protected]>

Proprietary nVidia driver introduce its own libGL that precede mesa's. qemu has segfault if linked with it. This fix try to use mesa's libGL in such case.

[YOCTO #649]
[YOCTO #698]

This fixes the problem on my Ubuntu 10.10 system using NVIDIA proprietary graphics.

Quoted 19 lines
---
  scripts/poky-qemu |    4 ++++
  1 files changed, 4 insertions(+), 0 deletions(-)
scripts/poky-qemu +4 -0
index 2d94a11..1d04c37 100755
@@ -404,6 +404,10 @@ if [ "$nv_libgl" == 'yes' ]; then
      echo "************** !!!Warning!!! **************
      You installed nVidia's libGL.so that probably lead qemu segfault!
      Pls. uninstall proprietary nVidia driver or make mesa libgl precede nvidia's."
+
+    # To avoid segfault of qemu, skip nVidia's libGL and use mesa's instead
+    echo "Skip nVidia's libGL!"
+    export LD_PRELOAD="/usr/lib/libGL.so $LD_PRELOAD"
  fi
 
  INTERNAL_SCRIPT=`which poky-qemu-internal`
Signature · 3 lines
Scott Garman
Embedded Linux Engineer - Yocto Project
Intel Open Source Technology Center