This is the mail archive of the 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]
Other format: [Raw text]

Re: [Java PATCH] Fix libjava bootstrap issues on HP-UX 11.00

> The following two minor changes fix the default bootstrap failure on
> hppa2.0w-hp-hpux11.00 for me.  The issue is that on my PA/HPUX system
> the foo_r forms of libc functions aren't prototyped by the system
> headers unless the macro _REENTRANT is defined.  If GCC is using the
> posix thread model, then this macro is defined for us by the -pthread
> command line option in THREADCXXFLAGS, but in the default "single"
> thread model, it isn't and libjava fails with calls to undeclared
> functions.


> Rather than insert the necessary #define _REENTRANT hack into
> libjava/gnu/classpath/ and all the other
> places that'd require it, libjava conventiently provides a
> posix.h header specially for such hacks.  Unfortunately, it's
> not currently included by java/io/, so the second
> hunk below adds the same #include <platform.h> idiom used elsewhere.
> With these changes the libjava almost reaches the end of the
> top-level "make bootstrap" for me, but unfortunately most/all?
> of the compiled java programs "hang" when run, including the
> gcj_dbtool invocation at the very end of the build!  Doh!.

Try installing the latest HP linker patch.

> Tested on hppa2.0w-hp-hpux11.00, configured with the command
> "../gcc/configure --with-gnu-as --with-as=/usr/local/bin/as",
> followed by "make bootstrap", where "as --version" is 2.15.
> Is this patch ok for mainline?  Should we change the default
> GCC thread model on hppa*-hp-hpux* to posix from single?  Is
> there something else I'm doing wrong that's causing the java
> executables to hang?  Many thanks in advance.  And also to the
> folks who've managed to get gcj (almost) working on PA/HPUX.
> 2006-06-28  Roger Sayle  <>
> 	* include/posix.h: Ensure that _REENTRANT is defined on HP-UX.
> 	* java/io/ #include <platform.h>.

I'm not convinced this is the correct approach to fix the lack
of _REENTRANT being defined (see below).  This might also allow
building libjava on hpux 10.x.  There are some testsuite issues
which I haven't had a chance to look at in detail.

It's an open question in my mind as to whether we should force posix
threads when building libjava on hpux 11.  This might be the best

J. David Anglin                        
National Research Council of Canada              (613) 990-0752 (FAX: 952-6602)

Index: gnu/classpath/
--- gnu/classpath/	(revision 113941)
+++ gnu/classpath/	(working copy)
@@ -203,7 +203,7 @@
   uid_t user_id = getuid ();
   struct passwd *pwd_entry;
+#if defined(HAVE_GETPWUID_R) && defined(_REENTRANT)
   struct passwd pwd_r;
   size_t len_r = 200;
   char *buf_r = (char *) _Jv_AllocBytes (len_r);
Index: java/io/
--- java/io/	(revision 113941)
+++ java/io/	(working copy)
@@ -215,7 +215,7 @@
   java::util::ArrayList *list = new java::util::ArrayList ();
   struct dirent *d;
+#if defined(HAVE_READDIR_R) && defined(_REENTRANT)
   int name_max = pathconf (buf, _PC_NAME_MAX);
   char dbuf[sizeof (struct dirent) + name_max + 1];
   while (readdir_r (dir, (struct dirent *) dbuf, &d) == 0 && d != NULL)
Index: java/util/
--- java/util/	(revision 113941)
+++ java/util/	(working copy)
@@ -54,7 +54,7 @@
   struct tm tim;
+#if !defined(HAVE_LOCALTIME_R) || !defined(_REENTRANT)
   struct tm *lt_tim;
 #ifdef HAVE_TM_ZONE
@@ -66,7 +66,7 @@
   char *tzid;
+#if defined(HAVE_LOCALTIME_R) && defined(_REENTRANT)
   localtime_r(&current_time, &tim);
   /* Fall back on non-thread safe localtime. */

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