This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Darwin vs. libstdc++


I've been trying to build GCC on darwin, at least to get it as far as 
the libjava build. It seems that there are issues with libstdc++.

First, why does t-darwin want to multilib? I dont know if this causes 
any actual problems, but it does suck waiting for multilibs to build.

Index: t-darwin
===================================================================
RCS file: /cvs/gcc/egcs/gcc/config/rs6000/t-darwin,v
retrieving revision 1.4
diff -u -r1.4 t-darwin
--- t-darwin    2001/06/28 19:55:53     1.4
+++ t-darwin    2001/10/09 06:14:25
@@ -21,10 +21,10 @@
             $(TM_P_H)
         $(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) $<

-# Build the libraries for both hard and soft floating point
+# Don't build the libraries for both hard and soft floating point

-MULTILIB_OPTIONS = msoft-float
-MULTILIB_DIRNAMES = soft-float
+MULTILIB_OPTIONS =
+MULTILIB_DIRNAMES =

  LIBGCC = stmp-multilib
  INSTALL_LIBGCC = install-multilib


Next, theres big problems when we hit libstdc++ proper, starting with 
basic_file.cc:

/Users/bryce/cvs/gcc/build/gcc/xgcc -B/Users/bryce/cvs/gcc/build/gcc/ 
-nostdinc++ -L/Users/bryce/cvs/gcc/build/powerpc-apple-
darwin1.4/libstdc++-v3/src 
-L/Users/bryce/cvs/gcc/build/powerpc-apple-
darwin1.4/libstdc++-v3/src/.libs 
-B/Users/bryce/devo/gcc/powerpc-apple-darwin1.4/bin/ 
-B/Users/bryce/devo/gcc/powerpc-apple-darwin1.4/lib/ -isystem 
/Users/bryce/devo/gcc/powerpc-apple-darwin1.4/include -nostdinc++ 
-I/Users/bryce/cvs/gcc/build/powerpc-apple-
darwin1.4/libstdc++-v3/include/powerpc-apple-darwin1.4 
-I/Users/bryce/cvs/gcc/build/powerpc-apple-
darwin1.4/libstdc++-v3/include -I../../../../libstdc++-v3/libsupc++ 
-I../../../../libstdc++-v3/libmath -g -O2 -fno-implicit-templates -Wall 
-Wno-format -W -Wwrite-strings -Winline -fdiagnostics-show-location=once 
-g -c basic_file.cc -o basic_file.o
In file included from /Users/bryce/cvs/gcc/build/powerpc-apple-
darwin1.4/libstdc++-v3/include/bits/localefwd.h:43,
                  from /Users/bryce/cvs/gcc/build/powerpc-apple-
darwin1.4/libstdc++-v3/include/bits/std_ios.h:43,
                  from /Users/bryce/cvs/gcc/build/powerpc-apple-
darwin1.4/libstdc++-v3/include/bits/basic_file.h:40,
                  from basic_file.cc:34:
/Users/bryce/cvs/gcc/build/powerpc-apple-
darwin1.4/libstdc++-v3/include/bits/std_cctype.h:57: `isalnum' not 
declared
/Users/bryce/cvs/gcc/build/powerpc-apple-
darwin1.4/libstdc++-v3/include/bits/std_cctype.h:58: `isalpha' not 
declared
/Users/bryce/cvs/gcc/build/powerpc-apple-
darwin1.4/libstdc++-v3/include/bits/std_cctype.h:59: `iscntrl' not 
declared
[ blah blah blah ]

It seems that libstdc++ expects these ctype declarations to be real 
functions, but darwin's /usr/include/ctype.h only defines them as 
macros! Apparently every other platform that libstdc++ must declare 
these as functions, so this is a bug with darwin? I was able to work 
around it by patching darwin's header as below.

--- ctype.h.orig	Tue Oct  9 19:27:11 2001
+++ ctype.h	Tue Oct  9 19:27:19 2001
@@ -82,18 +82,6 @@
 #define	_T	0x00100000L		/* Special */
 #define	_Q	0x00200000L		/* Phonogram */
 
-#define isalnum(c)      __istype((c), (_A|_D))
-#define isalpha(c)      __istype((c),     _A)
-#define iscntrl(c)      __istype((c),     _C)
-#define isdigit(c)      __isctype((c),    _D)	/* ANSI -- locale independent */
-#define isgraph(c)      __istype((c),     _G)
-#define islower(c)      __istype((c),     _L)
-#define isprint(c)      __istype((c),     _R)
-#define ispunct(c)      __istype((c),     _P)
-#define isspace(c)      __istype((c),     _S)
-#define isupper(c)      __istype((c),     _U)
-#define isxdigit(c)     __isctype((c),    _X)	/* ANSI -- locale independent */
-
 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
 #define	isascii(c)	((c & ~0x7F) == 0)
 #define toascii(c)	((c) & 0x7F)
@@ -153,6 +141,73 @@
 	return((c & _CRMASK) ?
 	    ___tolower(c) : _CurrentRuneLocale->maplower[c]);
 }
+
+static __inline _BSD_RUNE_T_
+isalnum(_BSD_RUNE_T_ c)
+{
+	return  __istype((c), (_A|_D));
+}
+
+static __inline _BSD_RUNE_T_
+isalpha(_BSD_RUNE_T_ c)
+{
+	return __istype((c), _A);
+}
+
+static __inline _BSD_RUNE_T_
+iscntrl(_BSD_RUNE_T_ c)
+{
+ 	return __istype((c), _C);
+}
+
+static __inline _BSD_RUNE_T_
+isdigit(_BSD_RUNE_T_ c)
+{
+	return __isctype((c), _D);
+}
+
+static __inline _BSD_RUNE_T_
+isgraph(_BSD_RUNE_T_ c)
+{
+	return __istype((c), _G);
+}
+
+static __inline _BSD_RUNE_T_
+islower(_BSD_RUNE_T_ c)
+{
+	return __istype((c), _L);
+}
+
+static __inline _BSD_RUNE_T_
+isprint(_BSD_RUNE_T_ c)
+{
+	return __istype((c), _R);
+}
+
+static __inline _BSD_RUNE_T_
+ispunct(_BSD_RUNE_T_ c)
+{
+  return __istype((c), _P);
+}
+
+static __inline _BSD_RUNE_T_
+isspace(_BSD_RUNE_T_ c)
+{
+ return  __istype((c), _S);
+}
+
+static __inline _BSD_RUNE_T_
+isupper(_BSD_RUNE_T_ c)
+{
+  return __istype((c), _U);
+}
+
+static __inline _BSD_RUNE_T_
+isxdigit(_BSD_RUNE_T_ c)
+{ 
+  return __isctype((c), _X);
+}
+
 #endif /* !_ANSI_LIBRARY */
 
 #else /* !_USE_CTYPE_INLINE_ */
@@ -164,5 +219,18 @@
 _BSD_RUNE_T_	tolower __P((_BSD_RUNE_T_));
 __END_DECLS
 #endif /* _USE_CTYPE_INLINE_ */
+
+#define isalnum(c)      __istype((c), (_A|_D))
+#define isalpha(c)      __istype((c),     _A)
+#define iscntrl(c)      __istype((c),     _C)
+#define isdigit(c)      __isctype((c),    _D)	/* ANSI -- locale independent */
+#define isgraph(c)      __istype((c),     _G)
+#define islower(c)      __istype((c),     _L)
+#define isprint(c)      __istype((c),     _R)
+#define ispunct(c)      __istype((c),     _P)
+#define isspace(c)      __istype((c),     _S)
+#define isupper(c)      __istype((c),     _U)
+#define isxdigit(c)     __isctype((c),    _X)	/* ANSI -- locale independent */
+
 
 #endif /* !_CTYPE_H_ */


With this patch in place, everything builds okay, but I get this linker 
warning:

ranlib: same symbol defined in more than one member in: 
.libs/libstdc++.a (table of contents will not be sorted)
ranlib: file: .libs/libstdc++.a(time.o) defines symbol: 
__ZNKSt11__timepunctIcE13_M_put_helperEPcmPKcPK2tm
ranlib: file: .libs/libstdc++.a(locale-inst.o) defines symbol: 
__ZNKSt11__timepunctIcE13_M_put_helperEPcmPKcPK2tm

This seems to be responsible for the vast majority of testsuite 
failures, which all look like:

/usr/bin/ld: warning table of contents of library: 
/Users/bryce/cvs/gcc/build/powerpc-apple-
darwin1.4/libstdc++-v3/src/.libs/libstdc++.a not sorted slower link 
editing will result (use the ranlib(1) -s option)

FAIL: 17_intro/header_cstdio.cc (test for excess errors)

but apart from this the built libstdc++ seems to work ok!

regards

Bryce.

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