[Cook] DEBUG build of cook gives 3 compile errors

Pieter den Hertog pieter at dwark.nl
Mon Nov 23 00:31:15 EST 2009


Hi,

I am using cook-2.32 on Linux and compiling a DEBUG version gave me 3 
errors:

1. gcc -I.  -g -O2 -c common/sub.c
common/sub.c: In function ‘sub_var_set_string’:
common/sub.c:1225: error: request for member ‘str_text’ in something not 
  a structure or union
make: *** [common/sub.o] Error 1

2. gcc -I.  -g -O2 -c cook/builtin/strlen.c
cook/builtin/strlen.c: In function ‘strlen_interpret’:
cook/builtin/strlen.c:55: error: ‘__FUNCTION_PRETTY__’ undeclared (first 
use in this function)
make: *** [cook/builtin/strlen.o] Error 1

3. gcc -I.  -g -O2 -c cook/lex.c
cook/lex.c: In function ‘internal_token_name’:
cook/lex.c:117: error: stray ‘@’ in program
cook/lex.c: In function ‘meta_repn’:
cook/lex.c:567: error: stray ‘@’ in program
cook/lex.c: In function ‘mode_repn’:
cook/lex.c:1118: error: stray ‘@’ in program
make: *** [cook/lex.o] Error 1

The patch attached fixed the first two (simple) problems.

I fixed the 3rd error by replacing the calls to sprintf by equivalent
calls to snprintf, so the lines of cook/lex.c now read:

lex.c:117: snprintf(buffer, sizeof(buffer), "%d", tok);
lex.c:567: snprintf(buf3, sizeof(buf3), "\\%03o", (unsigned 
char)val->m_char);
lex.c:1118:snprintf(buffer, sizeof(buffer), "%d", n);

but I didn't include that in the patch since I am not sure if the errors
are caused by my setup (though configure thinks snprintf is available)
and because I donot understand the code well enough.

Please note that I am not a programmer and this is the first time I
created a patch (after reading 
http://www.kegel.com/academy/opensource.html).

I tested the patch via:

$ wget http://miller.emu.id.au/pmiller/software/cook/cook-2.32.tar.gz
$ tar xzvf cook-2.32.tar.gz
$ diff -aur cook-2.32 cook-2.32-new > debug-build.patch
$ patch -p0 < debug-build.patch
$ cd cook-2.32
# edit common/main.h and move DEBUG flag out of comment field
# edit cook/lex.c as per above
$ ./configure
$ make
$ make sure

which resulted in a Passed All Tests.  A -TRACing lex.c on a cookbook
seems to work fine.

regards,

-- 
pieter

uname -a
-> Linux cajun 2.6.31-14-generic #48-Ubuntu SMP Fri Oct 16 14:05:01 UTC 
2009 x86_64 GNU/Linux)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug-build.patch
Type: text/x-patch
Size: 1031 bytes
Desc: not available
URL: <http://lists.auug.org.au/pipermail/cook-users/attachments/20091122/0f0e40de/attachment.bin>


More information about the Cook-users mailing list