This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Error compiling newlib-1.13.0


On 03/10/05, Jeff Johnston <jjohnstn@redhat.com> wrote:
> >I see that sys/types.h has the missing typedefs, so including it
> >before stdint.h allows gconv_simple.c to be compiled, but I don't know
> >if that is in any way the right thing to do.
> >
> >
> >
> I have fixed this.  Newlib linux has a number of these types already
> defined in <sys/types.h> so I was getting multiple definitions in the
> build.  I removed them from the Linux stdint.h but neglected to add the
> #include <sys/types.h> which is there now.
>
> -- Jeff J.

That solved the problem, thank you very much.

This has allowed me to proceed to the next hurdle :), which again
concerns /usr/include/linux/types.h. When compiling
newlib/libc/sys/linux/wait.c, I get the following errors:

<snip>
gcc -I/tmp/newlib-i686b/i686-pc-linux-gnu/newlib/targ-include
-I/tmp/newlib-cvs/src/newlib/libc/include -DPACKAGE=\"newlib\"
-DVERSION=\"1.13.0\" -I.
-I../../../../../../newlib-cvs/src/newlib/libc/sys/linux
-I../../../../../../newlib-cvs/src/newlib/libc/sys/linux/include -O2
-Wall -D_I386MACH_ALLOW_HW_INTERRUPTS -DHAVE_FCNTL -fPIC
-D_I386MACH_NEED_SOTYPE_FUNCTION -DMISSING_SYSCALL_NAMES -fno-builtin
-I ../../../../../../newlib-cvs/src/newlib/libc/sys/linux/../../stdio
-O2 -g -O2 -c ../../../../../../newlib-cvs/src/newlib/libc/sys/linux/wait.c
 -fPIC -DPIC -o .libs/wait.o
In file included from
/tmp/newlib-i686b/i686-pc-linux-gnu/newlib/targ-include/sys/wait.h:25,
                 from
../../../../../../newlib-cvs/src/newlib/libc/sys/linux/wait.c:6:
/tmp/newlib-i686b/i686-pc-linux-gnu/newlib/targ-include/sys/types.h:148:
error: conflicting types for 'mode_t'
/usr/include/linux/types.h:35: error: previous declaration of 'mode_t' was here
/tmp/newlib-i686b/i686-pc-linux-gnu/newlib/targ-include/sys/types.h:150:
error: conflicting types for 'uid_t'
/usr/include/linux/types.h:69: error: previous declaration of 'uid_t' was here
...
</snip>

wait.c includes <sys/types.h>, but <linux/types.h> is included before
it via <sys/wait.h>. The types like mode_t and uid_t that are defined
in <linux/types.h> are guarded by ifdef's, but not so in newlib's
<sys/types.h>, causing them to be re-typedef'ed when it is included.
This can be fixed by including <sys/types.h> at the beginning of
<linux/types.h>. But the only distro I've found so far that does that
is Debian (it wraps it in a #ifndef __KERNEL__).

Derick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]