[tlbuild] dvibook failure on Cygwin

Ken Brown kbrow1i at gmail.com
Sat Feb 25 22:45:16 CET 2012


On 2/25/2012 3:41 PM, Ken Brown wrote:
> On 2/25/2012 2:27 PM, Paul Vojta wrote:
>> On Sat, Feb 25, 2012 at 01:30:47PM -0500, Ken Brown wrote:
>>> 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
>>
>> One possibility is that the sizes of the argument types in the prototype
>> for getopt are different when c-unistd.h is included compared with
>> when it
>> is not. Have you checked that?
>
> That might be it. The prototype for getopt in kpathsea/getopt.h doesn't
> even give the argument types except on systems that use the GNU C
> library. In particular, it doesn't give the argument types on Cygwin.

On the other hand, simply adding the full prototype to dvibook.c instead 
of including unistd.h doesn't solve the problem, so there must be 
something else going on.

Ken


More information about the tlbuild mailing list