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

Re: Is OpenLDAP on OSX?



I just tied the 2.0.11 release an noticed that there were issues with the
configure script. The first problem I get is that it thinks that pthreads
is not available on the platform. A little playing around revealed that
you can compile a program that depend on pthreads without passing any
necessary options. The attached piece of code ( thisfile.c ) compiles as
is. After hacking configure to assume pthreads for Darwin I run
configure again and then I get:

checking if pthread_create() works... no
configure: error: pthread_create is not usable, check environment settings


Referring back to the example I see that 'pthread_create' is used, so again
another test that fails under Darwin. I am not familiar enough with the
configure files to spend all day hacking them, so I will leave the task
for another day.

Now, if I run configure without threads '--without-threads', configure
completes without any problems and I even manage to do a make depend.
Then when I try compiling I run into a few problems:

...
cc -dynamiclib -undefined suppress -o .libs/libldap_r.dylib threads.lo rdwr.lo tpool.lo thr_posix.lo thr_cthreads.lo thr_thr.lo thr_lwp.lo thr_nt.lo thr_pth.lo thr_stub.lo extended.lo bind.lo controls.lo open.lo result.lo error.lo compare.lo search.lo modify.lo add.lo modrdn.lo delete.
lo abandon.lo ufn.lo cache.lo cyrus.lo getfilter.lo sasl.lo sbind.lo kbind.
lo unbind.lo friendly.lo free.lo disptmpl.lo srchpref.lo dsparse.lo tmplout.lo sort.lo getdn.lo getentry.lo getattr.lo getvalues.lo addentry.lo request.lo os-ip.lo url.lo sortctrl.lo vlvctrl.lo init.lo options.lo print.lo string.lo util-int.lo schema.lo charray.lo tls.lo dn.lo os-local.lo dnssrv.lo utf-8.lo version.lo -L/UnStuffed/openldap-2.0.
11/libraries -lc
ld: common symbols not allowed with MH_DYLIB output format
util-int.lo definition of common _ldap_int_resolv_mutex (size 4)
/usr/bin/libtool: internal link edit command failed
make[2]: *** [libldap_r.la] Error 1
make[1]: *** [all-common] Error 1
make: *** [all-common] Error 1


I will look into the problem a bit more when I get time. Until then I hope
this can help someone with a bit more time.

Andre

File thisfile.c :
---start
/* cc thisfile.c */
#define _REENTRANT    /* basic 3-lines for threads */
#include <pthread.h>

#define NUM_THREADS 5
#define SLEEP_TIME 10
void *sleeping(void *);   /* thread routine */
int i;
pthread_t tid[NUM_THREADS];      /* array of thread IDs */

int main(int argc, char *argv[])
{
       for ( i = 0; i < NUM_THREADS; i++)
            pthread_create(&tid[i], NULL, sleeping,
                           (void *)SLEEP_TIME);
            for ( i = 0; i < NUM_THREADS; i++)
                pthread_join(tid[i], NULL);
        printf("main() reporting that all %d threads have terminated\n", i)
;
        return (0);
}  /* main */

void * sleeping(void *arg)
{
int sleep_time = (int)arg;
printf("thread %d sleeping %d seconds ...\n", pthread_self(), sleep_time);
sleep(sleep_time);
printf("\nthread %d awakening\n", pthread_self());
return (NULL);
}


---end