[tex-live] build fails

Vladimir Volovich vvv at vsu.ru
Sat Jan 13 01:31:52 CET 2007


"VV" == Vladimir Volovich writes:

 VV> please undo this patch - i'll investigate how to properly fix it.

i've figured it out.

first, an explanation of gcc behavior.

if you create two files: "test.h" containing two lines:

=========================
typedef unsigned char Byte;
typedef unsigned char Byte;
=========================

and "test.c" containing one line:

=========================
#include <test.h>
=========================

then "gcc -c test.c" will give an error.  but, if you will move test.h
to a system include directory (/usr/include/test.h), then "gcc -c test.c"
will work.

i.e. gcc allows to use double typedefs in system headers but not in
user headers or user programs.

now, there is a typedef for Byte in libs/zlib/zconf.h, and a typedef
for Byte in libs/teckit/source/Public-headers/TECkit_Common.h

and when compiling XeTeX_ext.c, which happens to include both
"zlib.h" and "TECkit_Common.h" (the latter indirectly via "TECkit_Engine.h"),
GCC issues an error in case we use zlib from the TL tree (which we should
do by default, unless --with-system-zlib configure option is given).

so, an error occurs in GCC because of the above (mis)feature.

and the real fix is to resolve this clash with double-typedefing Byte
in "zlib.h" and "TECkit_Common.h" (e.g. it would be best if teckit
could switch to use some other name for this type).

as a workaround, one could use this patch:

=================================================
--- texk/web2c/xetexdir/XeTeX_ext.c.orig
+++ texk/web2c/xetexdir/XeTeX_ext.c
@@ -38,7 +38,9 @@
 #endif
 
 #define EXTERN extern
+#define Byte my_Byte
 #include "xetexd.h"
+#undef Byte
 
 #ifdef XETEX_MAC
 #undef input /* this is defined in texmfmp.h, but we don't need it and it confuses the carbon headers */
=================================================

Best,
v.



More information about the tex-live mailing list