coreconf has some USE_PTHREADS related code that comes from the old days when NSPR had multiple implementations on Unix. Today NSPR has only one implementation on all major Unix platforms. Therefore the USE_PTHREADS code should be removed, or we should always set USE_PTHREADS=1. On HP-UX, the problem is more serious than on Solaris (bug 361076). I found that even though coreconf sets USE_PTHREADS=1 by default on HP-UX B.11.*, coreconf tests USE_PTHREADS before setting it. An example is coreconf/HP-UXB.11.11.mk: ifdef USE_PTHREADS OS_CFLAGS += -D_POSIX_C_SOURCE=199506L endif # # Config stuff for HP-UXB.11.11. # include $(CORE_DEPTH)/coreconf/HP-UXB.11.mk But USE_PTHREADS is set in HP-UX.mk, which is included by HP-UXB.11.mk. So to correctly add the -D_POSIX_C_SOURCE=199506L flag to the compiler command line, we must set USE_PTHREADS=1 on HP-UX. Without the -D_POSIX_C_SOURCE=199506L flag, the binaries appear to work just fine, but I found that the value of 'errno' is incorrect sometimes. The easiest fix is to move the code ifdef USE_PTHREADS OS_CFLAGS += -D_POSIX_C_SOURCE=199506L endif to HP-UXB.11.mk, after the following statement: include $(CORE_DEPTH)/coreconf/HP-UX.mk or just add -D_POSIX_C_SOURCE=199506L to the end of this statement in HP-UXB.11.mk: OS_CFLAGS += $(ARCHFLAG) -DHPUX11 because HP-UXB.11.mk already adds -lpthread to OS_LIBS unconditionally.
Christophe, make sure your SVbuild init files for HP-UX have USE_PTHREADS=1 in $Targets.
Created attachment 247782 [details] [diff] [review] Proposed patch I decided to simply add -D_POSIX_C_SOURCE=199506L to OS_CFLAGS in HP-UXB.11.mk, without ifdef USE_PTHREADS, because HP-UXB.11.mk already adds -lpthread to OS_LIBS unconditionally. I also deleted some commented-out code.
I checked in the patch on the NSS trunk (NSS 3.12). Checking in HP-UXB.11.00.mk; /cvsroot/mozilla/security/coreconf/HP-UXB.11.00.mk,v <-- HP-UXB.11.00.mk new revision: 1.3; previous revision: 1.2 done Checking in HP-UXB.11.11.mk; /cvsroot/mozilla/security/coreconf/HP-UXB.11.11.mk,v <-- HP-UXB.11.11.mk new revision: 1.3; previous revision: 1.2 done Checking in HP-UXB.11.20.mk; /cvsroot/mozilla/security/coreconf/HP-UXB.11.20.mk,v <-- HP-UXB.11.20.mk new revision: 1.4; previous revision: 1.3 done Checking in HP-UXB.11.22.mk; /cvsroot/mozilla/security/coreconf/HP-UXB.11.22.mk,v <-- HP-UXB.11.22.mk new revision: 1.3; previous revision: 1.2 done Checking in HP-UXB.11.23.mk; /cvsroot/mozilla/security/coreconf/HP-UXB.11.23.mk,v <-- HP-UXB.11.23.mk new revision: 1.2; previous revision: 1.1 done Checking in HP-UXB.11.mk; /cvsroot/mozilla/security/coreconf/HP-UXB.11.mk,v <-- HP-UXB.11.mk new revision: 1.9; previous revision: 1.8 done
I forgot to remove commented-out code (NSS trunk 3.12). Did that now. Checking in HP-UXB.11.mk; /cvsroot/mozilla/security/coreconf/HP-UXB.11.mk,v <-- HP-UXB.11.mk new revision: 1.10; previous revision: 1.9 done