[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: threading troubles on OSF Alpha v3.2 (ITS#89)



With a little help, OpenLDAP now builds and configures on Alpha.
The concurrency test fails though.

"A little help" means that I need
	CC=cc LIBS=-threads ./configure

(-threads must be the last command line option to cc.)

A bare `CC=cc ./configure' does not find the -threads option, even
though there seems to be a -threads test in it.  Without -threads,
configure falls back on -lpthreads and fails, so what I said about this
"Solaris bug" applies to Alpha as well:

   From: Hallvard B Furuseth <h.b.furuseth@usit.uio.no>
   Date: Sun, 21 Feb 1999 11:27:17 +0100 (MET)
   Message-Id: <HBF.990221rsn8@bombur.uio.no>
   To: "Kurt D. Zeilenga" <Kurt@OpenLDAP.org>
   Cc: openldap-bugs@OpenLDAP.org
   Subject: Re: configure fails with threads again
   
   Kurt D. Zeilenga writes:
   >  pthread_create() doesn't work as expected.
   > 
   >>configure: error: pthread.h and pthread_create are not compatible
   >  give up, environment is inconsistent.
   > 
   > I consider this is vendor bug.  Sun should provide a consistent
   > environment.
   
   Consistent?  The have provided a thread package and manual pages on how
   to use it (with -mt).  It's not their fault that configure tries to use
   it in an undocumented way.
   
   Still, the configure test would have worked if it used all the options
   which configure itself has found that other programs need.  That is,
   -D_REENTRANT ... -lpthread in this case.


On OSF1 Alpha 3.2, `-threads' could be replaced with
   -D_REENTRANT ... -lpthreads -lmach -lexc -lc_r
but not with what configures does:
   -D_REENTRANT ... -lpthreads

Of course if configure chooses gcc, it does need all the options above.


Anyway, I suggest the error message

   configure: error: pthread.h and pthread_create are not compatible

is replaced with something like

   configure: error: pthread_create failed, probably you need to specify
                     threading options to cc by hand.  See `man cc'.


typescript and config.log are enclosed, in case you want configure to
find `-threads'.



$ ./configure
creating cache ./config.cache
checking for a BSD compatible install... build/install-sh -c
checking whether build environment is sane... yes
checking whether make sets ${MAKE}... yes
checking for working aclocal... missing
checking for working autoconf... missing
checking for working automake... missing
checking for working autoheader... missing
checking for working makeinfo... missing
checking configure arguments... done
checking host system type... alpha-dec-osf3.2
checking for a BSD compatible install... build/install-sh -c
checking for ranlib... ranlib
checking for gcc... no
checking for cc... /usr/ccs/bin/cc 
checking whether the C compiler (/usr/ccs/bin/cc   ) works... yes
checking whether the C compiler (/usr/ccs/bin/cc   ) is a cross-compiler... no
checking whether we are using GNU C... no
checking whether /usr/ccs/bin/cc  accepts -g... yes
checking for non-GNU ld... /usr/ucb/ld
checking if the linker (/usr/ucb/ld) is GNU ld... no
checking for BSD-compatible nm... /usr/ucb/nm -B
checking whether ln -s works... yes
checking whether we are using GNU C... no
checking for /usr/ccs/bin/cc option to produce PIC... none
checking if /usr/ccs/bin/cc static flag -non_shared works... -non_shared
checking if the linker (/usr/ucb/ld) is GNU ld... no
checking whether the linker (/usr/ucb/ld) supports shared libraries... yes
checking command to parse /usr/ucb/nm -B output... yes
checking how to hardcode library paths into programs... immediate
checking for /usr/ucb/ld option to reload object files... -r
checking dynamic linker characteristics... osf3.2 ld.so
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for objdir... .libs
creating libtool
checking for mawk... no
checking for gawk... gawk
checking whether ln -s works... (cached) yes
checking for sendmail... /usr/lib/sendmail
checking for vi... /usr/ucb/vi
checking for finger... /usr/ucb/finger
checking how to run the C preprocessor... /usr/ccs/bin/cc  -E
checking for AIX... no
checking for POSIXized ISC... no
checking for minix/config.h... no
checking for Cygwin environment... no
checking for mingw32 environment... no
checking for executable suffix... no
checking for object suffix... o
checking for /usr/ccs/bin/cc  option to accept ANSI C... none needed
checking for socket... yes
checking for res_search... yes
checking for sigset in -lV3... no
checking for kerberosIV/krb.h... no
checking for kerberosIV/des.h... no
checking for krb.h... no
checking for des.h... no
checking for ssl.h... no
checking for pthread.h... yes
checking for sched.h... yes
checking POSIX thread version... draft4
checking for LinuxThreads... no
checking for pthread_create... no
checking for pthread_create with -kthread... no
checking for pthread_create with -pthread... no
checking for pthread_create with -pthreads... no
checking for pthread_create with -thread... no
checking for pthread_create with -mt... (cached) no
checking for pthread_mutex_unlock in -lpthread... no
checking for pthread_mutex_lock in -lpthread... no
checking for pthread_mutex_trylock in -lpthread... no
checking for pthread_create in -lpthread... no
checking for pthread_create in -lc_r... no
checking for pthread_create in -lpthreads... yes
checking for sched_yield... no
checking for pthread_yield... yes
checking for pthread_kill... no
checking for pthread_detach with <pthread.h>... yes
checking for pthread_setconcurrency... no
checking for pthread_getconcurrency... no
checking for thr_setconcurrency... no
checking for thr_getconcurrency... no
checking if pthread_create() works... no
configure: error: pthread.h and pthread_create are not compatible



$ cat config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

configure:633: checking for a BSD compatible install
configure:686: checking whether build environment is sane
configure:743: checking whether make sets ${MAKE}
configure:782: checking for working aclocal
configure:795: checking for working autoconf
configure:808: checking for working automake
configure:821: checking for working autoheader
configure:834: checking for working makeinfo
configure:850: checking configure arguments
configure:1672: checking host system type
configure:1735: checking for a BSD compatible install
configure:1792: checking for ranlib
configure:1822: checking for gcc
configure:1852: checking for cc
configure:1935: checking whether the C compiler (/usr/ccs/bin/cc   ) works
configure:1951: /usr/ccs/bin/cc  -o conftest    conftest.c  1>&5
configure:1977: checking whether the C compiler (/usr/ccs/bin/cc   ) is a cross-compiler
configure:1982: checking whether we are using GNU C
configure:1991: /usr/ccs/bin/cc  -E conftest.c
configure:2010: checking whether /usr/ccs/bin/cc  accepts -g
configure:2075: checking for non-GNU ld
configure:2111: checking if the linker (/usr/ucb/ld) is GNU ld
configure:2127: checking for BSD-compatible nm
configure:2164: checking whether ln -s works
configure:2236: checking for mawk
configure:2236: checking for gawk
configure:2266: checking whether ln -s works
configure:2290: checking for sendmail
configure:2326: checking for vi
configure:2362: checking for finger
configure:2443: checking how to run the C preprocessor
configure:2464: /usr/ccs/bin/cc  -E  conftest.c >/dev/null 2>conftest.out
configure:2536: checking for AIX
configure:2560: checking for POSIXized ISC
configure:2582: checking for minix/config.h
configure:2592: /usr/ccs/bin/cc  -E  conftest.c >/dev/null 2>conftest.out
/usr/lib/cmplrs/cc/cfe: Error: configure: 2588: Cannot open file minix/config.h for #include
configure: failed program was:
#line 2587 "configure"
#include "confdefs.h"
#include <minix/config.h>
configure:2631: checking for Cygwin environment
configure:2647: /usr/ccs/bin/cc  -c -g  conftest.c 1>&5
/usr/lib/cmplrs/cc/cfe: Error: configure, line 2643: '__CYGWIN32__' undefined, reoccurrences will not be reported
 return __CYGWIN32__;
 -------^
configure: failed program was:
#line 2636 "configure"
#include "confdefs.h"

int main() {

#ifndef __CYGWIN__
#define __CYGWIN__ __CYGWIN32__
#endif
return __CYGWIN__;
; return 0; }
configure:2664: checking for mingw32 environment
configure:2676: /usr/ccs/bin/cc  -c -g  conftest.c 1>&5
/usr/lib/cmplrs/cc/cfe: Error: configure, line 2672: '__MINGW32__' undefined, reoccurrences will not be reported
 return __MINGW32__;
 -------^
configure: failed program was:
#line 2669 "configure"
#include "confdefs.h"

int main() {
return __MINGW32__;
; return 0; }
configure:2695: checking for executable suffix
configure:2705: /usr/ccs/bin/cc  -o conftest -g   conftest.c  1>&5
configure:2726: checking for object suffix
configure:2732: /usr/ccs/bin/cc  -c -g  conftest.c 1>&5
configure:2754: checking for /usr/ccs/bin/cc  option to accept ANSI C
configure:2807: /usr/ccs/bin/cc   -c -g  conftest.c 1>&5
configure:2838: checking for socket
configure:2866: /usr/ccs/bin/cc  -o conftest -g   conftest.c  1>&5
configure:3153: checking for res_search
configure:3181: /usr/ccs/bin/cc  -o conftest -g   conftest.c  1>&5
configure:3316: checking for sigset in -lV3
configure:3335: /usr/ccs/bin/cc  -o conftest -g   conftest.c -lV3   1>&5
ld:
Can't locate file for: -lV3
configure: failed program was:
#line 3324 "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 sigset();

int main() {
sigset()
; return 0; }
configure:3589: checking for kerberosIV/krb.h
configure:3599: /usr/ccs/bin/cc  -E  conftest.c >/dev/null 2>conftest.out
/usr/lib/cmplrs/cc/cfe: Error: configure: 3595: Cannot open file kerberosIV/krb.h for #include
configure: failed program was:
#line 3594 "configure"
#include "confdefs.h"
#include <kerberosIV/krb.h>
configure:3589: checking for kerberosIV/des.h
configure:3599: /usr/ccs/bin/cc  -E  conftest.c >/dev/null 2>conftest.out
/usr/lib/cmplrs/cc/cfe: Error: configure: 3595: Cannot open file kerberosIV/des.h for #include
configure: failed program was:
#line 3594 "configure"
#include "confdefs.h"
#include <kerberosIV/des.h>
configure:3728: checking for krb.h
configure:3738: /usr/ccs/bin/cc  -E  conftest.c >/dev/null 2>conftest.out
/usr/lib/cmplrs/cc/cfe: Error: configure: 3734: Cannot open file krb.h for #include
configure: failed program was:
#line 3733 "configure"
#include "confdefs.h"
#include <krb.h>
configure:3728: checking for des.h
configure:3738: /usr/ccs/bin/cc  -E  conftest.c >/dev/null 2>conftest.out
/usr/lib/cmplrs/cc/cfe: Error: configure: 3734: Cannot open file des.h for #include
configure: failed program was:
#line 3733 "configure"
#include "confdefs.h"
#include <des.h>
configure:3827: checking for ssl.h
configure:3837: /usr/ccs/bin/cc  -E  conftest.c >/dev/null 2>conftest.out
/usr/lib/cmplrs/cc/cfe: Error: configure: 3833: Cannot open file ssl.h for #include
configure: failed program was:
#line 3832 "configure"
#include "confdefs.h"
#include <ssl.h>
configure:3986: checking for pthread.h
configure:3996: /usr/ccs/bin/cc  -E  conftest.c >/dev/null 2>conftest.out
configure:3986: checking for sched.h
configure:3996: /usr/ccs/bin/cc  -E  conftest.c >/dev/null 2>conftest.out
configure:4025: checking POSIX thread version
configure:4106: checking for LinuxThreads
configure:4132: checking for pthread_create
configure:4160: /usr/ccs/bin/cc  -o conftest -g   conftest.c  1>&5
ld:
Unresolved:
pthread_create
configure: failed program was:
#line 4137 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char pthread_create(); below.  */
#include <assert.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() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_pthread_create) || defined (__stub___pthread_create)
choke me
#else
pthread_create();
#endif

; return 0; }
configure:4182: checking for pthread_create with -kthread
configure:4203: /usr/ccs/bin/cc  -o conftest -g   conftest.c -kthread  1>&5
ld:
Unresolved:
pthread_attr_default
pthread_create
configure: failed program was:
#line 4190 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {

#if HAVE_PTHREADS_D4
	pthread_create(NULL,pthread_attr_default,NULL,NULL);
#else
	pthread_create(NULL,NULL,NULL,NULL);
#endif

; return 0; }
configure:4227: checking for pthread_create with -pthread
configure:4248: /usr/ccs/bin/cc  -o conftest -g   conftest.c -pthread  1>&5
ld:
Unknown flag: -pthread
ld: Usage: ld [options] file [...]
configure: failed program was:
#line 4235 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {

#if HAVE_PTHREADS_D4
	pthread_create(NULL,pthread_attr_default,NULL,NULL);
#else
	pthread_create(NULL,NULL,NULL,NULL);
#endif

; return 0; }
configure:4272: checking for pthread_create with -pthreads
configure:4293: /usr/ccs/bin/cc  -o conftest -g   conftest.c -pthreads  1>&5
ld:
Unknown flag: -pthreads
ld: Usage: ld [options] file [...]
configure: failed program was:
#line 4280 "configure"
#include "confdefs.h"
#include <pthread.h>
int main() {

#if HAVE_PTHREADS_D4
	pthread_create(NULL,pthread_attr_default,NULL,NULL);
#else
	pthread_create(NULL,NULL,NULL,NULL);
#endif

; return 0; }
configure:4317: checking for pthread_create with -thread
configure:4332: /usr/ccs/bin/cc  -o conftest -g   conftest.c -thread  1>&5
ld:
Unresolved:
pthread_create
configure: failed program was:
#line 4325 "configure"
#include "confdefs.h"
char pthread_create();
int main() {
pthread_create();
; return 0; }
configure:4356: checking for pthread_create with -mt
configure:4396: checking for pthread_mutex_unlock in -lpthread
configure:4415: /usr/ccs/bin/cc  -o conftest -g   conftest.c -lpthread -lmach -lexc -lc_r  1>&5
ld:
Can't locate file for: -lpthread
configure: failed program was:
#line 4404 "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_mutex_unlock();

int main() {
pthread_mutex_unlock()
; return 0; }
configure:4448: checking for pthread_mutex_lock in -lpthread
configure:4467: /usr/ccs/bin/cc  -o conftest -g   conftest.c -lpthread -lmach -lexc  1>&5
ld:
Can't locate file for: -lpthread
configure: failed program was:
#line 4456 "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_mutex_lock();

int main() {
pthread_mutex_lock()
; return 0; }
configure:4500: checking for pthread_mutex_trylock in -lpthread
configure:4519: /usr/ccs/bin/cc  -o conftest -g   conftest.c -lpthread -lexc  1>&5
ld:
Can't locate file for: -lpthread
configure: failed program was:
#line 4508 "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_mutex_trylock();

int main() {
pthread_mutex_trylock()
; return 0; }
configure:4552: checking for pthread_create in -lpthread
configure:4571: /usr/ccs/bin/cc  -o conftest -g   conftest.c -lpthread   1>&5
ld:
Can't locate file for: -lpthread
configure: failed program was:
#line 4560 "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; }
configure:4600: checking for pthread_create in -lc_r
configure:4619: /usr/ccs/bin/cc  -o conftest -g   conftest.c -lc_r   1>&5
ld:
Unresolved:
pthread_create
configure: failed program was:
#line 4608 "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; }
configure:4648: checking for pthread_create in -lpthreads
configure:4667: /usr/ccs/bin/cc  -o conftest -g   conftest.c -lpthreads   1>&5
configure:4952: checking for sched_yield
configure:4980: /usr/ccs/bin/cc  -o conftest -g   conftest.c  -lpthreads  1>&5
ld:
Unresolved:
sched_yield
configure: failed program was:
#line 4957 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char sched_yield(); below.  */
#include <assert.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 sched_yield();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_sched_yield) || defined (__stub___sched_yield)
choke me
#else
sched_yield();
#endif

; return 0; }
configure:4952: checking for pthread_yield
configure:4980: /usr/ccs/bin/cc  -o conftest -g   conftest.c  -lpthreads  1>&5
configure:5121: checking for pthread_kill
configure:5149: /usr/ccs/bin/cc  -o conftest -g   conftest.c  -lpthreads  1>&5
ld:
Unresolved:
pthread_kill
configure: failed program was:
#line 5126 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char pthread_kill(); below.  */
#include <assert.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_kill();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_pthread_kill) || defined (__stub___pthread_kill)
choke me
#else
pthread_kill();
#endif

; return 0; }
configure:5175: checking for pthread_detach with <pthread.h>
configure:5188: /usr/ccs/bin/cc  -o conftest -g   conftest.c  -lpthreads  1>&5
configure:5220: checking for pthread_setconcurrency
configure:5248: /usr/ccs/bin/cc  -o conftest -g   conftest.c  -lpthreads  1>&5
ld:
Unresolved:
pthread_setconcurrency
configure: failed program was:
#line 5225 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char pthread_setconcurrency(); below.  */
#include <assert.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_setconcurrency();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_pthread_setconcurrency) || defined (__stub___pthread_setconcurrency)
choke me
#else
pthread_setconcurrency();
#endif

; return 0; }
configure:5220: checking for pthread_getconcurrency
configure:5248: /usr/ccs/bin/cc  -o conftest -g   conftest.c  -lpthreads  1>&5
ld:
Unresolved:
pthread_getconcurrency
configure: failed program was:
#line 5225 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char pthread_getconcurrency(); below.  */
#include <assert.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_getconcurrency();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_pthread_getconcurrency) || defined (__stub___pthread_getconcurrency)
choke me
#else
pthread_getconcurrency();
#endif

; return 0; }
configure:5220: checking for thr_setconcurrency
configure:5248: /usr/ccs/bin/cc  -o conftest -g   conftest.c  -lpthreads  1>&5
ld:
Unresolved:
thr_setconcurrency
configure: failed program was:
#line 5225 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char thr_setconcurrency(); below.  */
#include <assert.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 thr_setconcurrency();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_thr_setconcurrency) || defined (__stub___thr_setconcurrency)
choke me
#else
thr_setconcurrency();
#endif

; return 0; }
configure:5220: checking for thr_getconcurrency
configure:5248: /usr/ccs/bin/cc  -o conftest -g   conftest.c  -lpthreads  1>&5
ld:
Unresolved:
thr_getconcurrency
configure: failed program was:
#line 5225 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char thr_getconcurrency(); below.  */
#include <assert.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 thr_getconcurrency();

int main() {

/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_thr_getconcurrency) || defined (__stub___thr_getconcurrency)
choke me
#else
thr_getconcurrency();
#endif

; return 0; }
configure:5274: checking if pthread_create() works
configure:5310: /usr/ccs/bin/cc  -o conftest -g   conftest.c  -lpthreads  1>&5
configure: failed program was:
#line 5283 "configure"
#include "confdefs.h"

#include <pthread.h>
#ifndef NULL
#define NULL (void*)0
#endif

static void *task(p)
	void *p;
{
	return (void *) (p == NULL);
}

int main(argc, argv)
	int argc;
	char **argv;
{
	pthread_t t;
#if HAVE_PTHREADS_D4
	exit(pthread_create(&t, pthread_attr_default, task, NULL));
#else
	exit(pthread_create(&t, NULL, task, NULL));
#endif
}

-- 
Hallvard