Bug#378231: mesa: nasty smelly hack to make mesa work with glibc 2.4

Colin Watson cjwatson at debian.org
Fri Jul 14 13:38:23 UTC 2006


Package: mesa
Version: 6.4.2-1
Severity: normal
Tags: patch

mesa's libGLU defines its own dprintf() function for debugging purposes.
Unfortunately, when _GNU_SOURCE is defined glibc also defines a
dprintf() which prints to a file descriptor. (Its man page notes that
it's badly named, but it's too late now.) Since nowadays g++ forces
_GNU_SOURCE, these symbols clash and you get a nasty mess in your build
log:

  http://librarian.launchpad.net/3405259/buildlog_ubuntu-edgy-powerpc.mesa_6.4.2-1ubuntu2_FAILEDTOBUILD.txt.gz

I note that all the builds for Debian succeeded while Ubuntu's failed,
so I'm guessing it's to do with the fact that Ubuntu's using glibc 2.4.

Anyway, the attached nasty fix avoids this problem by redefining mesa's
dprintf to gludprintf, after including <stdio.h> to make sure glibc's
version is already defined. A better solution would be to rename it
completely upstream, but I wanted to avoid having to carry a huge diff.
I don't know if you're interested in this patch, but I thought I'd send
it to you to see what you thought.

Thanks,

-- 
Colin Watson                                       [cjwatson at debian.org]
-------------- next part --------------
diff -u mesa-6.4.2/debian/changelog mesa-6.4.2/debian/changelog
--- mesa-6.4.2/debian/changelog
+++ mesa-6.4.2/debian/changelog
@@ -1,3 +1,12 @@
+mesa (6.4.2-1ubuntu3) edgy; urgency=low
+
+  * src/glu/sgi/libnurbs/interface/mystdio.h,
+    src/glu/sgi/libnurbs/nurbtess/mystdio.h: Grotesque hack to avoid dprintf
+    symbol clash with glibc while avoiding a huge diff to all of libGLU; we
+    redefine it to gludprintf.
+
+ -- Colin Watson <cjwatson at ubuntu.com>  Fri, 14 Jul 2006 14:19:52 +0100
+
 mesa (6.4.2-1ubuntu2) edgy; urgency=low
   
   * Drop lesstif* again.
only in patch2:
unchanged:
--- mesa-6.4.2.orig/src/glu/sgi/libnurbs/interface/mystdio.h
+++ mesa-6.4.2/src/glu/sgi/libnurbs/interface/mystdio.h
@@ -43,6 +43,8 @@
 #define __glumystdio_h_
 
 #ifdef STANDALONE
+#include <stdio.h>
+#define dprintf gludprintf
 inline void dprintf( char *, ... ) { }
 #endif
 
@@ -51,11 +53,15 @@
 #include <stdio.h>
 #define dprintf printf
 #else
+#include <stdio.h>
+#define dprintf gludprintf
 inline void dprintf( char *, ... ) { }
 #endif
 #endif
 
 #ifdef GLBUILD
+#include <stdio.h>
+#define dprintf gludprintf
 inline void dprintf( char *, ... ) { }
 #endif
 
only in patch2:
unchanged:
--- mesa-6.4.2.orig/src/glu/sgi/libnurbs/nurbtess/mystdio.h
+++ mesa-6.4.2/src/glu/sgi/libnurbs/nurbtess/mystdio.h
@@ -43,6 +43,8 @@
 #define __glumystdio_h_
 
 #ifdef STANDALONE
+#include <stdio.h>
+#define dprintf gludprintf
 inline void dprintf( char *, ... ) { }
 #endif
 
@@ -51,11 +53,15 @@
 #include <stdio.h>
 #define dprintf printf
 #else
+#include <stdio.h>
+#define dprintf gludprintf
 inline void dprintf( char *, ... ) { }
 #endif
 #endif
 
 #ifdef GLBUILD
+#include <stdio.h>
+#define dprintf gludprintf
 inline void dprintf( char *, ... ) { }
 #endif
 


More information about the Pkg-mesa-devel mailing list