Compiling newlib natively [PATCH]

Shaun Jackman sjackman@gmail.com
Wed Dec 1 22:25:00 GMT 2004


Certainly. linux/time.h defines a version of mktime that's quite
different than the version defined in
newlib/libc/sys/linux/include/time.h. linux/time.h only defines mktime
if __KERNEL__ is defined. newlib/libc/sys/linux/sys/stat.h defines
__KERNEL__, includes linux/stat.h, which in turn includes,
linux/time.h, which redefines mktime. My fix is to include
linux/time.h before sys/stat.h defines __KERNEL__. I've attached
glob.i, which illustrates my problem. How does this fix break your
build?

Cheers,
Shaun

gcc -I/home/sjackman/work/debian/newlib/newlib-20041126/_build/i686-pc-linux-gnu/newlib/targ-include
-I/home/sjackman/work/debian/newlib/newlib-20041126/newlib/libc/include
-DPACKAGE=\"newlib\" -DVERSION=\"1.12.0\" -I.
-I../../../../../../../newlib/libc/sys/linux/stdlib -O2 -Wall
-D_I386MACH_ALLOW_HW_INTERRUPTS -DHAVE_FCNTL -fPIC
-D_I386MACH_NEED_SOTYPE_FUNCTION -DMISSING_SYSCALL_NAMES -fno-builtin
-O2 -g -O2 -D_GNU_SOURCE -O2 -g -O2 -c
../../../../../../../newlib/libc/sys/linux/stdlib/glob.c  -fPIC -DPIC
-o .libs/glob.o
In file included from
/home/sjackman/work/debian/newlib/newlib-20041126/_build/i686-pc-linux-gnu/newlib/targ-include/pthread.h:21,
                from /usr/include/bits/libc-lock.h:24,
                from
/home/sjackman/work/debian/newlib/newlib-20041126/_build/i686-pc-linux-gnu/newlib/targ-include/sys/lock.h:14,
                from
/home/sjackman/work/debian/newlib/newlib-20041126/_build/i686-pc-linux-gnu/newlib/targ-include/sys/dirent.h:13,
                from
/home/sjackman/work/debian/newlib/newlib-20041126/newlib/libc/include/dirent.h:6,
                from
../../../../../../../newlib/libc/sys/linux/stdlib/glob.c:73:
/home/sjackman/work/debian/newlib/newlib-20041126/_build/i686-pc-linux-gnu/newlib/targ-include/time.h:67:
error: conflicting types for `mktime'
/usr/include/linux/time.h:285: error: previous declaration of `mktime'


On Wed, 01 Dec 2004 15:43:10 -0500, Jeff Johnston <jjohnstn@redhat.com> wrote:
> Shaun,
>
>    Can you discuss the mktime problem that the 2nd part of your patch is fixing?
>   The change unfortunately breaks my linux newlib build whereas the glob.c
> change is fine.
>
> -- Jeff J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: glob.i.gz
Type: application/x-tar
Size: 28928 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20041201/049e6b0f/attachment.tar>


More information about the Newlib mailing list