bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] gawk 4.0.0 compile error when sigsegv is enabled (mingw32


From: xxxc2urg_l-4yoh
Subject: Re: [bug-gawk] gawk 4.0.0 compile error when sigsegv is enabled (mingw32)
Date: Sun, 24 Jul 2011 15:41:43 -0700 (PDT)

First of all thanks for your prompt reply at an early hour of the day.
I showed the output from an MSYS shell which I used to build the package but I 
tried as you suggested building in a cmd.com window using not msys make but 
mingw32-make. You are correct that MSYS adjusts the paths and the way the gcc 
compiler searches for libraries and headers.
The sigsegv package builds from source code with mingw and also with Visual C++ 
on windows with ./configure,..make in the case of the former and with nmake in 
the case of Visual C++. The latest version is 2.10 but I haven't compiled it 
with mingw. If you think it might help that I install the latest version I can 
certainly try that. I sent the author my test results. As far as I know I have 
a working library installed (both versions). The source code came from a Gnu 
mirror site.
I adjusted the Makefile to use mingw32-make but the compilation result was the 
same. The reason the text was mangled in my original message was that I typed 
<alt>-q in Gnus to justify a line automaticall but that messed up the MSYS 
shell output.
In config.h I am trying to enable NLS, libintl.h, libintl, gettext, locale as 
well as sigsegv. It builds as long as I don't enable sigsegv but I haven't 
really tested the internationalization feature. I did not see a LDFLAGS or LIBS 
variable inside the Makefile so I decided to use the existing LF, LF2 variable 
idea to add additional linker flags needed to build.
When I recompile with --save-temps the snippet of the preprocessor output is 
this:
NODE *
do_log(int nargs)
{
 NODE *tmp;
 double d, arg;

 tmp = ({ NODE *_t = (stack_ptr--)->rptr; _t->type != Node_var_array ? _t : 
(set_loc("builtin.c", 530), r_fatal(((char *) ("attempt to use array `%s' in a 
scalar context")), array_vname(_t)), _t);});
 if (do_lint && (tmp->flags & (16|32)) == 0)
  (*(set_loc("builtin.c", 532),lintfunc))(((char *) ("log: received non-numeric 
argument")));
 arg = (double) __extension__ ({NODE *_tn = (tmp); (_tn->flags & 16) ? 
_tn->sub.val.fltnum : r_force_number(_tn);});
 if (arg < 0.0)
  warning(((char *) ("log: received negative argument %g")), arg);
 d = log(arg);
 ( _r = (tmp), (!(_r->flags & 2) && (--_r->sub.val.sref == 0)) ? unref(_r) : 
(void)0 );
 return mk_number(((double) d), (unsigned int)(1|16|32));
}
# 552 "builtin.c"
NODE *
format_tree(
 const char *fmt_string,
 size_t n0,
 NODE **the_args,
 long num_args)
{


#define bchunk(s,l) if (l) { while ((l) > ofre) { size_t olen = obufout - obuf; 
erealloc(obuf, char *, osiz * 2, "format_tree"); ofre += osiz; osiz *= 2; 
obufout = obuf + olen; } memcpy(obufout, s, (size_t) (l)); obufout += (l); ofre 
-= (l); }
# 575 "builtin.c"
#define bchunk_one(s) { if (ofre < 1) { size_t olen = obufout - obuf; 
erealloc(obuf, char *, osiz * 2, "format_tree"); ofre += osiz; osiz *= 2; 
obufout = obuf + olen; } *obufout++ = *s; --ofre; }
# 588 "builtin.c"
#define chksize(l) if ((l) >= ofre) { size_t olen = obufout - obuf; size_t 
delta = osiz+l-ofre; erealloc(obuf, char *, osiz + delta, "format_tree"); 
obufout = obuf + olen; ofre += delta; osiz += delta; }
# 597 "builtin.c"
 size_t cur_arg = 0;
 NODE *r = ((void *)0);
 int i;
 int toofew = 0;
 char *obuf, *obufout;
 size_t osiz, ofre;
 const char *chbuf;
 const char *s0, *s1;
 int cs1;
 NODE *arg;
 long fw, prec, argnum;
 int used_dollar;
 int lj, alt, big, bigbig, char, have_prec, need_format;
 long *cur = ((void *)0);
 uintmax_t uval;
 int sgn;
 int base = 0;
# 622 "builtin.c"
 struct {
  char *buf;
  size_t bufsize;
  char stackbuf[30];
 } cpbufs[2];
#define cpbuf cpbufs[0].buf
 char *cend = &cpbufs[0].stackbuf[sizeof(cpbufs[0].stackbuf)];
 char *cp;
 const char *fill;
 double tmpval;
 char signchar = 0;
 size_t len;
 int zero_flag = 0;
 int quote_flag = 0;
 int ii, jj;
 char *chp;
 size_t copy_count, char_count;
 static const char sp[] = " ";
 static const char zero_string[] = "0";
 static const char lchbuf[] = "0123456789abcdef";
 static const char Uchbuf[] = "0123456789ABCDEF";

#define INITIAL_OUT_SIZE 512
 (void)((obuf=(char *)malloc((size_t)(512))) || (set_loc("builtin.c", 645), 
r_fatal(((char *) ("%s: %s: can't allocate %ld bytes of memory (%s)")), 
("format_tree"), "obuf", (long) (512), strerror((*_errno()))),0));
 obufout = obuf;
 osiz = 512;
 ofre = osiz - 2;

 cur_arg = 1;

 {
  size_t k;
  for (k = 0; k < sizeof(cpbufs)/sizeof(cpbufs[0]); k++) {
   cpbufs[k].bufsize = sizeof(cpbufs[k].stackbuf);
   cpbufs[k].buf = cpbufs[k].stackbuf;
  }
 }
Finally, here is what it looks like with a cmd.com window :
(snip)...
D:\gnu-source\gawk-4.0.0>make mingw32
makefile:322: warning: overriding commands for target `TAGS'
makefile:319: warning: ignoring old commands for target `TAGS'
mingw32-make  all \
        CC=mingw32-gcc-4.5.2 O=.o CF="-O2 -gdwarf-2 -g3" OBJ=popen.o \
        LNK=LMINGW32 PLNK=PLMINGW32 DLNK=DLMINGW32 \
        LF="-gdwarf-2 -g3" LF2=-lmsvcp60 LF3=-Ld:/sigsegv/lib  LF4=-lsigsegv \
        LF5=-L/mingw/lib LF6=-lintl LF7=-Ld:/gnu/gnuwin32/lib LF8=-liconv.dll SP
=
mingw32-make[1]: Entering directory `D:/gnu-source/gawk-4.0.0'
mingw32-gcc-4.5.2 -c -O2 -gdwarf-2 -g3 -DGAWK -I.-Id:/sigsegv/include -DHAVE_CON
FIG_H -save-temps  builtin.c
builtin.c: In function 'format_tree':
builtin.c:609:28: error: expected identifier or '(' before 'char'
builtin.c:709:2: error: 'need_format' undeclared (first use in this function)
builtin.c:709:2: note: each undeclared identifier is reported only once for each
 function it appears in
builtin.c:725:3: error: 'have_prec' undeclared (first use in this function)
builtin.c:729:29: error: expected expression before 'char'
builtin.c:945:8: error: expected expression before 'char'
builtin.c:959:9: error: expected identifier or '(' before '=' token
mingw32-make[1]: *** [builtin.o] Error 1
mingw32-make[1]: Leaving directory `D:/gnu-source/gawk-4.0.0'
make: *** [mingw32] Error 2
...(snip)
Thanks again for your attention. I haven't thought about how to take advantage 
of libsigsegv in gawk programs but maybe someone else could benefit from using 
it.

--

Allan

--- On Sun, 7/24/11, Eli Zaretskii <address@hidden> wrote:

> From: Eli Zaretskii <address@hidden>
> Subject: Re: gawk 4.0.0 compile error when sigsegv is enabled (mingw32)
> To: address@hidden
> Cc: address@hidden
> Date: Sunday, July 24, 2011, 7:03 AM
> > From: Allan J Mui <address@hidden>
> > Cc: address@hidden
> > Date: Sun, 24 Jul 2011 05:24:12 +0000
> > 
> > When I compile without libsigsegv enabled the build
> system works fine
> > but when I try to enable libsigsegv by setting the
> attribute
> > `HAVE_LIBSIGSEGV' to 1 (in config.h) I receive a
> compilation error as
> > follows: 
> > (MSYS shell output)...  
>    ^^^^^^^^^^^^^^^^^
> What does this mean, exactly?  Do you have the MSYS
> shell somewhere on
> your PATH, or is that shell involved in some deeper way in
> the build
> process?
> 
> Anyway, I suggest to try again after removing the MSYS
> shell from
> PATH.  That shell should only be used for running the
> Unix configure
> scripts, which isn't necessary in this case.  Using
> the MSYS shell in
> any other situation might get you in trouble, because it
> assumes that
> every command-line argument that starts with a slash is a
> file name,
> and modifies such arguments to convert Unix-style file
> names to
> Windows style.
> 
> I'm not saying this is necessarily the cause of your
> trouble, but
> using MSYS tools for anything but running configure scripts
> might
> cause you problems due to MSYS subtleties that are known to
> work well
> only when running configure scripts.
> 
> > CC=mingw32-gcc-4.5.2 O=.o CF="-O2-gdwarf-2 -g3"
> OBJ=popen.o \ 
> > LNK=LMINGW32 PLNK=PLMINGW32 DLNK=DLMINGW32\ 
> > LF="-gdwarf-2 -g3" LF2=-lmsvcp60 LF3=-Ld:/sigsegv/lib
> LF4=-lsigsegv \
> > LF5=-L/mingw/lib LF6=-lintl LF7=-Ld:/gnu/gnuwin32/lib
> LF8=-liconv.dll SP
> 
> It sounds like you changed more than just config.h, because
> the
> original pc/Makefile does not have LF3, LF4, LF5,
> etc.  Please show
> the full extent of the changes you made.
> 
> Please also tell where did you get the Windows port of
> libsigsegv.
> 
> > make[1]: Entering directory
> `/d/gnu-source/gawk-4.0.0'
> 
> Is this the MSYS Make or a MinGW Make?  Please use the
> latter, again
> to make sure you are not being hit by some MSYS subtlety.
> 
> > mingw32-gcc-4.5.2 -c -O2 -gdwarf-2 -g3 -DGAWK
> -I.-Id:/sigsegv/include
>                
>                
>              
>    ^^^^
> > -DHAVE_CON FIG_H array.c mingw32-gcc-4.5.2 -c -O2
> -gdwarf-2 -g3 -DGAWK
> > -I.-Id:/sigsegv/include -DHAVE_CONFIG_H builtin.c
>    ^^^^
> Are these instances of lack of space between -I switches
> real, or are
> they some artifact of copy/paste from the screen?  If
> the former, they
> could well screw up your build.
>  
> > builtin.c: In function 'format_tree': 
> > builtin.c:609:28: error: expected identifier or
> > '(' before 'char' 
> > builtin.c:709:2: error: 'need_format' undeclared
> > (first use in this function) 
> > builtin.c:709:2: note: each undeclared
> > identifier is reported only once for each function it
> appears in
> > builtin.c:725:3: error: 'have_prec' undeclared (first
> use in this
> > function) builtin.c:729:29: error: expected expression
> before 'char'
> > builtin.c:945:8: error: expected expression before
> 'char'
> > builtin.c:959:10: error: expected identifier or '('
> before '=' token
> > make[1]: *** [builtin.o] Error 1 make[1]: Leaving
> directory
> > `/d/gnu-source/gawk-4.0.0' make: *** [mingw32] Error
> 2
> 
> Line 609 is this:
> 
>     int lj, alt, big, bigbig, small,
> have_prec, need_format;
> 
> So something, perhaps in sigsegv.h, is probably redefining
> "bigbig" to
> some string whose syntax bewilders the compiler. 
> Please show the
> preprocessed form of this line and its surroundings.
> 
> Does the compilation work for you with the original sources
> and
> config.h, without adding the libsigsegv stuff?
> 
> > I assume that building with libsigsegv is supported on
> mingw32.
> 
> I never tried such a build (in fact, I didn't even know
> libsigsegv is
> available for MinGW).  So your assumption seems to be
> overly
> optimistic ;-)
>

Attachment: config.h
Description: Text document

Attachment: Makefile
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]