On Sun, 2 Dec 2001, James Juran wrote:
James Juran jamesjuran@alumni.psu.edu Only include the necessary files to avoid conflicts in gethostname prototypes between winsock.h and unistd.h
'unistd.h' does not exist on Windows. Since this is a Winelib application it would be good to try to make it compile on Windows too. So I would rather be in favor of removing the 'unistd.h' #include directive unless something prevents that.
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ Any sufficiently advanced bug is indistinguishable from a feature. -- from some indian guy
Francois Gouget wrote:
On Sun, 2 Dec 2001, James Juran wrote:
James Juran jamesjuran@alumni.psu.edu Only include the necessary files to avoid conflicts in gethostname prototypes between winsock.h and unistd.h
'unistd.h' does not exist on Windows. Since this is a Winelib application it would be good to try to make it compile on Windows too. So I would rather be in favor of removing the 'unistd.h' #include directive unless something prevents that.
<unistd.h> is only included in lex.yy.c, which is generated by flex from macro.lex.l. Flex includes <unistd.h> to get the definition of isatty(). The original compilation error was in compiling lex.yy.c, which includes unistd.h and macro.h. macro.h included windows.h, which included winsock.h, which created the conflict on the gethostname() prototype.
So it seems the real conflict is in using flex in Winelib applications that (directly or indirectly) include windows.h on systems with glibc >= 2.2.3. Since I would think that flex wouldn't be used to port a real Windows application to Wine, I would think this isn't a significant problem.
Unless someone knows a way to keep flex from including unistd.h, I think this patch is still necessary.
James
-- James Juran jamesjuran@alumni.psu.edu
On Sun, 2 Dec 2001, James Juran wrote: [...]
<unistd.h> is only included in lex.yy.c, which is generated by flex from macro.lex.l. Flex includes <unistd.h> to get the definition of isatty(). The original compilation error was in compiling lex.yy.c, which includes unistd.h and macro.h. macro.h included windows.h, which included winsock.h, which created the conflict on the gethostname() prototype.
I sent another mail on the same subject just before discovering this one. You can ignore it.
So it seems the real conflict is in using flex in Winelib applications that (directly or indirectly) include windows.h on systems with glibc >= 2.2.3. Since I would think that flex wouldn't be used to port a real Windows application to Wine, I would think this isn't a significant problem.
Isn't flex available on Windows? Or maybe it's not exactly flex just a look alike lexer. I guess even if flex exists on Windows then it does not call isatty.
Unless someone knows a way to keep flex from including unistd.h, I think this patch is still necessary.
It seems like we should have a better solution. Maybe something like what we do for select.
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ I haven't lost my mind, it's backed up on tape around here somewhere...
On Sun, 2 Dec 2001, Francois Gouget wrote: [...]
So it seems the real conflict is in using flex in Winelib applications that (directly or indirectly) include windows.h on systems with glibc >= 2.2.3. Since I would think that flex wouldn't be used to port a real Windows application to Wine, I would think this isn't a significant problem.
That's strange. winhelp compiles just fine here. I have:
libc6 2.2.4-5 flex 2.5.4a-14
If I look at lex.yy.c, I see:
#ifdef __cplusplus
#include <stdlib.h> #include <unistd.h>
So unless you are compiling lex.yy.c with a C++ compiler then you should not have any trouble. Which version of flex are you using?
-- Francois Gouget fgouget@free.fr http://fgouget.free.fr/ I haven't lost my mind, it's backed up on tape around here somewhere...
Francois Gouget wrote:
On Sun, 2 Dec 2001, Francois Gouget wrote: [...]
So it seems the real conflict is in using flex in Winelib applications that (directly or indirectly) include windows.h on systems with glibc >= 2.2.3. Since I would think that flex wouldn't be used to port a real Windows application to Wine, I would think this isn't a significant problem.
That's strange. winhelp compiles just fine here. I have:
libc6 2.2.4-5 flex 2.5.4a-14
If I look at lex.yy.c, I see:
#ifdef __cplusplus
#include <stdlib.h> #include <unistd.h>
So unless you are compiling lex.yy.c with a C++ compiler then you should not have any trouble. Which version of flex are you using?
To answer an earlier question: I have no idea if flex is available on Windows. I've never used it or anything like it on Unix or Windows. I just have an idea what is and figured out that it was involved in this issue.
I just checked the Red Hat flex RPM's, and I see that they patch their flex to include <unistd.h> outside the #ifdef __cplusplus. It's not immediately obvious to me why they do this. I just checked the latest flex RPM from Red Hat's Rawhide (flex-2.5.4a-17), and it still does this. I'll try to figure out the reason for including this patch to flex.
James
-- James Juran jamesjuran@alumni.psu.edu