Thread: AIX 4.3.1, 7.0.3 build annoyances: C++ comments, make all, macro problem

AIX 4.3.1, 7.0.3 build annoyances: C++ comments, make all, macro problem

From
pgsql-bugs@postgresql.org
Date:
Travis Pouarz (twp1@duke.edu) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
AIX 4.3.1, 7.0.3 build annoyances: C++ comments, make all, macro problem

Long Description
select version(): PostgreSQL 7.0.3 on rs6000-ibm-aix4.3.1.0, compiled by xlc

Building Postgres 7.0.3 on AIX 4.3.1 using xlc (__IBMC__ = 436).
GNU Make version 3.77
Ran ./configure with '--with-tcl' (as well as other stuff)

I ran into the following three problems during build.  I found workarounds to all three problems.

---- [1]
I needed to 'make all' explicitly.  'make' alone resulted in this behavior:

> make
Making postgres.imp
./backend/port/aix/mkldexport.sh postgres /.../pkg/postgresql-7.0.3/bin > postgres.imp
nm: postgres: 0654-200 Cannot open the specified file.
nm: No such file or directory
xlc -Wl,-bE:./backend/postgres.imp -o postgres  ../utils/version.o -L/.../lib -ltcl8.0  -L/.../readline-4.1/lib -lPW
-lcrypt-lld -lnsl -ldl -lm -lreadline -ltermcap -lcurses  
xlc: 1501-228 input file ../utils/version.o not found
make: *** [postgres.imp] Error 252

---- [2]
interfaces/odbc/pgtypes.h

has a single C++ comment.  I would guess this is an error.  Rather than changing the source I added '-qcpluscmt' to my
compilerflags so the c compiler would accept C++ comments. 

Actually, I see in http://www.postgresql.org/docs/devhistory2.html that this is intentional "We switched to C++ so we
coulduse those nifty // single line comments." :-) 

---- [3]
interfaces/odbc/dlg_specific.h

I had to make the following change in dlg_specific.h:

#if 0
#define xstr(s)         str(s)
#define str(s)          #s
#define ODBCINST_INI    xstr(ODBCINST) "/odbcinst.ini"
#endif
#define ODBCINST_INI    "/odbcinst.ini"

To fix errors of this type:

xlc -I../../include -I../../backend -I/.../include -I/.../pkg/readline-4.1/include -qmaxmem=16384 -qhalt=w -qsrcmsg
-qlanglvl=extended-qlonglong -qcpluscmt -I. -DHAVE_CONFIG_H   -c psqlodbc.c -o psqlodbc.o 
      106 |         getGlobalDefaults("PostgreSQL", "" "/odbcinst.ini", 0);
            .....................................a.........................
  a - 1506-010 (W) Macro str invoked with a null argument for parameter s.
----


Sample Code


No file was uploaded with this report
pgsql-bugs@postgresql.org writes:
> AIX 4.3.1, 7.0.3 build annoyances: C++ comments, make all, macro problem

Hi Travis,

I believe current sources (7.1-to-be) build cleanly on AIX, though I'm
not sure whether our main AIX beta tester checks ODBC very often.
Would you be willing to pull current sources and see how it goes there?
If you can use CVS then see
http://www.postgresql.org/devel-corner/docs/postgres/anoncvs.htm
otherwise there is a snapshot tarball generated nightly in
ftp://ftp.postgresql.org/pub/dev/

Note that current sources are NOT stable enough for production use,
though there's no reason not to use them for development.

            regards, tom lane

Re: AIX 4.3.1, 7.0.3 build annoyances: C++ comments, make all, macro problem

From
"Travis W. Pouarz"
Date:
On Fri, 29 Dec 2000, Tom Lane wrote:

> pgsql-bugs@postgresql.org writes:
> > AIX 4.3.1, 7.0.3 build annoyances: C++ comments, make all, macro problem
>
> I believe current sources (7.1-to-be) build cleanly on AIX, though I'm
> not sure whether our main AIX beta tester checks ODBC very often.
> Would you be willing to pull current sources and see how it goes there?
> ... otherwise there is a snapshot tarball generated nightly in
> ftp://ftp.postgresql.org/pub/dev/

As you suggested, I grabbed pub/dev/postgresql-snapshot.tar.gz yesterday
(31 Dec 00) and ran with that.

===========
First, without -with-tcl:
  It compiled and installed without any problems.

Here's the configure:

./configure --without-CXX --prefix=/tmp/postgresql-snapshot/install \
--with-odbc \
--with-includes=/.../austin.ibm.com/fs/projects/gsys/pkg/readline-4.1/include \
--with-libraries=/.../austin.ibm.com/fs/projects/gsys/pkg/readline-4.1/lib

===========
Second, with --with-tcl (and --with-tclconfig, --with-includes, and
--with-libraries to my tcl8.0 installation):

Here's the configure:

./configure --without-CXX --prefix=/tmp/postgresql-snapshot/install
--with-odbc --with-tcl \
--with-tclconfig=/.../austin.ibm.com/fs/projects/gsys/lib \

--with-includes=/.../austin.ibm.com/fs/projects/gsys/pkg/readline-4.1/include:/.../austin.ibm.com/fs/projects/gsys/include
\
--with-libraries=/.../austin.ibm.com/fs/projects/gsys/pkg/readline-4.1/lib:/.../austin.ibm.com/fs/projects/gsys/lib

  * I got this error during the build:

...
ar crs libpgtcl.a pgtcl.o pgtclCmds.o pgtclId.o
touch libpgtcl.a
../../../src/backend/port/aix/mkldexport.sh libpgtcl.a > libpgtcl.exp
cc -O -qtune=p2sc -qmaxmem=8192 -Wl,-H512 -Wl,-bM:SRE
-Wl,-bI:../../../src/backend/postgres.imp -Wl,-bE:libpgtcl.exp -o
libpgtcl.so libpgtcl.a
-L/.../austin.ibm.com/fs/projects/gsys/pkg/readline-4.1/lib
-L/.../austin.ibm.com/fs/projects/gsys/lib
-L/.../austin.ibm.com/fs/projects/gsys/pkg/readline-4.1/lib
-L/.../austin.ibm.com/fs/projects/gsys/lib
-L../../../src/interfaces/libpq -lpq  -lc
...
ld: 0711-317 ERROR: Undefined symbol: .Tcl_SetVar2
ld: 0711-317 ERROR: Undefined symbol: .Tcl_SetVar
ld: 0711-317 ERROR: Undefined symbol: .Tcl_AppendResult
ld: 0711-317 ERROR: Undefined symbol: .Tcl_Preserve
...

  so I added -ltcl8.0 to LDFLAGS in src/Makefile.global:

LDFLAGS = -L/.../austin.ibm.com/fs/projects/gsys/pkg/readline-4.1/lib \
 -L/.../austin.ibm.com/fs/projects/gsys/lib -ltcl8.0

 * Then I got this error during the build:

...
make[3]: Entering directory `/tmp/postgresql-snapshot/src/pl/tcl'
cc   -I/.../austin.ibm.com/fs/projects/gsys/pkg/readline-4.1/include
-I/.../austin.ibm.com/fs/projects/gsys/include -I../../../src/include
-DHAVE_GETCWD=1 -DNO_DLFCN_H=1 -DHAVE_UNISTD_H=1 -DUSE_TERMIOS=1
-DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_TIME_H=1 -DTIME_WITH_SYS_TIME=1
-DHAVE_TZNAME=1 -DHAVE_TIMEZONE_VAR=1 -DUSE_DELTA_FOR_TZ=1
-DHAVE_ST_BLKSIZE=1 -DSTDC_HEADERS=1 -DNO_UNION_WAIT=1 -DNEED_MATHERR=1
-Dvfork=fork -D__CHAR_UNSIGNED__=1 -DHAVE_SIGNED_CHAR=1
-DHAVE_SYS_IOCTL_H=1   -c pltcl.c -o pltcl.o
/.../austin.ibm.com/fs/projects/gsys/lib/tcl8.0/ldAix /bin/ld -bhalt:4
-bM:SRE -bE:lib.exp -H512 -T512 -bnoentry -o pltcl.so pltcl.o
-L/.../austin.ibm.com/fs/projects/gsys/lib -ltcl8.0 -lld  -lm -lbsd -lc
noDotA="pltcl.so"
ld: 0711-317 ERROR: Undefined symbol: .nocachegetattr
ld: 0711-317 ERROR: Undefined symbol: .heap_getsysattr
ld: 0711-317 ERROR: Undefined symbol: .SearchSysCache
ld: 0711-317 ERROR: Undefined symbol: .elog
ld: 0711-317 ERROR: Undefined symbol: .ReleaseSysCache
ld: 0711-317 ERROR: Undefined symbol: .OidFunctionCall3
ld: 0711-317 ERROR: Undefined symbol: .pfree
ld: 0711-317 ERROR: Undefined symbol: Warn_restart
ld: 0711-317 ERROR: Undefined symbol: .FunctionCall3
ld: 0711-317 ERROR: Undefined symbol: .SPI_execp
ld: 0711-317 ERROR: Undefined symbol: SPI_processed
ld: 0711-317 ERROR: Undefined symbol: SPI_tuptable
...

  so I added -bI:/tmp/postgresql-snapshot/src/backend/postgres.imp to TCL_SHLIB_LD
  in src/pl/tcl/Makefile.tcldefs:

TCL_SHLIB_LD = /.../austin.ibm.com/fs/projects/gsys/lib/tcl8.0/ldAix \
/bin/ld -bhalt:4 -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry \
-bI:/tmp/postgresql-snapshot/src/backend/postgres.imp

 * The build then completed and installed without further error.

I loaded a pg_dumpall from a small 7.0.3 database into this 7.1 build
and ran a query and didn't observe anything out of the ordinary.

BTW, relative to a lot of stuff I've compiled on AIX, PostgreSQL
is a piece of cake.  Thanks!

-Travis
"Travis W. Pouarz" <twp1@duke.edu> writes:
> I loaded a pg_dumpall from a small 7.0.3 database into this 7.1 build
> and ran a query and didn't observe anything out of the ordinary.

Running the regression tests (src/test/regress) would be a more thorough
test that things are working.

            regards, tom lane
"Travis W. Pouarz" <twp1@duke.edu> writes:
> Does the regression test the optional interfaces such as tcl and odbc?

No, just the core code (and even there, the coverage is pretty limited,
but it's a lot better than nothing...)

> Here are the fails:

>      timestamp            ... FAILED
> test geometry             ... FAILED
> test horology             ... FAILED

Hm.  There is a geometry variant expected file for AIX:

    geometry/powerpc.*-aix4=geometry-powerpc-aix4

Does your results file happen to match
expected/geometry-powerpc-aix4.out, or any of the other existing
geometry-foo expected files?  If so, why isn't this resultmap file
matching your platform?  (Check what config.guess prints...)

> That 0 / -0 mismatch might cause some people some trouble.

Not a big problem, I don't think.  We have some platforms where
-0 always prints without the minus sign anyway.

> The timestamp and horology differences were all diffences
> of one-hour where I get one hour less than the expected.  I'd
> guess that your expected assumes running in EST and I'm
> in CST.

No, the expecteds are PST8PDT, and the regression script should force
TZ to PST8PDT as well.  You may have one of the platforms that has
weird ideas about PDT times before 1970.  Or maybe it's been fixed
since the AIX version that Andreas uses.  I see entries in resultmap
that change the expected file for AIX:

    horology/.*-aix4=horology-1947-PDT

Perhaps these are triggering but are not appropriate for your version
of AIX.

If you want to see this cleaned up, please read
http://www.postgresql.org/devel-corner/docs/postgres/regress.htm
http://www.postgresql.org/devel-corner/docs/postgres/regress-platform.htm
and then submit proposed diffs for the resultmap (and new expected files
if necessary).

            regards, tom lane

Re: AIX 4.3.1, 7.0.3 build annoyances: C++ comments, make all, macro problem

From
"Travis W. Pouarz"
Date:
On Mon, 1 Jan 2001, Tom Lane wrote:

> Running the regression tests (src/test/regress) would be a more thorough
> test that things are working.

Right.

Does the regression test the optional interfaces such as tcl and odbc?

Here are the fails:

     timestamp            ... FAILED
test geometry             ... FAILED
test horology             ... FAILED

The geometry fails appear to be because of differences in the extremes
of floating point precision, except for this case:

*** ./expected/geometry.out     Wed Sep 13 02:00:17 2000
--- ./results/geometry.out      Mon Jan  1 20:14:12 2001
***************
*** 114,120 ****
          | (5.1,34.5) | [(1,2),(3,4)]                 | (3,4)
          | (-5,-12)   | [(1,2),(3,4)]                 | (1,2)
          | (10,10)    | [(1,2),(3,4)]                 | (3,4)
!         | (0,0)      | [(0,0),(6,6)]                 | (-0,0)
          | (-10,0)    | [(0,0),(6,6)]                 | (0,0)
          | (-3,4)     | [(0,0),(6,6)]                 | (0.5,0.5)
          | (5.1,34.5) | [(0,0),(6,6)]                 | (6,6)
--- 114,120 ----
          | (5.1,34.5) | [(1,2),(3,4)]                 | (3,4)
          | (-5,-12)   | [(1,2),(3,4)]                 | (1,2)
          | (10,10)    | [(1,2),(3,4)]                 | (3,4)
!         | (0,0)      | [(0,0),(6,6)]                 | (0,0)
          | (-10,0)    | [(0,0),(6,6)]                 | (0,0)
          | (-3,4)     | [(0,0),(6,6)]                 | (0.5,0.5)
          | (5.1,34.5) | [(0,0),(6,6)]                 | (6,6)


That 0 / -0 mismatch might cause some people some trouble.

The timestamp and horology differences were all diffences
of one-hour where I get one hour less than the expected.  I'd
guess that your expected assumes running in EST and I'm
in CST.

-Travis

Re: AIX 4.3.1, 7.0.3 build annoyances: C++ comments, make all, macro problem

From
Peter Eisentraut
Date:
Travis W. Pouarz writes:

> ar crs libpgtcl.a pgtcl.o pgtclCmds.o pgtclId.o
> touch libpgtcl.a
> ../../../src/backend/port/aix/mkldexport.sh libpgtcl.a > libpgtcl.exp
> cc -O -qtune=p2sc -qmaxmem=8192 -Wl,-H512 -Wl,-bM:SRE
> -Wl,-bI:../../../src/backend/postgres.imp -Wl,-bE:libpgtcl.exp -o
> libpgtcl.so libpgtcl.a
> -L/.../austin.ibm.com/fs/projects/gsys/pkg/readline-4.1/lib
> -L/.../austin.ibm.com/fs/projects/gsys/lib
> -L/.../austin.ibm.com/fs/projects/gsys/pkg/readline-4.1/lib
> -L/.../austin.ibm.com/fs/projects/gsys/lib
> -L../../../src/interfaces/libpq -lpq  -lc
> ...
> ld: 0711-317 ERROR: Undefined symbol: .Tcl_SetVar2
> ld: 0711-317 ERROR: Undefined symbol: .Tcl_SetVar
> ld: 0711-317 ERROR: Undefined symbol: .Tcl_AppendResult
> ld: 0711-317 ERROR: Undefined symbol: .Tcl_Preserve
> ...

On other platforms it is not an error if a shared library link leaves
unresolved symbols.  (I'm not totally convinced whether this is desirable,
but that's the way we have set them up.)  On AIX >=4 it should work to add
the option -Wl,-berok ("external references okay") at an opportune place
in src/makefiles/Makefile.aix.  Please try that.

>   so I added -ltcl8.0 to LDFLAGS in src/Makefile.global:

Hmm, I guess one reason that this is not done by default is to allow using
libpgtcl with various Tcl versions, to be decided at the time the
executable is linked.  Not sure if this is really feasible, though.

> /.../austin.ibm.com/fs/projects/gsys/lib/tcl8.0/ldAix /bin/ld -bhalt:4
> -bM:SRE -bE:lib.exp -H512 -T512 -bnoentry -o pltcl.so pltcl.o
> -L/.../austin.ibm.com/fs/projects/gsys/lib -ltcl8.0 -lld  -lm -lbsd -lc
> noDotA="pltcl.so"
> ld: 0711-317 ERROR: Undefined symbol: .nocachegetattr
> ld: 0711-317 ERROR: Undefined symbol: .heap_getsysattr
> ld: 0711-317 ERROR: Undefined symbol: .SearchSysCache
> ld: 0711-317 ERROR: Undefined symbol: .elog
> ld: 0711-317 ERROR: Undefined symbol: .ReleaseSysCache
> ld: 0711-317 ERROR: Undefined symbol: .OidFunctionCall3
> ld: 0711-317 ERROR: Undefined symbol: .pfree
> ld: 0711-317 ERROR: Undefined symbol: Warn_restart
> ld: 0711-317 ERROR: Undefined symbol: .FunctionCall3
> ld: 0711-317 ERROR: Undefined symbol: .SPI_execp
> ld: 0711-317 ERROR: Undefined symbol: SPI_processed
> ld: 0711-317 ERROR: Undefined symbol: SPI_tuptable
> ...

Okay, same answer as above here really, but unfortunately we're using the
magic flags provided by Tcl here, so either we override them (or augment
them) in the AIX case, or we do something like

>   so I added -bI:/tmp/postgresql-snapshot/src/backend/postgres.imp to TCL_SHLIB_LD
>   in src/pl/tcl/Makefile.tcldefs:

The -Wl,-berok will lose on AIX 3*, so if anyone cares run run PG with Tcl
on that platform we'll have to think harder.

--
Peter Eisentraut      peter_e@gmx.net       http://yi.org/peter-e/