7.0.2 on Solaris
I'm in the process of fixing build problems in 7.0.2 for Solaris CC
(not GCC).
1. I'm curious why src/template/solaris_sparc_cc contains:
-DDISABLE_COMPLEX_MACRO
src/templates/solaris_i386_cc does not contains this definition.
This breaks the compilation:
gmake[3]: Entering directory
`/opt/build/postgresql-7.0.2/src/interfaces/ecpg/preproc'
cc -o ecpg preproc.o pgc.o type.o ecpg.o ecpg_keywords.o output.o
keywords.o c_keywords.o ../lib/typename.o descriptor.o variable.o
../../../backend/port/snprintf.o -R/opt/TWWfsw/pgsql702/lib
-R/opt/TWWfsw/tcl83/lib -R/opt/TWWfsw/tk83/lib
-R/opt/TWWfsw/readline4/lib -L/opt/TWWfsw/tcl83/lib
-L/opt/TWWfsw/tk83/lib -L/opt/TWWfsw/readline4/lib -lgen -lsocket
-lnsl -ldl -lm -lreadline -ltermcap -lcurses
Undefined first referenced
symbol in file
nocachegetattr pgc.o
The reason for this is because nocachegetattr becomes a function when
DISABLE_COMPLEX_MACRO is defined (nocachegetattr is defined in
src/backend/access/common/heaptuple.c).
The first patch below removes this macro from
src/templates/solaris_sparc_cc.
2. Solaris CC does not like "-K PIC". It does like "-KPIC" though.
3. Why is NAN defined in src/include/solaris_i386.h as:
#define NAN (*(__const double *) __nan)
#endif /* GCC. */
if the compiler is not GCC? The Solaris C compiler does not like this.
I removed it and the compilation succeeded.
4. I moved some of the information out of
src/interfaces/libpq++/Makefile.in into src/Makefile.shlib where it
belongs. Assuming that CXXFLAGS should take on the shared library
flags for CFLAGS_SL is wrong though.
5. added '-' before pl/tcl/Makefile so make does not complain if it
cannot find pl/tcl/Makefile.tcldefs (which will be automatically
generated).
6. When building C++ shared libraries and archives under Solaris with
the Sun C/C++ compiler, use it to build the libraries and archives,
not ld/ar.
7. Honor CXXFLAGS from configure command-line.
8. In configure:
a) It is evil to use a library if it exists:
(AC_CHECK_LIB(util,main))
It is far better to check for a function in the library. Better
yet, make sure that function does not exist in libc or $LIBS
before checking in external libraries. I have fixed this for
some libraries but don't know what to check for in others
(like ipc, IPC, lc, ld, compat, BSD).
b) Added --with-readline=DIR to check for readline in DIR.
--
albert chin (china@thewrittenword.com)
-- snip snip
--- src/template/solaris_sparc_cc.orig Tue Jun 20 19:22:44 2000
+++ src/template/solaris_sparc_cc Tue Jun 27 22:15:44 2000
@@ -1,6 +1,6 @@
AROPT:crs
-CFLAGS:-Xa -v -D__sparc__ -D__sun__ -DDISABLE_COMPLEX_MACRO
-SHARED_LIB:-K PIC
+CFLAGS:-Xa -v -D__sparc__ -D__sun__
+SHARED_LIB:-KPIC
ALL:
SRCH_INC:
SRCH_LIB:
--- src/template/solaris_i386_cc.orig Tue Jun 27 21:36:15 2000
+++ src/template/solaris_i386_cc Tue Jun 27 21:36:19 2000
@@ -1,6 +1,6 @@
AROPT:cq
CFLAGS:
-SHARED_LIB:-K PIC
+SHARED_LIB:-KPIC
ALL:
SRCH_INC:
SRCH_LIB:
--- src/include/port/solaris_i386.h.orig Tue Jun 27 11:53:06 2000
+++ src/include/port/solaris_i386.h Tue Jun 27 11:53:20 2000
@@ -31,8 +31,6 @@
double __d; }) \
{ __nan_bytes }).__d)
-#else /* Not GCC. */
-#define NAN (*(__const double *) __nan)
#endif /* GCC. */
#endif /* NAN */
--- src/interfaces/libpq++/Makefile.in.orig Tue Jun 20 17:55:36 2000
+++ src/interfaces/libpq++/Makefile.in Tue Jun 27 21:27:23 2000
@@ -39,22 +39,11 @@
SHLIB_LINK= $(LIBPQ)
endif
-# For CC on IRIX, must use CC as linker/archiver of C++ libraries
-ifeq ($(PORTNAME), irix5)
- ifeq ($(CXX), CC)
- AR = CC
- AROPT = -ar -o
- LD = CC
- endif
-endif
-
# Shared library stuff, also default 'all' target
include $(SRCDIR)/Makefile.shlib
-
-# Pull shared-lib CFLAGS into CXXFLAGS
+# Pull shared-lib CFLAGS into CXXFLAGS
CXXFLAGS+= $(CFLAGS_SL)
-
.PHONY: examples
examples:
--- src/pl/tcl/Makefile.orig Tue Jun 27 12:53:04 2000
+++ src/pl/tcl/Makefile Tue Jun 27 13:01:55 2000
@@ -19,7 +19,7 @@
# NOTE: GNU make will make this file automatically if it doesn't exist,
# using the make rule that appears below. Cute, eh?
#
-include Makefile.tcldefs
+-include Makefile.tcldefs
#
# Find out whether Tcl was built as a shared library --- if not,
--- src/Makefile.shlib.orig Tue Jun 27 12:22:09 2000
+++ src/Makefile.shlib Tue Jun 27 17:09:30 2000
@@ -130,16 +130,23 @@
ifeq ($(PORTNAME), hpux)
install-shlib-dep := install-shlib
# HPUX doesn't believe in version numbers for shlibs
- shlib := lib$(NAME)$(DLSUFFIX)
+ shlib := lib$(NAME)$(DLSUFFIX)
LDFLAGS_SL := -b
- CFLAGS += $(CFLAGS_SL)
+ CFLAGS += $(CFLAGS_SL)
endif
ifeq ($(PORTNAME), irix5)
- install-shlib-dep := install-shlib
- shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
- LDFLAGS_SL := -shared -rpath $(LIBDIR) -set_version sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
- CFLAGS += $(CFLAGS_SL)
+ install-shlib-dep := install-shlib
+ shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION)
+ LDFLAGS_SL := -shared -rpath $(LIBDIR) -set_version sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
+ CFLAGS += $(CFLAGS_SL)
+
+ # if archiving or linking C++ objects, must use CC (according to CC(1))
+ ifeq ($(CXX), CC)
+ AR = CC
+ AROPT = -ar -o
+ LD = CC
+ endif
endif
ifeq ($(PORTNAME), linux)
@@ -156,7 +163,14 @@
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL := -G
SHLIB_LINK += -ldl -lsocket -lresolv -lnsl -lm -lc
- CFLAGS += $(CFLAGS_SL)
+ CFLAGS += $(CFLAGS_SL)
+
+ # if archiving or linking C++ objects, must use CC (according to CC(1))
+ ifeq ($(CXX), CC)
+ AR := CC
+ AROPT := -xar -o
+ LD := CC
+ endif
endif
ifeq ($(PORTNAME), solaris_sparc)
@@ -164,7 +178,14 @@
shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION)
LDFLAGS_SL := -G
SHLIB_LINK += -ldl -lsocket -lresolv -lnsl -lm -lc
- CFLAGS += $(CFLAGS_SL)
+ CFLAGS += $(CFLAGS_SL)
+
+ # if linking C++ objects, must use CC (according to CC(1))
+ ifeq ($(CXX), CC)
+ AR := CC
+ AROPT := -xar -o
+ LD := CC
+ endif
endif
ifeq ($(PORTNAME), alpha)
--- src/Makefile.global.in.orig Tue Jun 20 17:53:01 2000
+++ src/Makefile.global.in Tue Jun 20 17:53:14 2000
@@ -209,6 +209,7 @@
LEX= @LEX@
AROPT= @AROPT@
CFLAGS= -I$(SRCDIR)/include -I$(SRCDIR)/backend @CPPFLAGS@ @CFLAGS@
+CXXFLAGS= @CXXFLAGS@
CFLAGS_SL= @SHARED_LIB@
PGSQL_INCLUDES= @PGSQL_INCLUDES@
LIBS= @LIBS@
--- src/configure.in.orig Tue Jun 20 17:42:51 2000
+++ src/configure.in Tue Jun 27 16:00:11 2000
@@ -675,24 +675,46 @@
AC_SUBST(YFLAGS)
AC_CHECK_LIB(sfio, main)
-for curses in ncurses curses ; do
- AC_CHECK_LIB(${curses}, main,
- [LIBS="-l${curses} $LIBS"; break])
+
+for termlib in ncurses curses termcap terminfo termlib; do
+ AC_CHECK_LIB(${termlib}, tputs, [LIBS="-l${termlib} $LIBS"; break])
done
-AC_CHECK_LIB(termcap, main)
-AC_CHECK_LIB(readline, main)
-AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE),
- AC_CHECK_LIB(history, main) )
+AC_ARG_WITH(readline,
+[ --with-readline=DIR search DIR for readline includes and libraries],[
+ case "$with_readline" in
+ no) ;;
+ *)
+ if test "$with_readline" != "yes"; then
+ _cppflags=${CPPFLAGS}
+ _ldflags=${LDFLAGS}
+ CPPFLAGS="${CPPFLAGS} -I$with_readline/include"
+ LDFLAGS="${LDFLAGS} -L$with_readline/lib"
+ fi
+
+ AC_CHECK_HEADERS(readline.h readline/history.h readline/readline.h,
+ AC_CHECK_LIB(readline, readline)
+ AC_CHECK_LIB(readline, using_history,
+ AC_DEFINE(HAVE_HISTORY_IN_READLINE),
+ AC_CHECK_LIB(history, add_history)))
+
+ if test -z "$ac_cv_header_readline_h" -a \
+ -z "$ac_cv_header_readline_readline_h"; then
+ if test -n "${_cppflags}"; then
+ CPPFLAGS="${_cppflags}" LDFLAGS="${_ldflags}"
+ fi
+ fi
+ ;;
+ esac])
if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha"
then
AC_CHECK_LIB(bsd, main)
fi
AC_CHECK_LIB(util, main)
-AC_CHECK_LIB(m, main)
-AC_CHECK_LIB(dl, main)
-AC_CHECK_LIB(socket, main)
-AC_CHECK_LIB(nsl, main)
+AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow))
+AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen))
+AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent))
+AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt))
AC_CHECK_LIB(ipc, main)
AC_CHECK_LIB(IPC, main)
AC_CHECK_LIB(lc, main)
@@ -701,7 +723,7 @@
AC_CHECK_LIB(ld, main)
AC_CHECK_LIB(compat, main)
AC_CHECK_LIB(BSD, main)
-AC_CHECK_LIB(crypt, main)
+AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt))
AC_CHECK_LIB(gen, main)
AC_CHECK_LIB(PW, main)
pgsql-hackers@thewrittenword.com writes:
1. I'm curious why src/template/solaris_sparc_cc contains:
-DDISABLE_COMPLEX_MACRO
Presumably because the Solaris Sparc compiler was once broken.
Dunno how long ago that was, but I have no objection to removing
the -D switch if it seems to work on not-too-ancient copies.
How recent is your Solaris?
The reason for this is because nocachegetattr becomes a function when
DISABLE_COMPLEX_MACRO is defined (nocachegetattr is defined in
src/backend/access/common/heaptuple.c).
The first patch below removes this macro from
src/templates/solaris_sparc_cc.
It's broken all right, but that's no fix --- it just masks the problem
on your platform. The breakage is that somebody decided a static
function definition in an include file is a cool idea. Not when the
include file is included by non-backend modules ... the non-macro
definition of fastgetattr() needs to be made a plain extern routine.
3. Why is NAN defined in src/include/solaris_i386.h as:
#define NAN (*(__const double *) __nan)
#endif /* GCC. */
if the compiler is not GCC? The Solaris C compiler does not like this.
I removed it and the compilation succeeded.
Hmm, I think this needs more investigation. Removing a definition of
NAN that's inside "#ifndef NAN" cannot cause things to work unless there
is an order dependency with another definition of NAN. Perhaps we need
to be rearranging header includes or some such. Again, it seems like
the true issue might affect more than just solaris.
4. I moved some of the information out of
src/interfaces/libpq++/Makefile.in into src/Makefile.shlib where it
belongs. Assuming that CXXFLAGS should take on the shared library
flags for CFLAGS_SL is wrong though.
Nope, try again. Your change breaks things for all non-C++ shared libs,
because it changes AR and LD to C++-suitable definitions for *all* shlib
modules not just C++ modules. That might happen to work on your
installation but it's a recipe for trouble. The reason that the C++
info is in src/interfaces/libpq++/Makefile.in is that that's where it
belongs, to avoid messing up non-C++ modules. (If we had more than one
C++ shlib I'd be more excited about figuring out how to keep the info in
Makefile.shlib, but as things stand I think leaving it out is the path
of least resistance.)
b) Added --with-readline=DIR to check for readline in DIR.
What for? We have --with-includes and --with-libs; shall we now
add a custom "--with-libfoo" option for every single library we
depend on? This seems like useless clutter.
Some of the other changes look good but I'm not in a position to
separate them out from the less-good stuff...
regards, tom lane
On Wed, Jun 28, 2000 at 01:56:49AM -0400, Tom Lane wrote:
pgsql-hackers@thewrittenword.com writes:
1. I'm curious why src/template/solaris_sparc_cc contains:
-DDISABLE_COMPLEX_MACROPresumably because the Solaris Sparc compiler was once broken.
Dunno how long ago that was, but I have no objection to removing
the -D switch if it seems to work on not-too-ancient copies.
How recent is your Solaris?
We're runnig 5.0 with the latest set of patches. 6.0 just came out but
we don't have our copy yet.
The reason for this is because nocachegetattr becomes a function when
DISABLE_COMPLEX_MACRO is defined (nocachegetattr is defined in
src/backend/access/common/heaptuple.c).The first patch below removes this macro from
src/templates/solaris_sparc_cc.It's broken all right, but that's no fix --- it just masks the problem
on your platform. The breakage is that somebody decided a static
function definition in an include file is a cool idea. Not when the
include file is included by non-backend modules ... the non-macro
definition of fastgetattr() needs to be made a plain extern routine.
Understood. We took the easy way out. Considering noone else has
reported a problem and that 5.0 has been out for awhile (though I
imagine some people might still be using 4.2), it should be safe to
remove.
3. Why is NAN defined in src/include/solaris_i386.h as:
#define NAN (*(__const double *) __nan)
#endif /* GCC. */
if the compiler is not GCC? The Solaris C compiler does not like this.
I removed it and the compilation succeeded.Hmm, I think this needs more investigation. Removing a definition of
NAN that's inside "#ifndef NAN" cannot cause things to work unless there
is an order dependency with another definition of NAN. Perhaps we need
to be rearranging header includes or some such. Again, it seems like
the true issue might affect more than just solaris.
Note that Solaris/SPARC doesn't have this #ifndef NAN stuff. Why be
specific to Solaris/Intel? Solaris CC does not have __const so if left
in it doesn't compile.
The reason the compile succeeds when the #else section is removed is
because of the following in src/include/utils/timestamp.h:
#ifdef NAN
#define DT_INVALID (NAN)
#else
#define DT_INVALID (DBL_MIN+DBL_MIN)
#endif
So, DBL_MIN+DBL_MIN is used rather than NAN. Dunno if this is a "good
thing". There are other places, like src/backend/utils/adt/numeric.c,
that:
#ifndef NAN
#define NAN (0.0/0.0)
#endif
Again, I don't know if this is a "good thing" (and if NAN is defined
to be this here, why not similarly for src/include/utils/timestamp.h
above?).
4. I moved some of the information out of
src/interfaces/libpq++/Makefile.in into src/Makefile.shlib where it
belongs. Assuming that CXXFLAGS should take on the shared library
flags for CFLAGS_SL is wrong though.Nope, try again. Your change breaks things for all non-C++ shared libs,
because it changes AR and LD to C++-suitable definitions for *all* shlib
modules not just C++ modules. That might happen to work on your
installation but it's a recipe for trouble. The reason that the C++
info is in src/interfaces/libpq++/Makefile.in is that that's where it
belongs, to avoid messing up non-C++ modules. (If we had more than one
C++ shlib I'd be more excited about figuring out how to keep the info in
Makefile.shlib, but as things stand I think leaving it out is the path
of least resistance.)
Ok. I now understand why it was in the Makefile in libpq++. I've
attached a patch to add my Makefile.shlib changes to
src/interfaces/libpq++/Makefile.in.
b) Added --with-readline=DIR to check for readline in DIR.
What for? We have --with-includes and --with-libs; shall we now
add a custom "--with-libfoo" option for every single library we
depend on? This seems like useless clutter.
I think so. Makes it easier when running ./configure to figure out
what extra 3rd-party modules are being used. It also means every
submodule does not necessary have to -L everything in --with-libs
and -I everything in --with-includes. Can you guarantee that this
will always be safe?
regards, tom lane
--
albert chin (china@thewrittenword.com)
-- snip snip
--- src/interfaces/libpq++/Makefile.in.orig Tue Jun 20 17:55:36 2000
+++ src/interfaces/libpq++/Makefile.in Wed Jun 28 08:55:30 2000
@@ -39,22 +39,38 @@
SHLIB_LINK= $(LIBPQ)
endif
-# For CC on IRIX, must use CC as linker/archiver of C++ libraries
ifeq ($(PORTNAME), irix5)
+ # if archiving or linking C++ objects, must use CC (according to CC(1))
ifeq ($(CXX), CC)
- AR = CC
- AROPT = -ar -o
- LD = CC
+ AR := CC
+ AROPT := -ar -o
+ LD := CC
+ endif
+endif
+
+ifeq ($(PORTNAME), solaris_i386)
+ # if archiving or linking C++ objects, must use CC (according to CC(1))
+ ifeq ($(CXX), CC)
+ AR := CC
+ AROPT := -xar -o
+ LD := CC
+ endif
+enfi
+
+ifeq ($(PORTNAME), solaris_sparc)
+ # if linking C++ objects, must use CC (according to CC(1))
+ ifeq ($(CXX), CC)
+ AR := CC
+ AROPT := -xar -o
+ LD := CC
endif
endif
# Shared library stuff, also default 'all' target
include $(SRCDIR)/Makefile.shlib
-
-# Pull shared-lib CFLAGS into CXXFLAGS
+# Pull shared-lib CFLAGS into CXXFLAGS
CXXFLAGS+= $(CFLAGS_SL)
-
.PHONY: examples
examples:
pgsql-hackers@thewrittenword.com writes:
3. Why is NAN defined in src/include/solaris_i386.h as:
We probably need a real configure test for this.
5. added '-' before pl/tcl/Makefile so make does not complain if it
cannot find pl/tcl/Makefile.tcldefs (which will be automatically
generated).
Yeah but if the automatic generation fails then it won't include it at
all?
7. Honor CXXFLAGS from configure command-line.
It already does that as far as I can tell. Defining the variable in
Makefile.global instead of libpq++/Makefile doesn't make a difference.
8. In configure:
a) It is evil to use a library if it exists:
(AC_CHECK_LIB(util,main))
It is far better to check for a function in the library.
Amen to that, but unfortunately most of the information about which
function was required from which library is lost in history. Btw., the
proper solution to this is AC_SEARCH_LIBS, not what you wrote.
In general, if you want to contribute changes in this area it might be a
good idea to start from the current sources, because I'm all over that
code at the moment.
--
Peter Eisentraut Sernanders v�g 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden
On Wed, Jun 28, 2000 at 08:38:08PM +0200, Peter Eisentraut wrote:
pgsql-hackers@thewrittenword.com writes:
3. Why is NAN defined in src/include/solaris_i386.h as:
We probably need a real configure test for this.
Probably.
5. added '-' before pl/tcl/Makefile so make does not complain if it
cannot find pl/tcl/Makefile.tcldefs (which will be automatically
generated).Yeah but if the automatic generation fails then it won't include it at
all?
No. But, it will be silent so you won't know. However, you should get
an error if the automatic generation fails.
7. Honor CXXFLAGS from configure command-line.
It already does that as far as I can tell. Defining the variable in
Makefile.global instead of libpq++/Makefile doesn't make a difference.
Ok, thanks.
8. In configure:
a) It is evil to use a library if it exists:
(AC_CHECK_LIB(util,main))
It is far better to check for a function in the library.Amen to that, but unfortunately most of the information about which
function was required from which library is lost in history. Btw., the
proper solution to this is AC_SEARCH_LIBS, not what you wrote.
Just found out about AC_SEARCH_LIBS. Thanks. How about getting rid of
all the AC_CHECK_LIB([library],main) code and adding things back in as
they break?
In general, if you want to contribute changes in this area it might be a
good idea to start from the current sources, because I'm all over that
code at the moment.
Ok. So should I get CVS and reapply my patches?
--
albert chin (china@thewrittenword.com)
On Wed, Jun 28, 2000 at 08:38:08PM +0200, Peter Eisentraut wrote:
pgsql-hackers@thewrittenword.com writes:
8. In configure:
a) It is evil to use a library if it exists:
(AC_CHECK_LIB(util,main))
It is far better to check for a function in the library.Amen to that, but unfortunately most of the information about which
function was required from which library is lost in history. Btw., the
proper solution to this is AC_SEARCH_LIBS, not what you wrote.
AC_SEARCH_LIBS is the correct solution providing you don't need the
feature of AC_CHECK_LIB that defines HAVE_LIB[LIBRARY] and adds
-l[lib] to LIBS.
--
albert chin (china@thewrittenword.com)
pgsql-hackers@thewrittenword.com writes:
Ok. So should I get CVS and reapply my patches?
Well, let's see:
1. -DDISABLE_COMPLEX_MACRO
This clearly needs to be fixed the right way. I'll take care of it.
2. Solaris CC does not like "-K PIC". It does like "-KPIC" though.
Also no problem.
3. NAN
We need a real solution for this. I'll look into it.
4. I moved some of the information out of
src/interfaces/libpq++/Makefile.in into src/Makefile.shlib
I think we don't want that.
5. added '-' before pl/tcl/Makefile so make does not complain
That I can do as well. I confirmed that it works okay.
6. When building C++ shared libraries and archives under Solaris with
the Sun C/C++ compiler, use it to build the libraries and archives,
not ld/ar.
This is similar to the IRIX case apparently, so okay.
7. Honor CXXFLAGS from configure command-line.
Should work fine.
8. (AC_CHECK_LIB(util,main))
I don't think we want to try that now. I happen to know that the -lutil
case was added for setproctitle() so I can change that, but the rest is
just a cosmetics issue, unless you can prove breakage.
--
Peter Eisentraut Sernanders v�g 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden
pgsql-hackers@thewrittenword.com writes:
3. Why is NAN defined in src/include/solaris_i386.h as:
#define NAN (*(__const double *) __nan)
#endif /* GCC. */
if the compiler is not GCC? The Solaris C compiler does not like this.
I removed it and the compilation succeeded.
We never cleared out this item. What is the proper way to generate a `NaN'
on your compiler? Does `0.0/0.0' work?
--
Peter Eisentraut Sernanders v�g 10:115
peter_e@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden
On Sun, Jul 02, 2000 at 05:22:53PM +0200, Peter Eisentraut wrote:
pgsql-hackers@thewrittenword.com writes:
3. Why is NAN defined in src/include/solaris_i386.h as:
#define NAN (*(__const double *) __nan)
#endif /* GCC. */
if the compiler is not GCC? The Solaris C compiler does not like this.
I removed it and the compilation succeeded.We never cleared out this item. What is the proper way to generate a `NaN'
on your compiler? Does `0.0/0.0' work?
I tried the following:
#include <ieeefp.h>
#include <stdio.h>
int
main (void) {
float f = 0.0/0.0;
if (isnanf (f)) {
puts ("nan");
}
}
and the output was "nan".
--
albert chin (china@thewrittenword.com)
I think our source tree has diverged quite a bit from 7.0.2. Could you
grab a snapshot and let me know what needs changing for Solaris?
Thanks.
I'm in the process of fixing build problems in 7.0.2 for Solaris CC
(not GCC).1. I'm curious why src/template/solaris_sparc_cc contains:
-DDISABLE_COMPLEX_MACRO
src/templates/solaris_i386_cc does not contains this definition.This breaks the compilation:
gmake[3]: Entering directory
`/opt/build/postgresql-7.0.2/src/interfaces/ecpg/preproc'
cc -o ecpg preproc.o pgc.o type.o ecpg.o ecpg_keywords.o output.o
keywords.o c_keywords.o ../lib/typename.o descriptor.o variable.o
../../../backend/port/snprintf.o -R/opt/TWWfsw/pgsql702/lib
-R/opt/TWWfsw/tcl83/lib -R/opt/TWWfsw/tk83/lib
-R/opt/TWWfsw/readline4/lib -L/opt/TWWfsw/tcl83/lib
-L/opt/TWWfsw/tk83/lib -L/opt/TWWfsw/readline4/lib -lgen -lsocket
-lnsl -ldl -lm -lreadline -ltermcap -lcurses
Undefined first referenced
symbol in file
nocachegetattr pgc.oThe reason for this is because nocachegetattr becomes a function when
DISABLE_COMPLEX_MACRO is defined (nocachegetattr is defined in
src/backend/access/common/heaptuple.c).The first patch below removes this macro from
src/templates/solaris_sparc_cc.2. Solaris CC does not like "-K PIC". It does like "-KPIC" though.
3. Why is NAN defined in src/include/solaris_i386.h as:
#define NAN (*(__const double *) __nan)
#endif /* GCC. */
if the compiler is not GCC? The Solaris C compiler does not like this.
I removed it and the compilation succeeded.4. I moved some of the information out of
src/interfaces/libpq++/Makefile.in into src/Makefile.shlib where it
belongs. Assuming that CXXFLAGS should take on the shared library
flags for CFLAGS_SL is wrong though.5. added '-' before pl/tcl/Makefile so make does not complain if it
cannot find pl/tcl/Makefile.tcldefs (which will be automatically
generated).6. When building C++ shared libraries and archives under Solaris with
the Sun C/C++ compiler, use it to build the libraries and archives,
not ld/ar.7. Honor CXXFLAGS from configure command-line.
8. In configure:
a) It is evil to use a library if it exists:
(AC_CHECK_LIB(util,main))
It is far better to check for a function in the library. Better
yet, make sure that function does not exist in libc or $LIBS
before checking in external libraries. I have fixed this for
some libraries but don't know what to check for in others
(like ipc, IPC, lc, ld, compat, BSD).
b) Added --with-readline=DIR to check for readline in DIR.--
albert chin (china@thewrittenword.com)-- snip snip --- src/template/solaris_sparc_cc.orig Tue Jun 20 19:22:44 2000 +++ src/template/solaris_sparc_cc Tue Jun 27 22:15:44 2000 @@ -1,6 +1,6 @@ AROPT:crs -CFLAGS:-Xa -v -D__sparc__ -D__sun__ -DDISABLE_COMPLEX_MACRO -SHARED_LIB:-K PIC +CFLAGS:-Xa -v -D__sparc__ -D__sun__ +SHARED_LIB:-KPIC ALL: SRCH_INC: SRCH_LIB: --- src/template/solaris_i386_cc.orig Tue Jun 27 21:36:15 2000 +++ src/template/solaris_i386_cc Tue Jun 27 21:36:19 2000 @@ -1,6 +1,6 @@ AROPT:cq CFLAGS: -SHARED_LIB:-K PIC +SHARED_LIB:-KPIC ALL: SRCH_INC: SRCH_LIB: --- src/include/port/solaris_i386.h.orig Tue Jun 27 11:53:06 2000 +++ src/include/port/solaris_i386.h Tue Jun 27 11:53:20 2000 @@ -31,8 +31,6 @@ double __d; }) \ { __nan_bytes }).__d)-#else /* Not GCC. */
-#define NAN (*(__const double *) __nan)
#endif /* GCC. */
#endif /* NAN */--- src/interfaces/libpq++/Makefile.in.orig Tue Jun 20 17:55:36 2000 +++ src/interfaces/libpq++/Makefile.in Tue Jun 27 21:27:23 2000 @@ -39,22 +39,11 @@ SHLIB_LINK= $(LIBPQ) endif-# For CC on IRIX, must use CC as linker/archiver of C++ libraries
-ifeq ($(PORTNAME), irix5)
- ifeq ($(CXX), CC)
- AR = CC
- AROPT = -ar -o
- LD = CC
- endif
-endif
-
# Shared library stuff, also default 'all' target
include $(SRCDIR)/Makefile.shlib- -# Pull shared-lib CFLAGS into CXXFLAGS +# Pull shared-lib CFLAGS into CXXFLAGS CXXFLAGS+= $(CFLAGS_SL) -.PHONY: examples examples: --- src/pl/tcl/Makefile.orig Tue Jun 27 12:53:04 2000 +++ src/pl/tcl/Makefile Tue Jun 27 13:01:55 2000 @@ -19,7 +19,7 @@ # NOTE: GNU make will make this file automatically if it doesn't exist, # using the make rule that appears below. Cute, eh? # -include Makefile.tcldefs +-include Makefile.tcldefs# # Find out whether Tcl was built as a shared library --- if not, --- src/Makefile.shlib.orig Tue Jun 27 12:22:09 2000 +++ src/Makefile.shlib Tue Jun 27 17:09:30 2000 @@ -130,16 +130,23 @@ ifeq ($(PORTNAME), hpux) install-shlib-dep := install-shlib # HPUX doesn't believe in version numbers for shlibs - shlib := lib$(NAME)$(DLSUFFIX) + shlib := lib$(NAME)$(DLSUFFIX) LDFLAGS_SL := -b - CFLAGS += $(CFLAGS_SL) + CFLAGS += $(CFLAGS_SL) endififeq ($(PORTNAME), irix5) - install-shlib-dep := install-shlib - shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) - LDFLAGS_SL := -shared -rpath $(LIBDIR) -set_version sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) - CFLAGS += $(CFLAGS_SL) + install-shlib-dep := install-shlib + shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION) + LDFLAGS_SL := -shared -rpath $(LIBDIR) -set_version sgi$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) + CFLAGS += $(CFLAGS_SL) + + # if archiving or linking C++ objects, must use CC (according to CC(1)) + ifeq ($(CXX), CC) + AR = CC + AROPT = -ar -o + LD = CC + endif endififeq ($(PORTNAME), linux) @@ -156,7 +163,14 @@ shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) LDFLAGS_SL := -G SHLIB_LINK += -ldl -lsocket -lresolv -lnsl -lm -lc - CFLAGS += $(CFLAGS_SL) + CFLAGS += $(CFLAGS_SL) + + # if archiving or linking C++ objects, must use CC (according to CC(1)) + ifeq ($(CXX), CC) + AR := CC + AROPT := -xar -o + LD := CC + endif endififeq ($(PORTNAME), solaris_sparc) @@ -164,7 +178,14 @@ shlib := lib$(NAME)$(DLSUFFIX).$(SO_MAJOR_VERSION).$(SO_MINOR_VERSION) LDFLAGS_SL := -G SHLIB_LINK += -ldl -lsocket -lresolv -lnsl -lm -lc - CFLAGS += $(CFLAGS_SL) + CFLAGS += $(CFLAGS_SL) + + # if linking C++ objects, must use CC (according to CC(1)) + ifeq ($(CXX), CC) + AR := CC + AROPT := -xar -o + LD := CC + endif endififeq ($(PORTNAME), alpha) --- src/Makefile.global.in.orig Tue Jun 20 17:53:01 2000 +++ src/Makefile.global.in Tue Jun 20 17:53:14 2000 @@ -209,6 +209,7 @@ LEX= @LEX@ AROPT= @AROPT@ CFLAGS= -I$(SRCDIR)/include -I$(SRCDIR)/backend @CPPFLAGS@ @CFLAGS@ +CXXFLAGS= @CXXFLAGS@ CFLAGS_SL= @SHARED_LIB@ PGSQL_INCLUDES= @PGSQL_INCLUDES@ LIBS= @LIBS@ --- src/configure.in.orig Tue Jun 20 17:42:51 2000 +++ src/configure.in Tue Jun 27 16:00:11 2000 @@ -675,24 +675,46 @@ AC_SUBST(YFLAGS)AC_CHECK_LIB(sfio, main) -for curses in ncurses curses ; do - AC_CHECK_LIB(${curses}, main, - [LIBS="-l${curses} $LIBS"; break]) + +for termlib in ncurses curses termcap terminfo termlib; do + AC_CHECK_LIB(${termlib}, tputs, [LIBS="-l${termlib} $LIBS"; break]) done -AC_CHECK_LIB(termcap, main) -AC_CHECK_LIB(readline, main) -AC_CHECK_LIB(readline, using_history, AC_DEFINE(HAVE_HISTORY_IN_READLINE), - AC_CHECK_LIB(history, main) ) +AC_ARG_WITH(readline, +[ --with-readline=DIR search DIR for readline includes and libraries],[ + case "$with_readline" in + no) ;; + *) + if test "$with_readline" != "yes"; then + _cppflags=${CPPFLAGS} + _ldflags=${LDFLAGS} + CPPFLAGS="${CPPFLAGS} -I$with_readline/include" + LDFLAGS="${LDFLAGS} -L$with_readline/lib" + fi + + AC_CHECK_HEADERS(readline.h readline/history.h readline/readline.h, + AC_CHECK_LIB(readline, readline) + AC_CHECK_LIB(readline, using_history, + AC_DEFINE(HAVE_HISTORY_IN_READLINE), + AC_CHECK_LIB(history, add_history))) + + if test -z "$ac_cv_header_readline_h" -a \ + -z "$ac_cv_header_readline_readline_h"; then + if test -n "${_cppflags}"; then + CPPFLAGS="${_cppflags}" LDFLAGS="${_ldflags}" + fi + fi + ;; + esac])if test "$PORTNAME" != "aix" -a "$PORTNAME" != "alpha" then AC_CHECK_LIB(bsd, main) fi AC_CHECK_LIB(util, main) -AC_CHECK_LIB(m, main) -AC_CHECK_LIB(dl, main) -AC_CHECK_LIB(socket, main) -AC_CHECK_LIB(nsl, main) +AC_CHECK_FUNC(pow, , AC_CHECK_LIB(m, pow)) +AC_CHECK_FUNC(dlopen, , AC_CHECK_LIB(dl, dlopen)) +AC_CHECK_FUNC(gethostent, , AC_CHECK_LIB(nsl, gethostent)) +AC_CHECK_FUNC(setsockopt, , AC_CHECK_LIB(socket, setsockopt)) AC_CHECK_LIB(ipc, main) AC_CHECK_LIB(IPC, main) AC_CHECK_LIB(lc, main) @@ -701,7 +723,7 @@ AC_CHECK_LIB(ld, main) AC_CHECK_LIB(compat, main) AC_CHECK_LIB(BSD, main) -AC_CHECK_LIB(crypt, main) +AC_CHECK_FUNC(crypt, , AC_CHECK_LIB(crypt, crypt)) AC_CHECK_LIB(gen, main) AC_CHECK_LIB(PW, main)
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Bruce Momjian writes:
I think our source tree has diverged quite a bit from 7.0.2. Could you
grab a snapshot and let me know what needs changing for Solaris?
These fixes were integrated. Let's remember to make a more detailed
"Supported Platforms" list next time, because this platform was listed and
it evidently didn't work.
I'm in the process of fixing build problems in 7.0.2 for Solaris CC
(not GCC).
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Which version of Solaris was he using? I'm using Solaris 2.7, and 7.0.2
compiled, installed and works without a hitch. The previous release did
not work correctly, but 7.0.2 works fine for me.
----------------------------------------------------------------
Travis Bauer | CS Grad Student | IU |www.cs.indiana.edu/~trbauer
----------------------------------------------------------------
On Wed, 11 Oct 2000, Peter Eisentraut wrote:
Show quoted text
Bruce Momjian writes:
I think our source tree has diverged quite a bit from 7.0.2. Could you
grab a snapshot and let me know what needs changing for Solaris?These fixes were integrated. Let's remember to make a more detailed
"Supported Platforms" list next time, because this platform was listed and
it evidently didn't work.I'm in the process of fixing build problems in 7.0.2 for Solaris CC
(not GCC).--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/
Travis Bauer writes:
Which version of Solaris was he using? I'm using Solaris 2.7, and 7.0.2
compiled, installed and works without a hitch.
He was using the Solaris compiler rather than GCC, and that couldn't
possibly have worked, as it turned out.
--
Peter Eisentraut peter_e@gmx.net http://yi.org/peter-e/