[tlbuild] dvibook failure on Cygwin
Ken Brown
kbrow1i at gmail.com
Sat Feb 25 19:30:47 CET 2012
On 2/25/2012 11:45 AM, Ken Brown wrote:
> On 2/24/2012 6:01 PM, Ken Brown wrote:
>> On 2/24/2012 5:35 PM, Karl Berry wrote:
>>> Hi Ken,
>>>
>>> Something is seriously wrong with getopt (from kpathsea) on Cygwin.
>>>
>>> And always has been, and just never been noticed before?
>>> Possible, I suppose, but doesn't seem especially likely.
>>
>> You're right, of course. I'm not seeing any problem except in dvibook.
>> But I have no idea what could be preventing getopt from working properly
>> in dvibook, and I can't make any sense out of what I saw under gdb.
>> Maybe Peter will think of something.
>
> Problem solved: the programs that use getopt need to include more
> kpathsea headers. I don't know yet exactly which one(s) or why, but I
> simply added `#include <kpathsea/kpathsea.h>' to dvibook.c (and the
> other files in the seetexk directory that use getopt), and now all tests
> pass.
>
> I'll look more carefully and figure out which header(s) are actually
> needed. I'll also check the rest of the texlive tree.
>
> Interestingly, adding this #include caused the familiar warning about
> the redeclaration of optarg, optind, etc., to appear in the compilation
> of these programs. Previously the warning wasn't there for the programs
> in seetexk.
>
> I'll send a patch once I have a clearer idea of what's going on.
OK, it turns out that <kpathsea/c-unistd.h> is the header that is
needed, and it is only needed because it includes the system header
<unistd.h>. (The latter includes the system header <getopt.h>; this
explains the redeclaration warnings.)
I don't understand why we need unistd.h (and why only on Cygwin) in
order for kpathsea's getopt to work right. So I'll hold off on sending
a patch, in the hope that someone can explain this.
Ken
More information about the tlbuild
mailing list