Re: CVS tip compiler error with --enable-thread-safety

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: shridhar(at)frodo(dot)hserus(dot)net
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: CVS tip compiler error with --enable-thread-safety
Date: 2004-05-30 14:07:37
Message-ID: 200405301407.i4UE7bJ03989@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Shridhar Daithankar wrote:
> Hi,
>
> Platform Slackware linux 9.1/ Linux 2.6.4
>
> I did a make distclean and ./configure --enable-thread-safety. The build
> aborted with following error messages
>
> make[4]: Leaving directory `/home/shridhar/postgresql/pgsql/src/port'
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations
> -DFRONTEND -I../../../src/interfaces/libpq -I../../../src/include
> -D_GNU_SOURCE -c -o initdb.o initdb.c
> rm -f exec.c && ln -s ../../../src/port/exec.c .
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations
> -DFRONTEND -I../../../src/interfaces/libpq -I../../../src/include
> -D_GNU_SOURCE -c -o exec.o exec.c
> gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations
> initdb.o exec.o -L../../../src/interfaces/libpq -lpq -L../../../src/port
> -Wl,-rpath,/usr/local/pgsql/lib -lz -lreadline -ltermcap -lcrypt -lresolv
> -lnsl -ldl -lm -lpgport -o initdb
> ../../../src/interfaces/libpq/libpq.so: undefined reference to
> `pthread_getspecific'
> ../../../src/interfaces/libpq/libpq.so: undefined reference to `pthread_once'
> ../../../src/interfaces/libpq/libpq.so: undefined reference to
> `pthread_key_create'
> ../../../src/interfaces/libpq/libpq.so: undefined reference to
> `pthread_setspecific'
> collect2: ld returned 1 exit status
> make[3]: *** [initdb] Error 1
> make[3]: Leaving directory `/home/shridhar/postgresql/pgsql/src/bin/initdb'
>
> The relevant configure messages read
> -------------
> checking whether pthreads work without any flags... no
> checking whether pthreads work with -Kthread... no
> checking whether pthreads work with -kthread... no
> checking for the pthreads library -llthread... no
> checking whether pthreads work with -pthread... yes
> -------------
>
> Here is relevant portion of src/Makefile.global
>
> -------------
> PTHREAD_CFLAGS = -pthread -D_REENTRANT -D_THREAD_SAFE
> -D_POSIX_PTHREAD_SEMANTICS
> PTHREAD_LIBS =
> LIBS = -lz -lreadline -ltermcap -lcrypt -lresolv -lnsl -ldl -lm
> -------------
>
> It worked after I manually added -lpthread to LIBS and did a make clean;make

OK, I have applied the following patch which should fix it. Turns out I
wasn't using the thread libs as part of library creation.

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073

Attachment Content-Type Size
unknown_filename text/plain 768 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2004-05-30 15:32:26 Re: v3 protocol & string encoding
Previous Message Shridhar Daithankar 2004-05-30 13:38:08 CVS tip compiler error with --enable-thread-safety