Is developing for QT+OpenGL+Linux possible in a Virtual machine



  • Hello,

    My dream would be able to deploy a virtual development environment for developing QT 4.7+ and OpenGL applications in Linux environment. Virtualization of such environment for development and testing would be more than effective. At the moment I have setup Ubuntu maverick (10.10) based Linux guest OS with all needed development tools + latest QT snapshot. With this environment, all QT development works like a charm. However, I need OpenGL capabilities as well, and that particularly causes the troubles.

    If I mix QT and OpenGL (through QGLWidget, QGraphicsview and QGraphicsScene), I get random runtime errors from QT, graphical corruption, and sometimes completely non-functional SW. Some of the QT OpenGL examples work in virtual environment, some don't. OpenGL code in general seems to work in virtual machine (i.e. glxgears, and a few opengl benchmarks) so generic OpenGL support cannot be completely broken.

    Now, the question: before diving into the secrets of virtualization+OpenGL drivers I'd like to ask whether someone knows about the remote possibility to get this kind of setup working. Would these issues be more related to virtualization, or QT? And more importantly, are they already known? Any help, or hints would be very much appreciated. :)

    Some background info about the environment: Ubuntu linux as host OS, Ubuntu linux as guest OS. Latest QT (from git) compiled with desktop OpenGL support in guest OS. Latest virtualbox in use (3.2.8 r64453).

    Thanks already in advance! :)


  • Moderators

    I tried using virtual mashines for development, but generally found them too slow to work with. Especially disk IO is awful which is really noticeable when compiling.

    So my current (unix-) solution is to work in a "chroot environment":http://en.wikipedia.org/wiki/Chroot: Basically I set up a minimalistic ubuntu in a subdirectory somewhere using "debootstrap":http://wiki.debian.org/Debootstrap and then use "schroot":http://www.debian-administration.org/articles/566 to switch into that directory. You can then continue to install additional packages as required:-) Both tools are available in the ubuntu repositories.

    The solution is not as thoroughly encapsulated as a virtual machine as the kernel is shared between the "real" OS and the one inside the chroot, but that is good enough for me. The advantage is of course full access to the hardware: Both GL and disk performance do not suffer. Schroot will by default share some external directories (/home, /tmp, etc) between the chroot and its outside which needs to be configured away if you do not want that... I actually like it since it makes exchanging data between different develpoment chroots much simpler:-)

    Of course you can clone development environments by just copying the directories that contain the chroot (make sure the permissions, etc. are not damaged when doing that!).

    Even cheap snapshots are possible with this solution if you place each chroot into a separate LVM partition;-)



  • Thanks for the reply! I'm aware of the chroot concept and tools, but one of the things I'm trying to overcome with virtualization is to harmonize development environments over both windows and linux host OSes. In some cases I'm able to deploy on linux but sometimes the same requirement is for windows hosts and in that case I think virtualization would be the only way to go for this purpose. That is why I'm test driving virtualization for this. Chroots unfortunately do not work in Windows :D

    I think I could test chroots for the time being for my linux machines, that will overcome the performance problem in short term.



  • At the moment I use an Ubuntu 10.4 LTS within VMware Player (with switched on 3D support) on XP.

    Using Coin3d with SoQt (ubuntu packages, however not up to date) seems to deliver reasonable results.

    Using OffscreenRenderer does not work reliable.... probably due to the driver adaption to VMware.

    I tried the opengl support in VirtualBox, but I use a OrthoCam in my software and this seems not to be supported in VirtualBox.


  • Moderators

    vatjjar: You can always run a chroot in a virtualized linux on windows boxes:-) At least you already have the development environment nicely separated somewhere, so it is straight forward to just set up a Linux in an virtual machine with the chroot setup tool of your choice installed. All you need to do afterwards is copy the chroot itself over.

    Performance is still identical to a real virtualized development environment on windows, and you have the same complaints about having to use linux from your windows developers as with a pure development VM approach. :-)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.