Opened 13 years ago

Closed 12 years ago

#242 closed defect (invalid)

sbrk/_sbrk conflicting declarations

Reported by: Yuri Dario Owned by: bird
Priority: highest Milestone: libc-0.6.5
Component: libc-frontend Version: 0.6.2
Severity: critical Keywords:
Cc:

Description

While building gnu tar, the following conflict exists in headers:

F:/usr/bin/../lib/gcc/../../include/unistd.h:476: error: conflicting types for ' sbrk' F:/usr/bin/../lib/gcc/../../include/stdlib.h:387: note: previous declaration of 'sbrk' was here F:/usr/bin/../lib/gcc/../../include/unistd.h:650: error: conflicting types for ' _sbrk' F:/usr/bin/../lib/gcc/../../include/stdlib.h:416: note: previous declaration of '_sbrk' was here

it seems to me that unistd.h is the correct header, I deleted stdlib.h entries.

Change History (2)

comment:1 Changed 13 years ago by KO Myung-Hun

Hi/2.

It's not a problem of kLIBC, but gnulib-lib. It re-defines intptr_t and uintptr_t as its own gl_intptr_t and gl_uintptr_t in its own stdint.h using "include_next".

BTW, it defines gl_inptr_t and gl_uintptr_t to long int and unsigned long, respectively. But kLIBC uses int and unsigned int.

So you need to modify stdint.in.h of gnulib-lib. I'm using the following patch for libiconv and gettext.

diff -uNr  gnulib-lib/stdint.in.h.org gnulib-lib/stdint.in.h
--- gnulib-lib/stdint.in.h.org     2010-04-25 18:20:42.000000000 +0900
+++ gnulib-lib/stdint.in.h    2011-03-26 21:35:30.000000000 +0900
@@ -243,8 +243,15 @@

 #undef intptr_t
 #undef uintptr_t
+#ifndef __INNOTEK_LIBC__
 typedef long int gl_intptr_t;
 typedef unsigned long int gl_uintptr_t;
+#else
+/* intptr_t and uintptr_t are defined as int and unsigned int on OS/2 kLIBC,
+   respectively */
+typedef int gl_intptr_t;
+typedef unsigned int gl_uintptr_t;
+#endif
 #define intptr_t gl_intptr_t
 #define uintptr_t gl_uintptr_t

comment:2 Changed 12 years ago by bird

Resolution: invalid
Status: newclosed

I fail to see what needs fixing in libc here. unistd.h and stdlib.h are both defining _sbrk and sbrk taking intptr_t as argument. Maybe stdlib.h shouldn't define sbrk, but that's an EMXism and dare not change right now.

Note: See TracTickets for help on using tickets.