[tlbuild] dvibook failure on Cygwin

Ken Brown kbrow1i at gmail.com
Mon Feb 27 14:14:09 CET 2012


On 2/27/2012 5:14 AM, Peter Breitenlohner wrote:
> On Sun, 26 Feb 2012, Ken Brown wrote:
>
>> It turned out not to be so hard to sort out. It was a matter of making
>> sure that getopt gets properly declared (with its prototype). The
>> attached patch fixes the problem. With this patch, the declaration is
>> either in the system getopt.h (if unistd.h is included) or in
>> kpathsea/getopt.h.
>
> Hi Ken,
>
> applied (r25513).
>
> The warning
>
>> 'optarg' redeclared without dllimport attribute: previous dllimport
>> ignored
>
> should disappear when <kpathsea/getopt.h> is included before <unistd.h>.
> Maybe this should be done in kpathsea/c-unistd.h -- at least for Cygwin.

Hi Peter,

Good idea.  This not only gets rid of the warning, but it guarantees 
that Cygwin's getopt.h won't be included during the texlive build. 
How's this:

--- c-unistd.h.orig     2012-02-21 18:56:49.000000000 -0500
+++ c-unistd.h  2012-02-27 07:58:51.290463800 -0500
@@ -24,6 +24,9 @@
  #include <kpathsea/systypes.h>

  #if HAVE_UNISTD_H
+#ifdef __CYGWIN__
+#include <kpathsea/getopt.h>
+#endif
  #include <unistd.h>
  #endif


There are probably platforms other than Cygwin where this should be 
done, since POSIX specifies that including <unistd.h> causes getopt() to 
be declared.  (On Cygwin, this is accomplished by having <unistd.h> 
include <getopt.h>.  I don't know about other platforms.)

> BTW: can you please comment on the difference, if any, between __CYGWIN__
> and __CYGWIN32__!

There's no practical difference.  Both are defined when gcc is run on 
Cygwin.  But a grep of /usr/include shows that __CYGWIN__ is used much 
more often than __CYGWIN32__.

Regards,

Ken



More information about the tlbuild mailing list