Обсуждение: CVS tip compiler error with --enable-thread-safety

Поиск
Список
Период
Сортировка

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

От
Shridhar Daithankar
Дата:
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

RegardsShridhar


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

От
Bruce Momjian
Дата:
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@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
? pg_config_paths.h
? _xlk
Index: Makefile
===================================================================
RCS file: /cvsroot/pgsql-server/src/port/Makefile,v
retrieving revision 1.14
diff -c -c -r1.14 Makefile
*** Makefile    25 May 2004 01:00:30 -0000    1.14
--- Makefile    30 May 2004 14:06:29 -0000
***************
*** 16,25 ****
  include $(top_builddir)/src/Makefile.global

  override CPPFLAGS := -I$(top_builddir)/src/port $(CPPFLAGS)

- ifdef LIBOBJS
  all: libpgport.a
- endif

  libpgport.a: $(LIBOBJS)
      $(AR) $(AROPT) $@ $^
--- 16,24 ----
  include $(top_builddir)/src/Makefile.global

  override CPPFLAGS := -I$(top_builddir)/src/port $(CPPFLAGS)
+ LIBS += $(PTHREAD_LIBS)

  all: libpgport.a

  libpgport.a: $(LIBOBJS)
      $(AR) $(AROPT) $@ $^

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

От
Shridhar Daithankar
Дата:
On Sunday 30 May 2004 19:37, Bruce Momjian wrote:
> > 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.

I updated anoncvs, the patch in src/port/Makefile is there but initdb still 
fails to compile.

I suspect this is because in Makefile.global PTHREAD_LIBS is still blank. I 
need to add -lpthread these to get stuff working. However I could not figure 
out what create PTHREAD_LIBS in Makefile.global.

Is there something else I should try?
Shridhar


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

От
Bruce Momjian
Дата:
Shridhar Daithankar wrote:
> On Sunday 30 May 2004 19:37, Bruce Momjian wrote:
> > > 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.
> 
> I updated anoncvs, the patch in src/port/Makefile is there but initdb still 
> fails to compile.
> 
> I suspect this is because in Makefile.global PTHREAD_LIBS is still blank. I 
> need to add -lpthread these to get stuff working. However I could not figure 
> out what create PTHREAD_LIBS in Makefile.global.

Well, that certainly is strange.  Config.log should show checks for a
variety of thread flags, and it should add any ones that your compiler
supports.  I would look in there for a cause or email me the whole file
offlist.

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