glGenFramebuffers fails when linked with OSMesa AND X11

Bug #1551028 reported by Peter Maersk-Moller on 2016-02-28
This bug affects 2 people
Affects Status Importance Assigned to Milestone
mesa (Ubuntu)
Timo Aaltonen

Bug Description


In latest update for Ubuntu Desktop 14.04.4 LTS, there is a serious problem when calling glGenFramebuffers() in a program that links both libOSMesa and libX11.

Attached is a test program that can verify this. If the program is compiled with the following

        gcc check_glgenframebuffer.c -lGL -lX11 -lOSMesa

then glGenFramebuffers() will fail when current context is set to GLX and the program will dump core upon exit. This is from gdb:

        Program received signal SIGSEGV, Segmentation fault.
        0x00007ffff2ef930e in ?? () from /usr/lib/x86_64-linux-gnu/dri/

If the program is compiled with the following, then it works.

        gcc check_glgenframebuffer.c -lGL -lX11

This is a problem if you have a program that needs both libs such as the Open Source Video Mixer Snowmix.

Best regards
Peter Maersk-Moller

Installed libs:
ls -l /usr/lib/x86_64-linux-gnu/libOSMesa*
lrwxrwxrwx 1 root root 18 Jan 12 21:03 /usr/lib/x86_64-linux-gnu/ ->
lrwxrwxrwx 1 root root 18 Jan 12 21:03 /usr/lib/x86_64-linux-gnu/ ->
-rw-r--r-- 1 root root 3708216 Jan 12 21:03 /usr/lib/x86_64-linux-gnu/

ls -l /usr/lib/x86_64-linux-gnu/libX11*
-rw-r--r-- 1 root root 2188236 Dec 4 2013 /usr/lib/x86_64-linux-gnu/libX11.a
lrwxrwxrwx 1 root root 15 Dec 4 2013 /usr/lib/x86_64-linux-gnu/ ->
lrwxrwxrwx 1 root root 15 Dec 4 2013 /usr/lib/x86_64-linux-gnu/ ->
-rw-r--r-- 1 root root 1265072 Dec 4 2013 /usr/lib/x86_64-linux-gnu/

ls -l /usr/lib/x86_64-linux-gnu/libGL.*
lrwxrwxrwx 1 root root 13 Jan 12 21:03 /usr/lib/x86_64-linux-gnu/ -> mesa/

ls -l /usr/lib/x86_64-linux-gnu/mesa/*
-rw-r--r-- 1 root root 31 Jan 12 21:03 /usr/lib/x86_64-linux-gnu/mesa/
lrwxrwxrwx 1 root root 14 Jan 12 21:03 /usr/lib/x86_64-linux-gnu/mesa/ ->
lrwxrwxrwx 1 root root 14 Jan 12 21:03 /usr/lib/x86_64-linux-gnu/mesa/ ->
-rw-r--r-- 1 root root 413968 Jan 12 21:03 /usr/lib/x86_64-linux-gnu/mesa/

ldd /usr/lib/x86_64-linux-gnu/dri/ => (0x00007ffe885cf000) => /usr/lib/x86_64-linux-gnu/ (0x00007fdb85bac000) => /usr/lib/x86_64-linux-gnu/ (0x00007fdb859a5000) => /usr/lib/x86_64-linux-gnu/ (0x00007fdb85799000) => /usr/lib/x86_64-linux-gnu/ (0x00007fdb8558c000) => /lib/x86_64-linux-gnu/ (0x00007fdb85362000) => /lib/x86_64-linux-gnu/ (0x00007fdb85144000) => /lib/x86_64-linux-gnu/ (0x00007fdb84f40000) => /usr/lib/x86_64-linux-gnu/ (0x00007fdb84c3c000) => /lib/x86_64-linux-gnu/ (0x00007fdb84936000) => /lib/x86_64-linux-gnu/ (0x00007fdb84571000) => /lib/x86_64-linux-gnu/ (0x00007fdb8435b000) => /usr/lib/x86_64-linux-gnu/ (0x00007fdb84152000)
 /lib64/ (0x00007fdb8652a000) => /lib/x86_64-linux-gnu/ (0x00007fdb83f39000)

ldd /usr/lib/x86_64-linux-gnu/ => (0x00007ffc773d0000) => /lib/x86_64-linux-gnu/ (0x00007f3c1cdce000) => /lib/x86_64-linux-gnu/ (0x00007f3c1cbca000) => /usr/lib/x86_64-linux-gnu/ (0x00007f3c1c8c6000) => /lib/x86_64-linux-gnu/ (0x00007f3c1c5c0000) => /lib/x86_64-linux-gnu/ (0x00007f3c1c1fb000) => /lib/x86_64-linux-gnu/ (0x00007f3c1bfe5000)
 /lib64/ (0x00007f3c1d57f000)

ldd /usr/lib/x86_64-linux-gnu/ => (0x00007ffe4328d000) => /usr/lib/x86_64-linux-gnu/ (0x00007f572a94c000) => /lib/x86_64-linux-gnu/ (0x00007f572a748000) => /lib/x86_64-linux-gnu/ (0x00007f572a383000) => /usr/lib/x86_64-linux-gnu/ (0x00007f572a17f000) => /usr/lib/x86_64-linux-gnu/ (0x00007f5729f79000)
 /lib64/ (0x00007f572aea0000)

ldd /usr/lib/x86_64-linux-gnu/mesa/ => (0x00007ffc7f780000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a4f61000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a4d4f000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a4b4c000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a4946000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a4744000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a440f000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a41f8000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a3ff3000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a3df0000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a3bed000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a39e7000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a37c8000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a35c6000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a33c0000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a31b3000) => /lib/x86_64-linux-gnu/ (0x00007f19a2f95000) => /lib/x86_64-linux-gnu/ (0x00007f19a2d91000) => /lib/x86_64-linux-gnu/ (0x00007f19a29cc000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a27c8000) => /usr/lib/x86_64-linux-gnu/ (0x00007f19a25c2000)
 /lib64/ (0x00007f19a53ee000)

  Lenovo Thinkpad T61
    Display controller: Intel Corporation Mobile GM965/GL960 Integrated Graphics Controller (secondary) (rev 0c)

Peter Maersk-Moller (pmaersk) wrote :

Source for test program attached

Peter Maersk-Moller (pmaersk) wrote :

It should be noted that it worked in 14.04.03 LTS.

Peter Maersk-Moller (pmaersk) wrote :

The Bug has mistakenly been filed in 'Cairo'. Should be filed under OpenGL/GLX/OSMesa.

Changed in cairo (Ubuntu):
assignee: nobody → Timo Aaltonen (tjaalton)
importance: Undecided → High
Sebastien Bacher (seb128) wrote :

Timo, did you ever got to look at that one?

Timo Aaltonen (tjaalton) wrote :

Have you tried on 15.10? There should be nothing special about the lts stack itself, DRI drivers and osmesa are built from the same source package.

Changed in cairo (Ubuntu):
status: New → Incomplete
Timo Aaltonen (tjaalton) wrote :

and the example works fine on 16.04

affects: cairo (Ubuntu) → mesa (Ubuntu)
Mike Miller (mtmiller) wrote :

I think this bug is due to the change in the mesa package to build osmesa without using the shared glapi. I have seen similar errors using libosmesa6 10.1.3-0ubuntu0.6, when a program is linked with both libGL and libOSMesa. If the libosmesa6 packages are downgraded to 10.1.3-0ubuntu0.4, the errors disappear. Of course that version does not work when the mesa LTS HW enablement stack is used.

Mike Miller (mtmiller) wrote :

Just for completeness, since this bug report only mentions Ubuntu release numbers, the working version of libosmesa6 in 14.04.3 is 10.1.3-0ubuntu0.4, the version that fails in 14.04.4 is 10.1.3-0ubuntu0.6.

For my part, I am interested in how this affects Octave users because Octave links with both libGL for on-screen rendering and libOSMesa for off-screen rendering.

Timo Aaltonen (tjaalton) wrote :

and reverting -0ubuntu0.5 would then result in


Timo Aaltonen (tjaalton) wrote :

what would fix these issues for good would be to let mesa roll forward unrenamed, that might actually happen for 16.04.x <fingerscrossed>

Mike Miller (mtmiller) on 2016-05-12
tags: added: trusty
Mike Miller (mtmiller) wrote :

Right, so is there anything we can do to build OSMesa for 14.04.x users to resolve this? Or do we say sorry, don't mix OSMesa with OpenGL, hopefully it will be better in the next LTS? IOW do you see this moving towards "In Progress" or "Won't Fix"?

I completely understand the reasoning in bug #1424059, and maybe there is no other way to resolve this in trusty without apt/dpkg versioned Provides. I certainly don't have any ideas how to fix this.

Timo Aaltonen (tjaalton) wrote :

I don't see any other way than maybe stop building rest of mesa using shared glapi, but I don't know what that would break if anything

Timo Aaltonen (tjaalton) wrote :

mesa in 16.04 will get proper backports and not renamed like before, so this should not happen anymore.. sorry that there's no way to fix it in 14.04 lts

Changed in mesa (Ubuntu):
status: Incomplete → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers