1.5.25-12: problem with flex version 2.5.4a-3

Bob Kierski bobo@sgi.com
Fri Apr 18 17:46:00 GMT 2008


When I compile and link an application that has code generated by flex,
I get an error indicating that isatty(int) is undefined.

Here is the g++ command line and error message:

g++ -O -Wimplicit -Wconversion -Wstrict-prototypes -Wmissing-prototypes
-Wlong-long -o ../../cxfs/idl/kernidl.exe
./objfre_wxp_x86/emit_files.obj ./objfre_wxp_x86/main.obj
./objfre_wxp_x86/node.obj ./objfre_wxp_x86/parser.obj
./objfre_wxp_x86/lexer.obj
./objfre_wxp_x86/lexer.obj:lexer.c++:(.text+0x13c9): undefined reference
to `isatty(int)'

After failing to build correctly, if I apply this patch to lexer.c++:

--- objfre_wxp_x86/lexer.c++-bad 2008-04-18 10:55:33.921875000 -0500
+++ objfre_wxp_x86/lexer.c++ 2008-04-18 10:55:52.281250000 -0500
@@ -22,9 +22,7 @@
#ifdef __cplusplus

#include <stdlib.h>
-#ifndef _WIN32
#include <unistd.h>
-#endif

/* Use prototypes in function declarations. */
#define YY_USE_PROTOS

Then restart the build, it works just fine. Since lexer.c++ is already
generated, it doesn't need to regenerate it. When lexer.c++ gets
compiled the second time, it picks up the correct prototype declaration
in /usr/include/sys/unistd.h.

Similarly... if I apply this patch to the source of flex-2.5.4a-3:

--- flex.skl.old 2008-04-18 11:05:59.296875000 -0500
+++ flex.skl 2008-04-18 11:06:29.218750000 -0500
@@ -31,9 +31,7 @@
using std::cout;
using std::cerr;
%*
-#ifndef _WIN32
#include <unistd.h>
-#endif

/* Use prototypes in function declarations. */
#define YY_USE_PROTOS
@@ -1184,15 +1182,7 @@


%-
-#ifndef _WIN32
#include <unistd.h>
-#else
-#ifndef YY_ALWAYS_INTERACTIVE
-#ifndef YY_NEVER_INTERACTIVE
-extern int isatty YY_PROTO(( int ));
-#endif
-#endif
-#endif

#ifdef YY_USE_PROTOS
void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )

Then rebuild flex and install it, the build runs from start to finish
without errors.

-- 
 _________
|\  \     | Have a day,    (KSGS) 9:15 AM CST  Temp: 46.4  Sky: overcast
|  \  \   |   ボボ       
|    \  \ | Bob Kierski
|______\__| 想像、信用、実行

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck.out
URL: <http://cygwin.com/pipermail/cygwin/attachments/20080418/d0a7db51/attachment.ksh>
-------------- next part --------------
--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


More information about the Cygwin mailing list