can't build for z8k-coff
Jeff Johnston
jjohnstn@redhat.com
Wed Jun 6 18:27:00 GMT 2007
Christian Groessler wrote:
> Hi Jeff,
>
> On Tue, 5 Jun 2007, Jeff Johnston wrote:
>
>> Let's start with your output. You'll notice that argz_insert.c is failing
>> to compile. For some reason, ptrdiff_t appears to be undefined by your
>> compiler's stddef.h when __need_ptrdiff_t is set. From libc/argz_insert.c.
>>
>>> #include <errno.h>
>>> #include <sys/types.h>
>>> #include <string.h>
>>> #include <stdlib.h>
>>> #include <argz.h>
>>> #define __need_ptrdiff_t
>>> #include <stddef.h>
>>>
>>> error_t
>>> _DEFUN (argz_insert, (argz, argz_len, before, entry),
>>> char **argz _AND
>>> size_t *argz_len _AND
>>> char *before _AND
>>> const char *entry)
>>> {
>>> int len = 0;
>>>
>>> if (before == NULL)
>>> return argz_add(argz, argz_len, entry);
>>>
>>> if (before < *argz || before >= *argz + *argz_len)
>>> return EINVAL;
>>>
>>> while (before != *argz && before[-1])
>>> before--;
>>>
>>> /* delta will always be non-negative, and < *argz_len */
>>> ptrdiff_t delta = before - *argz;
>>>
>> z8k-coff-gcc -B/local/newlib-cvs/b-z8k-coff/z8k-coff/z8001/newlib/ -isystem
>> /local/newlib-cvs/b-z8k-coff/z8k-coff/z8001/newlib/targ-include -isystem
>> /local/newlib-cvs/src/newlib/libc/include -mz8001 -DPACKAGE_NAME=\"newlib\"
>> -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.15.0\"
>> -DPACKAGE_STRING=\"newlib\ 1.15.0\" -DPACKAGE_BUGREPORT=\"\" -I.
>> -I/local/newlib-cvs/src/newlib/libc/argz -O2 -fno-builtin -O2 -g -O2
>> -mz8001 -c -o lib_a-argz_insert.o `test -f 'argz_insert.c' || echo
>> '/local/newlib-cvs/src/newlib/libc/argz/'`argz_insert.c
>> /local/newlib-cvs/src/newlib/libc/argz/argz_insert.c: In function
>> `argz_insert':
>> /local/newlib-cvs/src/newlib/libc/argz/argz_insert.c:34: syntax error before
>> `delta'
>> /local/newlib-cvs/src/newlib/libc/argz/argz_insert.c:41: `delta' undeclared
>> (first use this function)
>> /local/newlib-cvs/src/newlib/libc/argz/argz_insert.c:41: (Each undeclared
>> identifier is reported only once
>> /local/newlib-cvs/src/newlib/libc/argz/argz_insert.c:41: for each function it
>> appears in.)
>> z8k-coff-gcc: file path prefix
>> `/local/newlib-cvs/b-z8k-coff/z8k-coff/z8001/newlib/' never used
>> make[8]: *** [lib_a-argz_insert.o] Error 1
>
> This is easy. It's not c89, delta is declared in the middle of the
> function. I've appended a patch to fix this.
>
Doh, I should have spotted that as obvious. Thanks.
>
>> I don't know why the error appears only as an error 1 instead of an error 2.
>> The build should have stopped there.
>
> Yes. I didn't look at the output of the build process since I assumed it
> would stop immediately when an error happens. How can I debug this?
>
If you didn't specify an option like -i on the build, then check which
make you are using and if there are any updates available. You can set
up a small test case to reproduce the problem and if still present you
should open a bug.
>
> There is another error in stdlib, in gdtoa-gethex.c. It seems that neither
> Pack_32 nor Pack_16 is defined.
>
> z8k-coff-gcc -B/local/newlib-cvs/b-z8k-coff/z8k-coff/z8001/newlib/ -isystem /local/newlib-cvs/b-z8k-coff/z8
> k-coff/z8001/newlib/targ-include -isystem /local/newlib-cvs/src/newlib/libc/include -mz8001 -DPACKAGE_NAME
> =\"newlib\" -DPACKAGE_TARNAME=\"newlib\" -DPACKAGE_VERSION=\"1.15.0\" -DPACKAGE_STRING=\"newlib\ 1.15.0\" -
> DPACKAGE_BUGREPORT=\"\" -I. -I../../../../../../src/newlib/libc/stdlib -O2 -fno-builtin -O2 -g -O2
> -mz8001 -c -o lib_a-gdtoa-gethex.o `test -f 'gdtoa-gethex.c' || echo '../../../../../../src/newlib/libc/std
> lib/'`gdtoa-gethex.c
> ../../../../../../src/newlib/libc/stdlib/gdtoa-gethex.c: In function `increment':
> ../../../../../../src/newlib/libc/stdlib/gdtoa-gethex.c:119: `y' undeclared (first use this function)
> ../../../../../../src/newlib/libc/stdlib/gdtoa-gethex.c:119: (Each undeclared identifier is reported only o
> nce
> ../../../../../../src/newlib/libc/stdlib/gdtoa-gethex.c:119: for each function it appears in.)
> ../../../../../../src/newlib/libc/stdlib/gdtoa-gethex.c:119: `carry' undeclared (first use this function)
> z8k-coff-gcc: file path prefix `/local/newlib-cvs/b-z8k-coff/z8k-coff/z8001/newlib/' never used
> make[8]: *** [lib_a-gdtoa-gethex.o] Error 1
>
It is likely that I gummed this up when I brought the code in originally
and modified it to work for newlib. Obviously, this new code has never
been compiled on the z8k. I've made up a proposed patch to fix this.
Try it out and let me know.
-- Jeff J.
>
>
> Here's the patch for libc/argz/argz_insert.c:
>
> diff -u -p -r1.5 argz_insert.c
> --- newlib/libc/argz/argz_insert.c 4 Apr 2007 20:49:07 -0000 1.5
> +++ newlib/libc/argz/argz_insert.c 5 Jun 2007 20:03:51 -0000
> @@ -20,6 +20,7 @@ _DEFUN (argz_insert, (argz, argz_len, be
> const char *entry)
> {
> int len = 0;
> + ptrdiff_t delta;
>
> if (before == NULL)
> return argz_add(argz, argz_len, entry);
> @@ -31,7 +32,7 @@ _DEFUN (argz_insert, (argz, argz_len, be
> before--;
>
> /* delta will always be non-negative, and < *argz_len */
> - ptrdiff_t delta = before - *argz;
> + delta = before - *argz;
>
> len = strlen(entry) + 1;
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mprec.h.patch
Type: text/x-patch
Size: 622 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20070606/96349020/attachment.bin>
More information about the Newlib
mailing list