Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use
--On Friday, March 19, 2004 09:18:03 -0600 Larry Rosenman <[EMAIL PROTECTED]> wrote: --On Friday, March 19, 2004 10:15:56 -0500 Bruce Momjian <[EMAIL PROTECTED]> wrote: [moved to -patches because of the patch] --On Friday, March 19, 2004 08:01:53 -0500 Bruce Momjian <[EMAIL PROTECTED]> wrote: > Larry Rosenman wrote: >> > I thought that once you include libpthread in libpq, that you don't >> > have to mention it again then you use libpq. Is your platform >> > different somehow in this regard? >> > >> > I seem to remember this problem with libcrypt and libpq. Is this >> > the same problem? >> > >> > I see that initdb is just the first of many /bin programs to be >> > compiled, so if we have to add the thread lib, we will have to do >> > it for all the bin programs. Yikes. Why wasn't this a problem for >> > 7.4? >> 7.4 had initdb as a Shell Script. >> the 7.4.x libpq didn't have any pthread_* references in it, that I >> see on my box. > > Ah, yes. We added the thread-local storage to handle SIGPIPE. The > problem is that initdb isn't the only place. If you comment out > initdb from the Makefile in src/bin, does the next make fail too? I > bet it does. Apparently, because of the way the wrappers work, having -lpthread on libpq.so does NOT add it to the NEEDED list. I made the following patch, and all compiles now: Yes, I was afraid of that. Is there any way to make it work? If not, evey libpq program you create will need -lpthread added. I think we need to mention if you --enable-thread-safety you MUST use -lpthread on UnixWare, at least. I don't know about other platforms. I'll ask the compiler guys, but I suspect we're going to have to do it this way. From the Compiler Guys: The a.out (not any library) should be linked with -Kpthread (not -lpthread). This will force libthread to be linked in the right order relative to libc, libC, networking libraries, etc. In other words, the entire application either is or is not linked with threads; it's not a property of an individual library. SO, IF we are using the threads flags, we need to use them on ALL libpq-using programs, ours or the users. Not surprising. LER -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED] US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 pgp0.pgp Description: PGP signature
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use
Larry Rosenman <[EMAIL PROTECTED]> writes: > In other words, the entire application either is or is not linked with > threads; it's not a property of an individual library. > SO, IF we are using the threads flags, we need to use them on ALL=20 > libpq-using programs, ours or the users. Yeek. This is an example of the sort of thing that makes people want to build two versions of every library. I'm not excited about doing that (at least not unless it pops up on more platforms). It seems that what we have to do for Unixware is add -Kpthread to LDFLAGS; is that correct? regards, tom lane ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use
Tom Lane wrote: > Larry Rosenman <[EMAIL PROTECTED]> writes: > > In other words, the entire application either is or is not linked with > > threads; it's not a property of an individual library. > > > SO, IF we are using the threads flags, we need to use them on ALL=20 > > libpq-using programs, ours or the users. > > Yeek. This is an example of the sort of thing that makes people want to > build two versions of every library. > > I'm not excited about doing that (at least not unless it pops up on more > platforms). It seems that what we have to do for Unixware is add > -Kpthread to LDFLAGS; is that correct? I am attaching a new bin/Makefile that should fix it. The new code is: # this platform needs the thread compiler flag for all binaries # to override libc ifeq ($(PORTNAME), unixware) CPPFLAGS += "$THREAD_CPPFLAGS" endif Larry, does this fix it? -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 #- # # Makefile for src/bin (client programs) # # Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group # Portions Copyright (c) 1994, Regents of the University of California # # $PostgreSQL: pgsql-server/src/bin/Makefile,v 1.41 2003/12/17 18:44:08 petere Exp $ # #- subdir = src/bin top_builddir = ../.. include $(top_builddir)/src/Makefile.global DIRS := initdb initlocation ipcclean pg_ctl pg_dump \ psql scripts pg_config pg_controldata pg_resetxlog \ pg_encoding # this platforms needs the thread compiler flag for all binaries to override libc ifeq ($(PORTNAME), unixware) CPPFLAGS += "$THREAD_CPPFLAGS" endif ifeq ($(with_tcl), yes) DIRS += pgtclsh endif all install installdirs uninstall depend distprep: @for dir in $(DIRS); do $(MAKE) -C $$dir $@ || exit; done clean distclean maintainer-clean: [EMAIL PROTECTED] dir in $(DIRS); do $(MAKE) -C $$dir $@; done ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www.postgresql.org/docs/faqs/FAQ.html
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use
Bruce Momjian wrote: > Tom Lane wrote: > > Larry Rosenman <[EMAIL PROTECTED]> writes: > > > In other words, the entire application either is or is not linked with > > > threads; it's not a property of an individual library. > > > > > SO, IF we are using the threads flags, we need to use them on ALL=20 > > > libpq-using programs, ours or the users. > > > > Yeek. This is an example of the sort of thing that makes people want to > > build two versions of every library. > > > > I'm not excited about doing that (at least not unless it pops up on more > > platforms). It seems that what we have to do for Unixware is add > > -Kpthread to LDFLAGS; is that correct? > > I am attaching a new bin/Makefile that should fix it. The new code is: > Sorry, here is the right patch. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 Index: src/bin/Makefile === RCS file: /cvsroot/pgsql-server/src/bin/Makefile,v retrieving revision 1.41 diff -c -c -r1.41 Makefile *** src/bin/Makefile17 Dec 2003 18:44:08 - 1.41 --- src/bin/Makefile19 Mar 2004 16:52:54 - *** *** 17,22 --- 17,27 psql scripts pg_config pg_controldata pg_resetxlog \ pg_encoding + # this platforms needs the thread compiler flag for all binaries to override libc + ifeq ($(PORTNAME), unixware) + CPPFLAGS += $(THREAD_CPPFLAGS) + endif + ifeq ($(with_tcl), yes) DIRS += pgtclsh endif ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use
Bruce Momjian <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> It seems that what we have to do for Unixware is add >> -Kpthread to LDFLAGS; is that correct? > Unusually, this platform doesn't have a THREAD_LIBS setting, only > THREAD_CPPFLAGS. so I have to use that. If Larry quoted the Compiler Guys correctly, then that is *wrong*, and we should put -Kpthread into THREAD_LIBS. regards, tom lane ---(end of broadcast)--- TIP 2: you can get off all lists at once with the unregister command (send "unregister YourEmailAddressHere" to [EMAIL PROTECTED])
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use
Tom Lane wrote: > Bruce Momjian <[EMAIL PROTECTED]> writes: > > Tom Lane wrote: > >> It seems that what we have to do for Unixware is add > >> -Kpthread to LDFLAGS; is that correct? > > > Unusually, this platform doesn't have a THREAD_LIBS setting, only > > THREAD_CPPFLAGS. so I have to use that. > > If Larry quoted the Compiler Guys correctly, then that is *wrong*, > and we should put -Kpthread into THREAD_LIBS. Yes, his patch ended up adding this to THREAD_LIBS, but template/unixware has: For gcc: THREAD_CPPFLAGS="-pthread" and for non-gcc: THREAD_CPPFLAGS="-K pthread" Larry, are these wrong? -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 ---(end of broadcast)--- TIP 8: explain analyze is your friend
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use
Larry Rosenman wrote: > > Yes, his patch ended up adding this to THREAD_LIBS, but > > template/unixware has: > > > > For gcc: > > > > THREAD_CPPFLAGS="-pthread" > > > > and for non-gcc: > > > > THREAD_CPPFLAGS="-K pthread" > > > > Larry, are these wrong? > Nope, those work, and should be passed to any libpq-using programs > link step if --enable-thread-safety is used. But they currently CPPFLAGS. They should be lib flags. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use
On Fri, 19 Mar 2004, Bruce Momjian wrote: > Tom Lane wrote: > > Bruce Momjian <[EMAIL PROTECTED]> writes: > > > Tom Lane wrote: > > >> It seems that what we have to do for Unixware is add > > >> -Kpthread to LDFLAGS; is that correct? > > > > > Unusually, this platform doesn't have a THREAD_LIBS setting, only > > > THREAD_CPPFLAGS. so I have to use that. > > > > If Larry quoted the Compiler Guys correctly, then that is *wrong*, > > and we should put -Kpthread into THREAD_LIBS. > > Yes, his patch ended up adding this to THREAD_LIBS, but > template/unixware has: > > For gcc: > > THREAD_CPPFLAGS="-pthread" > > and for non-gcc: > > THREAD_CPPFLAGS="-K pthread" > > Larry, are these wrong? Nope, those work, and should be passed to any libpq-using programs link step if --enable-thread-safety is used. -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED] US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 ---(end of broadcast)--- TIP 7: don't forget to increase your free space map settings
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use
On Fri, 19 Mar 2004, Bruce Momjian wrote: > Larry Rosenman wrote: > > > Yes, his patch ended up adding this to THREAD_LIBS, but > > > template/unixware has: > > > > > > For gcc: > > > > > > THREAD_CPPFLAGS="-pthread" > > > > > > and for non-gcc: > > > > > > THREAD_CPPFLAGS="-K pthread" > > > > > > Larry, are these wrong? > > > > Nope, those work, and should be passed to any libpq-using programs > > link step if --enable-thread-safety is used. > > But they currently CPPFLAGS. They should be lib flags. > > they need to be passed to BOTH compiles and Links. -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: [EMAIL PROTECTED] US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use threads
[moved to -patches because of the patch] --On Friday, March 19, 2004 08:01:53 -0500 Bruce Momjian <[EMAIL PROTECTED]> wrote: Larry Rosenman wrote: > I thought that once you include libpthread in libpq, that you don't > have to mention it again then you use libpq. Is your platform > different somehow in this regard? > > I seem to remember this problem with libcrypt and libpq. Is this the > same problem? > > I see that initdb is just the first of many /bin programs to be > compiled, so if we have to add the thread lib, we will have to do it > for all the bin programs. Yikes. Why wasn't this a problem for 7.4? 7.4 had initdb as a Shell Script. the 7.4.x libpq didn't have any pthread_* references in it, that I see on my box. Ah, yes. We added the thread-local storage to handle SIGPIPE. The problem is that initdb isn't the only place. If you comment out initdb from the Makefile in src/bin, does the next make fail too? I bet it does. Apparently, because of the way the wrappers work, having -lpthread on libpq.so does NOT add it to the NEEDED list. I made the following patch, and all compiles now: Index: src/bin/initdb/Makefile === RCS file: /projects/cvsroot/pgsql-server/src/bin/initdb/Makefile,v retrieving revision 1.35 diff -u -r1.35 Makefile --- src/bin/initdb/Makefile 23 Dec 2003 21:56:20 - 1.35 +++ src/bin/initdb/Makefile 19 Mar 2004 13:35:19 - @@ -20,7 +20,7 @@ all: submake-libpq submake-libpgport initdb initdb: $(OBJS) $(libpq_builddir)/libpq.a - $(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@ + $(CC) $(CFLAGS) $(OBJS) $(libpq) $(LDFLAGS) $(LIBS) $(THREAD_LIBS) -o $@ install: all installdirs $(INSTALL_PROGRAM) initdb$(X) $(DESTDIR)$(bindir)/initdb$(X) Index: src/bin/pg_dump/Makefile === RCS file: /projects/cvsroot/pgsql-server/src/bin/pg_dump/Makefile,v retrieving revision 1.44 diff -u -r1.44 Makefile --- src/bin/pg_dump/Makefile 7 Feb 2004 07:20:12 - 1.44 +++ src/bin/pg_dump/Makefile 19 Mar 2004 13:35:19 - @@ -25,13 +25,13 @@ all: submake-libpq submake-libpgport submake-backend pg_dump pg_restore pg_dumpall pg_dump: pg_dump.o common.o pg_dump_sort.o $(OBJS) $(libpq_builddir)/libpq.a - $(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@ + $(CC) $(CFLAGS) pg_dump.o common.o pg_dump_sort.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) $(THREAD_LIBS) -o $@ pg_restore: pg_restore.o $(OBJS) $(libpq_builddir)/libpq.a - $(CC) $(CFLAGS) pg_restore.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@ + $(CC) $(CFLAGS) pg_restore.o $(OBJS) $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) $(THREAD_LIBS) -o $@ pg_dumpall: pg_dumpall.o dumputils.o $(libpq_builddir)/libpq.a - $(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) -o $@ + $(CC) $(CFLAGS) pg_dumpall.o dumputils.o $(EXTRA_OBJS) $(libpq) $(LDFLAGS) $(LIBS) $(THREAD_LIBS) -o $@ .PHONY: submake-backend submake-backend: Index: src/bin/pg_encoding/Makefile === RCS file: /projects/cvsroot/pgsql-server/src/bin/pg_encoding/Makefile,v retrieving revision 1.16 diff -u -r1.16 Makefile --- src/bin/pg_encoding/Makefile29 Nov 2003 19:52:05 - 1.16 +++ src/bin/pg_encoding/Makefile19 Mar 2004 13:35:19 - @@ -17,7 +17,7 @@ all: submake-libpq submake-libpgport pg_encoding pg_encoding: $(OBJS) - $(CC) $(CFLAGS) $^ $(libpq) $(LDFLAGS) $(LIBS) -o $@ + $(CC) $(CFLAGS) $^ $(libpq) $(LDFLAGS) $(LIBS) $(THREAD_LIBS) -o $@ install: all installdirs $(INSTALL_PROGRAM) pg_encoding$(X) $(DESTDIR)$(bindir)/pg_encoding$(X) Index: src/bin/pgtclsh/Makefile === RCS file: /projects/cvsroot/pgsql-server/src/bin/pgtclsh/Makefile,v retrieving revision 1.43 diff -u -r1.43 Makefile --- src/bin/pgtclsh/Makefile19 Dec 2003 11:54:25 - 1.43 +++ src/bin/pgtclsh/Makefile19 Mar 2004 13:35:20 - @@ -33,10 +33,10 @@ all: submake $(PROGRAMS) pgtclsh: pgtclAppInit.o - $(CC) $(CFLAGS) $^ $(libpgtcl) $(libpq) $(TCL_LIB_SPEC) $(TCL_LIBS) $(LDFLAGS) $(LIBS) -o $@ + $(CC) $(CFLAGS) $^ $(libpgtcl) $(libpq) $(TCL_LIB_SPEC) $(TCL_LIBS) $(LDFLAGS) $(LIBS) $(THREAD_LIBS) -o $@ pgtksh: pgtkAppInit.o - $(CC) $(CFLAGS) $^ $(libpgtcl) $(libpq) $(TK_LIB_SPEC) $(TK_LIBS) $(TCL_LIB_SPEC) $(LDFLAGS) $(LIBS) -o $@ + $(CC) $(CFLAGS) $^ $(libpgtcl) $(libpq) $(TK_LIB_SPEC) $(TK_LIBS) $(TCL_LIB_SPEC) $(LDFLAGS) $(LIBS) $(THREAD_LIBS) -o $@ .PHONY: submake submake: Index: src/bin/psql/Makefile === RCS file: /projects/cvsroot/pgsql-server/src/bin/psql/Makefile,v retrieving revision 1.40 diff -u -r1.40 Makefile --- src/bin/psql/Makefile 9 Mar 2004 19:47:05 - 1.40 +++ src/bi
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use threads
> [moved to -patches because of the patch] > > > --On Friday, March 19, 2004 08:01:53 -0500 Bruce Momjian > <[EMAIL PROTECTED]> wrote: > > > Larry Rosenman wrote: > >> > I thought that once you include libpthread in libpq, that you don't > >> > have to mention it again then you use libpq. Is your platform > >> > different somehow in this regard? > >> > > >> > I seem to remember this problem with libcrypt and libpq. Is this the > >> > same problem? > >> > > >> > I see that initdb is just the first of many /bin programs to be > >> > compiled, so if we have to add the thread lib, we will have to do it > >> > for all the bin programs. Yikes. Why wasn't this a problem for 7.4? > >> 7.4 had initdb as a Shell Script. > >> the 7.4.x libpq didn't have any pthread_* references in it, that I see > >> on my box. > > > > Ah, yes. We added the thread-local storage to handle SIGPIPE. The > > problem is that initdb isn't the only place. If you comment out initdb > > from the Makefile in src/bin, does the next make fail too? I bet it > > does. > > Apparently, because of the way the wrappers work, having -lpthread on > libpq.so does NOT add it to the NEEDED list. > > I made the following patch, and all compiles now: Yes, I was afraid of that. Is there any way to make it work? If not, evey libpq program you create will need -lpthread added. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use threads
Larry Rosenman wrote: > > I'll ask the compiler guys, but I suspect we're going to have to do it > > this way. > > > From the Compiler Guys: > > The a.out (not any library) should be linked with -Kpthread (not > -lpthread). > This will force libthread to be linked in the right order relative to > libc, libC, networking libraries, etc. > > In other words, the entire application either is or is not linked with > threads; it's not a property of an individual library. > > > SO, IF we are using the threads flags, we need to use them on ALL > libpq-using programs, ours or the users. > > Not surprising. Is this problem with just the native compiler, or gcc too? Are enough other platforms going to have this problem or do I make a platform-specific hack for this? -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]
Re: [PATCHES] [HACKERS] UnixWare/CVS Tip/initdb.c needs to use threads
Larry Rosenman wrote: -- Start of PGP signed section. > [moved to -patches because of the patch] > > > --On Friday, March 19, 2004 08:01:53 -0500 Bruce Momjian > <[EMAIL PROTECTED]> wrote: > > > Larry Rosenman wrote: > >> > I thought that once you include libpthread in libpq, that you don't > >> > have to mention it again then you use libpq. Is your platform > >> > different somehow in this regard? > >> > > >> > I seem to remember this problem with libcrypt and libpq. Is this the > >> > same problem? > >> > > >> > I see that initdb is just the first of many /bin programs to be > >> > compiled, so if we have to add the thread lib, we will have to do it > >> > for all the bin programs. Yikes. Why wasn't this a problem for 7.4? > >> 7.4 had initdb as a Shell Script. > >> the 7.4.x libpq didn't have any pthread_* references in it, that I see > >> on my box. > > > > Ah, yes. We added the thread-local storage to handle SIGPIPE. The > > problem is that initdb isn't the only place. If you comment out initdb > > from the Makefile in src/bin, does the next make fail too? I bet it > > does. > > Apparently, because of the way the wrappers work, having -lpthread on > libpq.so does NOT add it to the NEEDED list. Clarification. The flags are "-pthread" or "-K pthread", not -lpthread, which is clearly a linker flag. -- Bruce Momjian| http://candle.pha.pa.us [EMAIL PROTECTED] | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup.| Newtown Square, Pennsylvania 19073 ---(end of broadcast)--- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match