Issue 14 - Problems with pthread detection under HPUX 11.0
Summary: Problems with pthread detection under HPUX 11.0
Status: VERIFIED FIXED
Alias: None
Product: OpenLDAP
Classification: Unclassified
Component: build (show other issues)
Version: unspecified
Hardware: All All
: --- normal
Target Milestone: ---
Assignee: OpenLDAP project
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 1998-12-21 21:41 UTC by josh@ican.net
Modified: 2014-08-01 21:05 UTC (History)
0 users

See Also:


Attachments
conf.patch (1.32 KB, text/plain)
1998-12-30 16:03 UTC, josh@ican.net
Details

Note You need to log in before you can comment on or make changes to this issue.
Description josh@ican.net 1998-12-21 21:41:31 UTC
Full_Name: Josh Tiefenbach
Version: head of CVS tree as of 12/21/98
OS: HP-UX 11.00
URL: ftp://ftp.openldap.org/incoming/
Submission from: (NULL) (204.92.55.157)


The configure script does not correctly recognize the existance of the pthread
libraries under HPUX 11.00. To use the pthread libraries, one must

#include <pthread.h>

in the program, and then link with -lpthread.

The problem is that configure, when executing the AC_CHECK_LIB macro, does not
include the pthread.h header file. This is required to avoid undefined symbol
link
errors. 

(There is an additional problem in that the test program

#include <pthread.h>
main () {
 pthread_create();
}

horks complaining about incorrect parameter usage, but it at least links)

Interestingly enough, one does *not* need to include pthread.h in a test
program
when checking to see if pthread_join exists in -lpthread (as opposed to
pthread_create)
. Thus, the DEC Threads check would work, execpt it also tries linking with
-lexc

If I could wrap my brain about the cruft which is autoconf, I may be able to
generate
some patches, but I figured this would serve as a heads-up for those people who
actually know this stuff.
Comment 1 Kurt Zeilenga 1998-12-21 22:17:13 UTC
At 09:41 PM 12/21/98 GMT, josh@ican.net wrote:
>The configure script does not correctly recognize the existance of the
pthread
>libraries under HPUX 11.00. To use the pthread libraries, one must
>
>#include <pthread.h>
>
>in the program, and then link with -lpthread.
>
>The problem is that configure, when executing the AC_CHECK_LIB macro, does
not
>include the pthread.h header file. This is required to avoid undefined symbol
>link
>errors. 

Which symbols were undefined?  Can you provide the config.log fragment for
the failed test?

Kurt
Comment 2 josh@ican.net 1998-12-21 22:27:25 UTC
> >The problem is that configure, when executing the AC_CHECK_LIB macro, does
> not
> >include the pthread.h header file. This is required to avoid undefined symbol
> >link
> >errors. 
> 
> Which symbols were undefined?  Can you provide the config.log fragment for
> the failed test?

pthread_create was undefined. To wit:

----8<-----
configure:3678: checking for pthread_create in -lpthread
configure:3697: cc -o conftest -g   conftest.c -lpthread  -lV3  1>&5
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (conftest.o) was
dete
cted. The linked output may not run on a PA 1.x system.
/usr/ccs/bin/ld: Unsatisfied symbols:
   pthread_create (code)
configure: failed program was:
#line 3686 "configure"
#include "confdefs.h"
/* Override any gcc2 internal prototype to avoid an error.  */
/* We use char because int might match the return type of a gcc2
    builtin and then its argument prototype would still apply.  */
char pthread_create();

int main() {
pthread_create()
; return 0; }

----8<-----

I have a patch which works for me at:

http://home.ican.net/~josh/ldap/configure.in.diff

josh

-- 
Josh Tiefenbach - Member - ACC Corps of Internet Engineers - josh@ican.net
Comment 3 Kurt Zeilenga 1998-12-21 22:41:37 UTC
moved from Incoming to Build
Comment 4 josh@ican.net 1998-12-21 22:48:40 UTC
On Mon, Dec 21, 1998 at 05:27:25PM -0500, Josh Tiefenbach wrote:
> > >The problem is that configure, when executing the AC_CHECK_LIB macro, does
> > not
> > >include the pthread.h header file. This is required to avoid undefined symbol
> > >link
> > >errors. 

Upon further review, it would appear that the same problem torpedo's the
checks for the pthread_attr_init function. I'm not entirely sure how to solve
the general problem tho - can you specify an include file to be checked when
using AC_CHECK_FUNC or AC_CHECK_LIB?

(config.log scrap)
configure:4053: checking for pthread_attr_init
configure:4081: cc -o conftest -g   conftest.c  -lpthread -lV3  1>&5
/usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (conftest.o) was
detected. The linked output may not run on a PA 1.x system.
/usr/ccs/bin/ld: Unsatisfied symbols:
   pthread_attr_init (code)

josh

-- 
Josh Tiefenbach - Member - ACC Corps of Internet Engineers - josh@ican.net
Comment 5 Kurt Zeilenga 1998-12-24 19:50:54 UTC
One possible solution is to do it all in one HPUX 11 test.   Basically,
modify your pthread_create test such that it fails under anything but
HPUX 11.  (replace the test as appropriate)
	#ifndef HP_UX_11
		chokeme /* This test only passes under HPUX 11 */
	#endif

Then,  if this test passes, define the appropriate $ac_cv_, $ol_ variables.

Something like (I'm just winging this...) :

if test $ol_link_threads = no ; then
   dnl use try_link to deal with HP stuff
   save_LIBS="$LIBS"
   LIBS="$LIBS -lpthread"
   AC_MSG_CHECKING([for pthread_create() in HP-UX -lpthread])
   ol_try_pthread_hp_ux_11=no
   AC_CACHE_VAL(ol_cv_pthread_hp_ux_11,[
      AC_TRY_LINK([#include <pthread.h>
#ifndef HP_UX_11_SPECIFIC_DEFINE
	choke me!  /* this only passes under HP-UX 11 */
#endif
	  ], [pthread_create(NULL,NULL,NULL,NULL);],
		ol_try_pthread_hp_ux_11=yes
                ol_cv_pthread_hp_ux_11=yes,
		ol_cv_pthread_hp_ux_11=no)))
   AC_MSG_RESULT(yes)
   LIBS="$save_LIBS"

   if test $ol_cv_pthread_hp_ux_11=yes ; then
	LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"
   	if test $ol_try_pthread_hp_ux_11 = yes ; then
		dnl some tests below may fail because pthread.h must be included
		dnl for now, force results we need.
		ac_cv_func_pthread_attr_init=yes
	fi
   fi
fi

Josh Tiefenbach wrote:
> 
> On Mon, Dec 21, 1998 at 05:27:25PM -0500, Josh Tiefenbach wrote:
> > > >The problem is that configure, when executing the AC_CHECK_LIB macro, does
> > > not
> > > >include the pthread.h header file. This is required to avoid undefined symbol
> > > >link
> > > >errors.
> 
> Upon further review, it would appear that the same problem torpedo's the
> checks for the pthread_attr_init function. I'm not entirely sure how to solve
> the general problem tho - can you specify an include file to be checked when
> using AC_CHECK_FUNC or AC_CHECK_LIB?
> 
> (config.log scrap)
> configure:4053: checking for pthread_attr_init
> configure:4081: cc -o conftest -g   conftest.c  -lpthread -lV3  1>&5
> /usr/ccs/bin/ld: (Warning) At least one PA 2.0 object file (conftest.o) was
> detected. The linked output may not run on a PA 1.x system.
> /usr/ccs/bin/ld: Unsatisfied symbols:
>    pthread_attr_init (code)
> 
> josh
> 
> --
> Josh Tiefenbach - Member - ACC Corps of Internet Engineers - josh@ican.net
Comment 6 Kurt Zeilenga 1998-12-29 21:33:19 UTC
changed notes
changed state Open to Feedback
Comment 7 josh@ican.net 1998-12-30 16:03:47 UTC
Try the attached patch. I've tested it under the HPUX 11 boxes I have. A quick
run on one of my remaining 10.20 boxes shows that this bit of code never gets
excercised.

That isnt so much of a hardship as 10.20 had horribly broken DCE threads
anyways. The only situation I can think of in which this patch might get
confused/fail to work is with HPUX 10.30 machines. 10.30 had usable threads,
but since we got rid of our 10.30 machines some time ago, I cant work up an
appropriate test.

Again, I dont really forsee this to be a big issue. 10.30 wasnt in general
release - it was only available if customers complained loudly enough. HP
strongly encourages everyone to go straight to 11.00 these days.

josh


-- 
Josh Tiefenbach - Member - ACC Corps of Internet Engineers - josh@ican.net
Comment 8 Kurt Zeilenga 1998-12-30 17:51:02 UTC
I noticed a couple of minor errors with your patch.
	* elf.h include is directive doesn't start in column one (1).
	* ol_link_threads=posix should be set when $ol_cv_pthread_hpux_11
	  is yes (instead of when $ol_try_pthread_hpux_11 is yes).

I've also moved the patch to after most of the normal tests as I rather
favor generalized tests over platform specific tests.

Can you very this work on your box?

Kurt
Comment 9 Kurt Zeilenga 1998-12-30 17:54:02 UTC
Forgot to attach the patch...


Index: configure.in
===================================================================
RCS file: /repo/OpenLDAP/pkg/ldap/configure.in,v
retrieving revision 1.68
diff -u -r1.68 configure.in
--- configure.in	1998/12/28 19:08:17	1.68
+++ configure.in	1998/12/30 17:42:19
@@ -480,6 +480,37 @@
 			LIBS="$save_LIBS"
 		fi
 
+		dnl HP-UX 11 check
+		if test $ol_link_threads = no; then
+			save_LIBS="$LIBS"
+			LIBS="$LIBS -lpthread"
+			AC_MSG_CHECKING([for pthread_create() in HP-UX -lpthread])
+			ol_try_pthread_hpux_11=no
+			AC_CACHE_VAL(ol_cv_pthread_hpux_11,[
+				AC_TRY_LINK([
+#include <pthread.h>
+#include <elf.h>
+#ifndef ELFABI_HPUX_REL11
+	die horribly
+#endif
+				], [pthread_create(NULL, NULL, NULL, NULL);],
+					ol_try_pthread_hpux_11=yes
+					ol_cv_pthread_hpux_11=yes,
+					ol_cv_pthread_hpux_11=no)])
+			AC_MSG_RESULT(yes)
+			LIBS="$save_LIBS"
+
+			if test $ol_cv_pthread_hpux_11=yes ; then
+				ol_link_threads=posix
+				LTHREAD_LIBS="$LTHREAD_LIBS -lpthread"
+				if test $ol_try_pthread_hpux_11=yes ; then
+					dnl Some tests below may fail, cause we aint including
+					dnl pthread.h. Force appropriate ones to yes
+					ac_cv_func_pthread_attr_init=yes
+				fi
+			fi
+		fi
+
 		if test $ol_link_threads = no ; then
 			dnl try -lc_r
 			save_LIBS="$LIBS"
Comment 10 josh@ican.net 1998-12-30 18:37:17 UTC
On Wed, Dec 30, 1998 at 09:54:02AM -0800, Kurt D. Zeilenga wrote:
> 
> Forgot to attach the patch...

This patch appears to work perfectly on my HPUX 11 boxes.

thanks.

josh

-- 
Josh Tiefenbach - Member - ACC Corps of Internet Engineers - josh@ican.net
Comment 11 Kurt Zeilenga 1998-12-31 17:05:17 UTC
changed notes
changed state Feedback to Release
Comment 12 Kurt Zeilenga 1998-12-31 20:29:18 UTC
changed notes
changed state Release to Closed
Comment 13 OpenLDAP project 2014-08-01 21:05:07 UTC
Released with 1.1.2.