Thread: BUG #1019: src/pl/tcl/pltcl.c

BUG #1019: src/pl/tcl/pltcl.c

From
"PostgreSQL Bugs List"
Date:
The following bug has been logged online:

Bug reference:      1019
Logged by:          Patrick Samson
Email address:      p_samson@yahoo.com
PostgreSQL version: 7.3.5
Operating system:   Cygwin
Description:        src/pl/tcl/pltcl.c
Details:

For "configure --with-tcl --without-tk".
'make' doesn't know how to resolve some references.

make[3]: Entering directory `/opt/postgresql-7.3.5/src/pl/tcl'
dlltool --export-all --output-def pltcl.def pltcl.o
dllwrap -o pltcl.dll --dllname pltcl.dll --def pltcl.def pltcl.o ../../../src/utils/dllinit.o -L/usr/local/lib
-L../../../src/backend-lpostgres -L/usr/lib -ltcl84 
fu000001.o(.idata$3+0xc): undefined reference to `_libpostgres_a_iname'
fu000003.o(.idata$3+0xc): undefined reference to `_libpostgres_a_iname'
fu000004.o(.idata$3+0xc): undefined reference to `_libpostgres_a_iname'
fu000005.o(.idata$3+0xc): undefined reference to `_libpostgres_a_iname'
fu000006.o(.idata$3+0xc): undefined reference to `_libpostgres_a_iname'
fu000007.o(.idata$3+0xc): more undefined references to `_libpostgres_a_iname' follow
nmth000000.o(.idata$4+0x0): undefined reference to `__nm__TopMemoryContext'
nmth000002.o(.idata$4+0x0): undefined reference to `__nm__SPI_tuptable'
nmth000015.o(.idata$4+0x0): undefined reference to `__nm__SPI_processed'
nmth000024.o(.idata$4+0x0): undefined reference to `__nm__Warn_restart'
nmth000128.o(.idata$4+0x0): undefined reference to `__nm__SPI_result'
nmth000133.o(.idata$4+0x0): undefined reference to `__nm__SPI_lastoid'

In src/pl/tcl/pltcl.c:
Permute the order of:
 #include "postgres.h"
 #include <tcl.h>
so as it appears as:
 #include <tcl.h>
 #include "postgres.h"

There is still some warnings, but it goes on:
gcc -O2 -Wall -Wmissing-prototypes -Wmissing-declarations  -I../../../src/include   -c -o pltcl.o pltcl.c
In file included from ../../../src/include/pg_config.h:673,
                 from ../../../src/include/c.h:53,
                 from ../../../src/include/postgres.h:48,
                 from pltcl.c:41:
../../../src/include/pg_config_os.h:26:1: warning: "DLLIMPORT" redefined
In file included from pltcl.c:39:
/usr/include/tcl.h:201:1: warning: this is the location of the previous definition
pltcl.c: In function `pltcl_init_interp':
pltcl.c:261: warning: passing arg 3 of `Tcl_CreateCommand' from incompatible pointer type
pltcl.c:263: warning: passing arg 3 of `Tcl_CreateCommand' from incompatible pointer type
pltcl.c:265: warning: passing arg 3 of `Tcl_CreateCommand' from incompatible pointer type
pltcl.c:267: warning: passing arg 3 of `Tcl_CreateCommand' from incompatible pointer type
pltcl.c:270: warning: passing arg 3 of `Tcl_CreateCommand' from incompatible pointer type
pltcl.c:272: warning: passing arg 3 of `Tcl_CreateCommand' from incompatible pointer type
pltcl.c:274: warning: passing arg 3 of `Tcl_CreateCommand' from incompatible pointer type
pltcl.c:276: warning: passing arg 3 of `Tcl_CreateCommand' from incompatible pointer type
pltcl.c: In function `pltcl_trigger_handler':
pltcl.c:818: warning: passing arg 4 of `Tcl_SplitList' from incompatible pointer type
pltcl.c: In function `pltcl_SPI_prepare':
pltcl.c:1745: warning: passing arg 4 of `Tcl_SplitList' from incompatible pointer type
pltcl.c: In function `pltcl_SPI_execp':
pltcl.c:2054: warning: passing arg 4 of `Tcl_SplitList' from incompatible pointer type

Reference: see also http://archives.postgresql.org/pgsql-cygwin/2003-01/msg00080.php

Re: BUG #1019: src/pl/tcl/pltcl.c

From
Peter Eisentraut
Date:
> In src/pl/tcl/pltcl.c:
> Permute the order of:
>  #include "postgres.h"
>  #include <tcl.h>
> so as it appears as:
>  #include <tcl.h>
>  #include "postgres.h"

I' afraid this is not a fix but just paints over the symptoms.  As you
noticed, this topic has already been discussed, and the solution needs to be
a little more involved than this.

Re: BUG #1019: src/pl/tcl/pltcl.c

From
Tom Lane
Date:
Peter Eisentraut <peter_e@gmx.net> writes:
>> In src/pl/tcl/pltcl.c:
>> Permute the order of:
>> #include "postgres.h"
>> #include <tcl.h>
>> so as it appears as:
>> #include <tcl.h>
>> #include "postgres.h"

> I' afraid this is not a fix but just paints over the symptoms.

... and would create serious new problems of its own, at least on some
platforms.  postgres.h has to be the *first* inclusion of any system
headers.

            regards, tom lane