Re: postgreSQL-8.0.1 configure --enable-thread-safety with - Mailing list pgsql-hackers
From | Bruce Momjian |
---|---|
Subject | Re: postgreSQL-8.0.1 configure --enable-thread-safety with |
Date | |
Msg-id | 200503090428.j294SKr10366@candle.pha.pa.us Whole thread Raw |
In response to | postgreSQL-8.0.1 configure --enable-thread-safety with icc-8.1 on RHEL-AS3 Itanium-2 gives error (Vikram Kalsi <vikramkalsi@gmail.com>) |
Responses |
Re: postgreSQL-8.0.1 configure --enable-thread-safety with
Re: postgreSQL-8.0.1 configure --enable-thread-safety with icc-8.1 on RHEL-AS3 Itanium-2 gives error |
List | pgsql-hackers |
The Intel compiler complains about global variables that are not marked either static or extern. They are "remarks" so I think you are OK with that. The attached patch should remove the warnings but I am not applying it because a non-static/extern global variable should be fine in C code. The larger problem is that we are not picking up the proper thread flags for the Intel C compiler. Any idea what they are? Please try compiling in src/tools/thread manually to get the flags working and report back. It isn't find the thread library functions like pthread_join. --------------------------------------------------------------------------- Vikram Kalsi wrote: > Hi, > > I am trying to build postgresql-8.0.1 with icc-8.1.028 on a Linux > RHEL AS3 SMP Itanium2 machine and I get an error as follows when I run > configure --enable-thread-safety as follows- > > ------------------------------------------------------------------------------------------------------------------------------------ > shell>export CC=icc > shell>export CFLAGS="-static -fPIC" > shell>export LDFLAGS="-L/opt/intel_cc_80/lib" > shell>export CPPFLAGS="-I/opt/intel_cc_80/include" > > shell>configure --prefix=$MY_HOME/dbms/pgsql --enable-thread-safety > --disable-shared --with-low-memory --with-pgport=5410 > ...... > ...... > ...... > configure:18836: icc -o conftest -static -fPIC -Wall > -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement > -Wold-style-definition -Wendif-labels -fno-strict-aliasing > -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEMANTICS -DIN_CONFIGURE > -D_GNU_SOURCE -L/opt/intel_cc_80/lib conftest.c -lz -lreadline > -ltermcap -lcrypt -lresolv -lnsl -ldl -lm -lbsd >&5 > > ./src/tools/thread/thread_test.c(75): remark #1418: external > definition with no prior declaration > char *temp_filename_1; > ^ > > ./src/tools/thread/thread_test.c(76): remark #1418: external > definition with no prior declaration > char *temp_filename_2; > ^ > > ./src/tools/thread/thread_test.c(78): remark #1418: external > definition with no prior declaration > pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER; > ^ > > ./src/tools/thread/thread_test.c(80): remark #1418: external > definition with no prior declaration > volatile int thread1_done = 0; > ^ > > ./src/tools/thread/thread_test.c(81): remark #1418: external > definition with no prior declaration > volatile int thread2_done = 0; > ^ > > ./src/tools/thread/thread_test.c(83): remark #1418: external > definition with no prior declaration > volatile int errno1_set = 0; > ^ > > ./src/tools/thread/thread_test.c(84): remark #1418: external > definition with no prior declaration > volatile int errno2_set = 0; > ^ > > ./src/tools/thread/thread_test.c(105): remark #1418: external > definition with no prior declaration > bool platform_is_threadsafe = true; > ^ > > /tmp/iccQ3B36U.o(.text+0x1d2): In function `main': > : undefined reference to `pthread_mutex_lock' > /tmp/iccQ3B36U.o(.text+0x202): In function `main': > : undefined reference to `pthread_create' > /tmp/iccQ3B36U.o(.text+0x232): In function `main': > : undefined reference to `pthread_create' > /tmp/iccQ3B36U.o(.text+0x2e2): In function `main': > : undefined reference to `pthread_mutex_unlock' > /tmp/iccQ3B36U.o(.text+0x302): In function `main': > : undefined reference to `pthread_join' > /tmp/iccQ3B36U.o(.text+0x322): In function `main': > : undefined reference to `pthread_join' > /tmp/iccQ3B36U.o(.text+0x602): In function `func_call_1': > : undefined reference to `pthread_mutex_lock' > /tmp/iccQ3B36U.o(.text+0x612): In function `func_call_1': > : undefined reference to `pthread_mutex_unlock' > /tmp/iccQ3B36U.o(.text+0x872): In function `func_call_2': > : undefined reference to `pthread_mutex_lock' > /tmp/iccQ3B36U.o(.text+0x882): In function `func_call_2': > : undefined reference to `pthread_mutex_unlock' > configure:18839: $? = 1 > configure: program exited with status 1 > configure: failed program was: > #line 18830 "configure" > #include "confdefs.h" > #include "./src/tools/thread/thread_test.c" > configure:18853: result: no > configure:18863: error: > *** Thread test program failed. Your platform is not thread-safe. > *** Check the file 'config.log'for the exact reason. > *** > *** You can use the configure option --enable-thread-safety-force > *** to force threads to be enabled. However, you must then run > *** the program in src/tools/thread and add locking function calls > *** to your applications to guarantee thread safety. > ------------------------------------------------------------------------------------------------------------------------------------ > The complete log is online at http://www.cse.psu.edu/~kalsi/files2/config.log > > The same works when I use gcc(3.2.3) and configure also works with > icc-8.1 if I dont use --enable-thread-safety! > > Can anybody see if I am doing it wrong? Any suggestions for resolving > this error? > > Thanks, > -Vikram > > ---------------------------(end of broadcast)--------------------------- > TIP 6: Have you searched our list archives? > > http://archives.postgresql.org > -- 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 Index: src/tools/thread/thread_test.c =================================================================== RCS file: /cvsroot/pgsql/src/tools/thread/thread_test.c,v retrieving revision 1.36 diff -c -c -r1.36 thread_test.c *** src/tools/thread/thread_test.c 31 Dec 2004 22:04:02 -0000 1.36 --- src/tools/thread/thread_test.c 9 Mar 2005 04:19:09 -0000 *************** *** 66,108 **** /* This must be down here because this is the code that uses threads. */ #include <pthread.h> ! void func_call_1(void); ! void func_call_2(void); #define TEMP_FILENAME_1 "/tmp/thread_test.1.XXXXXX" #define TEMP_FILENAME_2 "/tmp/thread_test.2.XXXXXX" ! char *temp_filename_1; ! char *temp_filename_2; ! pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER; ! volatile int thread1_done = 0; ! volatile int thread2_done = 0; ! volatile int errno1_set = 0; ! volatile int errno2_set = 0; #ifndef HAVE_STRERROR_R ! char *strerror_p1; ! char *strerror_p2; ! bool strerror_threadsafe = false; #endif #ifndef HAVE_GETPWUID_R ! struct passwd *passwd_p1; ! struct passwd *passwd_p2; ! bool getpwuid_threadsafe = false; #endif #if !defined(HAVE_GETADDRINFO) && !defined(HAVE_GETHOSTBYNAME_R) ! struct hostent *hostent_p1; ! struct hostent *hostent_p2; ! char myhostname[MAXHOSTNAMELEN]; ! bool gethostbyname_threadsafe = false; #endif ! bool platform_is_threadsafe = true; int main(int argc, char *argv[]) --- 66,108 ---- /* This must be down here because this is the code that uses threads. */ #include <pthread.h> ! static void func_call_1(void); ! static void func_call_2(void); #define TEMP_FILENAME_1 "/tmp/thread_test.1.XXXXXX" #define TEMP_FILENAME_2 "/tmp/thread_test.2.XXXXXX" ! static char *temp_filename_1; ! static char *temp_filename_2; ! static pthread_mutex_t init_mutex = PTHREAD_MUTEX_INITIALIZER; ! static volatile int thread1_done = 0; ! static volatile int thread2_done = 0; ! static volatile int errno1_set = 0; ! static volatile int errno2_set = 0; #ifndef HAVE_STRERROR_R ! static char *strerror_p1; ! static char *strerror_p2; ! static bool strerror_threadsafe = false; #endif #ifndef HAVE_GETPWUID_R ! static struct passwd *passwd_p1; ! static struct passwd *passwd_p2; ! static bool getpwuid_threadsafe = false; #endif #if !defined(HAVE_GETADDRINFO) && !defined(HAVE_GETHOSTBYNAME_R) ! static struct hostent *hostent_p1; ! static struct hostent *hostent_p2; ! static char myhostname[MAXHOSTNAMELEN]; ! static bool gethostbyname_threadsafe = false; #endif ! static bool platform_is_threadsafe = true; int main(int argc, char *argv[]) *************** *** 230,236 **** } } ! void func_call_1(void) { #if !defined(HAVE_GETPWUID_R) || \ --- 230,236 ---- } } ! static void func_call_1(void) { #if !defined(HAVE_GETPWUID_R) || \ *************** *** 301,307 **** } ! void func_call_2(void) { #if !defined(HAVE_GETPWUID_R) || \ --- 301,307 ---- } ! static void func_call_2(void) { #if !defined(HAVE_GETPWUID_R) || \
pgsql-hackers by date: