Ubuntu 10.04 GLUT segfault

Discussions about using Linux guests in VirtualBox.
Post Reply
Eyg
Posts: 1
Joined: 15. May 2010, 04:36
Primary OS: MS Windows Vista
VBox Version: PUEL
Guest OSses: Ubuntu 10.04

Ubuntu 10.04 GLUT segfault

Post by Eyg »

Host vital statistics:

Vista 64
Geforce GTX 285, driver 197.45 (latest as of 14-5-2010)
VirtualBox 3.1.8 r61349 (ditto)

3d acceleration works flawlessly, except for programs that attempt to construct a window via GLUT:

Code: Select all

OpenGL Warning: XGetVisualInfo returned 0 visuals for 9181000
zsh: segmentation fault
I did some searching for this particular problem - saw some indications that this can be caused by outdated or limited drivers on the host, but that doesn't seem to apply in this case, especially given the otherwise perfectly working 3d accel in the guest. My best guess is that there's some mismatch between advertised GL capabilities and what's actually supported by the guest additions driver, but that's just vague handwaving from someone who doesn't really know how these things work.

Minimal program that demonstrates this behavior:

Code: Select all

#include <GL/glut.h>
#include <stdio.h>

int main(int argc, char** argv) {
  printf("glutInit\n");
  glutInit(&argc, argv);
  printf("glutInitDisplayMode\n");
  glutInitDisplayMode(GLUT_DEPTH | GLUT_SINGLE | GLUT_RGBA);
  printf("glutInitWindowPosition\n");
  glutInitWindowPosition(100, 100);
  printf("glutInitWindowSize\n");
  glutInitWindowSize(320, 320);
  printf("glutCreateWindow\n");
  glutCreateWindow("Hello, World");
  printf("done\n");
  return 0;
}
The above will segfault before printing "done".
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: PUEL
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Ubuntu 10.04 GLUT segfault

Post by Sasquatch »

3D on the Guest depends on the 3D OpenGL capabilities of the Host. There are also a few (or none these days, I'm not sure) OpenGL features that don't work in a VM. The required OpenGL feature might not be supported by your Host driver, or it's one of the minor ones that doesn't work. I can't really test this myself, as I don't have a Vista Host and a different video card, but you should be able to obtain a list of supported features. See this Google query for more information.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
galmok
Posts: 15
Joined: 18. May 2010, 10:53
Primary OS: MS Windows Vista
VBox Version: PUEL
Guest OSses: Ubuntu

Re: Ubuntu 10.04 GLUT segfault

Post by galmok »

I have the same issue. I tested the above short example with my laptop running Vista64 with Ubuntu32 10.04 guest OS. Drivers are nVidia 195.62 on Quadro FX 770M. I then downloaded and installed bugle (opengl capture) and ran it like this:
bme@bme-vbox:~$ BUGLE_CHAIN=trace LD_PRELOAD=./libbugle.so ./opengl-test
glutInit
glutInitDisplayMode
glutInitWindowPosition
glutInitWindowSize
glutCreateWindow
OpenGL Warning: XGetVisualInfo returned 0 visuals for 9b9c250
Segmentation fault
The output of the trace gives this:
bme@bme-vbox:~$ cat bugle.log
[INFO] trace.call: glXQueryExtension(0x9a852e0, NULL, NULL) = True
[INFO] trace.call: glXChooseFBConfig(0x9a852e0, 0, 0xbff9f5c4 -> { GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_DEPTH_SIZE, 1, GLX_SYNC_FRAME_SGIX }, 0xbff9f75c -> 64) = 0x9a93028 -> { 0x9b9c250, 0x9b9f850, 0x9b9c5b0, 0x9b9fbb0, 0x9b9c400, 0x9b9fa00, 0x9b9c760, 0x9b9fd60, 0x9b9cfd0, 0x9ba05d0, 0x9b9d330, 0x9ba0930, 0x9b9d180, 0x9ba0780, 0x9b9d4e0, 0x9ba0ae0, 0x9b9b4d0, 0x9b9ead0, 0x9b9b830, 0x9b9ee30, 0x9b9b680, 0x9b9ec80, 0x9b9b9e0, 0x9b9efe0, 0x9b9a750, 0x9b9dd50, 0x9b9aab0, 0x9b9e0b0, 0x9b9a900, 0x9b9df00, 0x9b9ac60, 0x9b9e260, 0x9b9c328, 0x9b9f928, 0x9b9c688, 0x9b9fc88, 0x9b9c4d8, 0x9b9fad8, 0x9b9c838, 0x9b9fe38, 0x9b9d0a8, 0x9ba06a8, 0x9b9d408, 0x9ba0a08, 0x9b9d258, 0x9ba0858, 0x9b9d5b8, 0x9ba0bb8, 0x9b9b5a8, 0x9b9eba8, 0x9b9b908, 0x9b9ef08, 0x9b9b758, 0x9b9ed58, 0x9b9bab8, 0x9b9f0b8, 0x9b9a828, 0x9b9de28, 0x9b9ab88, 0x9b9e188, 0x9b9a9d8, 0x9b9dfd8, 0x9b9ad38, 0x9b9e338 }
Only 2 opengl calls are made and returns seemingly valid information.

glXChooseFBConfig return 64 GLX frame buffer configurations and glut calls XGetVisualInfo with dpy (1. arg) set to the first returned GLX frame buffer configuration pointer at which point it crashes.

I am not sure if calling XGetVisualInfo with a GLX frame buffer configuration is allowed or not (I dont think it is). I would have thought that glXGetVisualFromFBConfig should have been used instead of XGetVisualInfo. freeglut3 could be buggy here?
galmok
Posts: 15
Joined: 18. May 2010, 10:53
Primary OS: MS Windows Vista
VBox Version: PUEL
Guest OSses: Ubuntu

Re: Ubuntu 10.04 GLUT segfault

Post by galmok »

I have checked the source in freeglut3 (2.6.0) and didn't find any references to XGetVisualInfo. freeglut itself is probably not causing this problem.

I grep'ed the library files in /usr/lib for XGetVisualInfo and among the matches where libGL.so and VBoxOGL.so.

I can't follow the trail any further than this I think. I am also not sure what to read into this.
galmok
Posts: 15
Joined: 18. May 2010, 10:53
Primary OS: MS Windows Vista
VBox Version: PUEL
Guest OSses: Ubuntu

Re: Ubuntu 10.04 GLUT segfault

Post by galmok »

Any suggestions where to look for the cause of this problem?
Mike4
Posts: 10
Joined: 14. May 2010, 11:20
Primary OS: Ubuntu 12.04
VBox Version: OSE other
Guest OSses: any

Re: Ubuntu 10.04 GLUT segfault

Post by Mike4 »

ATI? So no wonder then...
galmok
Posts: 15
Joined: 18. May 2010, 10:53
Primary OS: MS Windows Vista
VBox Version: PUEL
Guest OSses: Ubuntu

Re: Ubuntu 10.04 GLUT segfault

Post by galmok »

Mike4 wrote:ATI? So no wonder then...
Thank you for your input, but both cases reported here are using nVidia hardware.

Or do you suggest that ATI may have better OpenGL support (which could be true for all I know).

This is not to cause an OpenGL flamewar between ATI and nVidia. I just wanted to know how I can debug this problem more.
CaptainHook
Posts: 1
Joined: 28. May 2010, 18:35
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Ubuntu-10.04 32

Re: Ubuntu 10.04 GLUT segfault

Post by CaptainHook »

Ahoi,
I have the same problem with ATI-Card. I am trying to run simple OGRE-Demos and Bullet-Demos - all are giving an error such as

OpenGL Warning: XGetVisualInfo returned 0 visuals for 0xa111d60

on latest Ubuntu 10 (32 Bit) and VBox 3.2.0 on Win7-64 Home Premium...
Anyone who can help?

Best Regards,
Captain
oke
Posts: 2
Joined: 3. Sep 2010, 17:37
Primary OS: MS Windows XP
VBox Version: OSE other
Guest OSses: Ubuntu 10.04 LTS

Re: Ubuntu 10.04 GLUT segfault

Post by oke »

Same problem with WinXP SP2 32bit host OS, VirtualBox 3.2.8 and guest OS Ubuntu 10.04 LTS 32bit. Nvidia Quadro FX3500M graphics card.

dmesg|tail gives:

Code: Select all

[ 4419.004180] t[1959]: segfault at 0 ip 004daa6b sp bf885910 error 4 in libglut.so.3.9.0[4bf000+30000]
I'm quite surprised since compiz is supported fine by VirtualBox's GA and opengl implementation as it seems.

Fix for VirtualBox GA opengl such that applications based on glut work, is more than welcome!
redlupine
Posts: 2
Joined: 10. Oct 2010, 21:14
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Ubuntu 10.10

Re: Ubuntu 10.04 GLUT segfault

Post by redlupine »

still no solution for this problem?

I get this output with the test file posted earlier

Code: Select all

glutInit
glutInitDisplayMode
glutInitWindowPosition
glutInitWindowSize
glutCreateWindow
OpenGL Warning: XGetVisualInfo returned 0 visuals for 0x89b3980
Segmentation fault
I run Win7 64bit host with Ubuntu 10.10 guest and nvidia 9800GT graphics card
for me glut works fine without guest installs, my programs compile no problem, but I rather like the shared folder, shared clipboard, and custom resolution that comes with the guest
scottku
Posts: 7
Joined: 11. Oct 2010, 20:03
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Ubuntu 10.10 32bit

Re: Ubuntu 10.04 GLUT segfault

Post by scottku »

I'm also seeing this problem if I use virtualbox-ose-guest-x11 in Ubuntu 10.10 32bit with Virtualbox 3.2.10 PUEL. In this situation, glxinfo shows that OpenGL should be hardware accelerated ("Chromium") but the GLUT programs crash.

One workaround that works for me is to disable hardware acceleration when you run your glut program:

LIBGL_ALWAYS_INDIRECT=1 ./myGlutProgram


This thread may also be of interest:
http://forums.virtualbox.org/viewtopic.php?f=3&t=35218
scottku
Posts: 7
Joined: 11. Oct 2010, 20:03
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Ubuntu 10.10 32bit

Re: Ubuntu 10.04 GLUT segfault

Post by scottku »

For reference, here is the issue ticket for this problem:
http://www.virtualbox.org/ticket/6848
redlupine
Posts: 2
Joined: 10. Oct 2010, 21:14
Primary OS: MS Windows 7
VBox Version: PUEL
Guest OSses: Ubuntu 10.10

Re: Ubuntu 10.04 GLUT segfault

Post by redlupine »

scottku wrote:One workaround that works for me is to disable hardware acceleration when you run your glut program:
LIBGL_ALWAYS_INDIRECT=1 ./myGlutProgram
thanks for that, that worked beautifully
waffleguy4
Posts: 1
Joined: 20. Oct 2011, 20:59
Primary OS: Mac OS X other
VBox Version: OSE Debian
Guest OSses: Windows 7, Ubuntu

Re: Ubuntu 10.04 GLUT segfault

Post by waffleguy4 »

One workaround that works for me is to disable hardware acceleration when you run your glut program:

LIBGL_ALWAYS_INDIRECT=1 ./myGlutProgram
That worked, thanks so much!!
bellerophonvschimere
Posts: 1
Joined: 1. Oct 2014, 11:30

Re: Ubuntu 10.04 GLUT segfault

Post by bellerophonvschimere »

Code: Select all

One workaround that works for me is to disable hardware acceleration when you run your glut program:

LIBGL_ALWAYS_INDIRECT=1 ./myGlutProgram
That worked on my Debian Wheezy VirtualMachinee, thanks so much!!
Post Reply