Thread: ECPG interface: 7.4beta3 compile failure; CVS tip compile failure
System: i386 (Athlon) - Debian GNU/Linux unstable PostgreSQL 7.4beta3 fails to compile: i386-linux-gcc -O2 -g -Wall -Wmissing-prototypes -Wmissing-declarations -pipe -fPIC -I../../../../src/interfaces/ecpg/include-I../../../../src/include/utils -I../../../../src/include -I/usr/include/tcl8.4-I/usr/lib/R/include -g -c -o timestamp.o timestamp.c timestamp.c: In function `tm2timestamp': timestamp.c:71: error: syntax error before numeric constant timestamp.c:73: error: syntax error before "long" timestamp.c:76: error: syntax error before '>=' token timestamp.c:76: error: syntax error before '<' token make[5]: *** [timestamp.o] Error 1 make[5]: Leaving directory `/usr/src/mypackages/postgresql/postgresql-7.3.99.7.4beta3/build-tree/postgresql-7.4beta3/src/interfaces/ecpg/pgtypeslib' This error is fixed in CVS tip by Tom Lane's patch of 2 days ago. However CVS tip still fails to compile: make[4]: Entering directory `/home/olly/pgsql.cvs/pgsql/src/interfaces/ecpg/compatlib' i386-linux-gcc -O2 -g -Wall -Wmissing-prototypes -Wmissing-declarations -D_GNU_SOURCE -fpic -I../../../../src/interfaces/ecpg/include-I../../../../src/interfaces/libpq -I../../../../src/include/utils -I../../../../src/include-I/usr/include/tcl8.4 -I/usr/lib/R/include -c -o informix.o informix.c informix.c:138: error: syntax error before "__extension__" informix.c:138: error: syntax error before "len" informix.c:138: error: syntax error before "if" ...etc.... Line 138 begins the definition of strndup(). However, strndup() is also declared in string.h, which is included by this file. If I rename this function to estrndup() (and also where it is called, further down) the compilation succeeds. -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Give, and it shall be given unto you; good measure, pressed down, and shakentogether, and running over, shall men pour into your lap. For by your standard of measure it will be measuredto you in return." Luke 6:38
Oliver Elphick <olly@lfix.co.uk> writes: > Line 138 begins the definition of strndup(). However, strndup() is also > declared in string.h, which is included by this file. If I rename this > function to estrndup() (and also where it is called, further down) the > compilation succeeds. Hm, is strndup defined as a macro in your string.h? I suspect it's not a good idea to be providing a local definition of something that might be considered a standard function. regards, tom lane
On Thu, 2003-09-18 at 19:25, Tom Lane wrote: > Oliver Elphick <olly@lfix.co.uk> writes: > > Line 138 begins the definition of strndup(). However, strndup() is also > > declared in string.h, which is included by this file. If I rename this > > function to estrndup() (and also where it is called, further down) the > > compilation succeeds. > > Hm, is strndup defined as a macro in your string.h? I suspect it's not > a good idea to be providing a local definition of something that might > be considered a standard function. /* Return a malloc'd copy of at most N bytes of STRING. The resultant string is terminated even if no null terminator appears before STRING[N]. */ #if defined __USE_GNU extern char *strndup (__const char *__string, size_t __n) __THROW __attribute_malloc__; #endif -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Give, and it shall be given unto you; good measure, pressed down, and shakentogether, and running over, shall men pour into your lap. For by your standard of measure it will be measuredto you in return." Luke 6:38
On Thu, Sep 18, 2003 at 06:53:00PM +0100, Oliver Elphick wrote: > Line 138 begins the definition of strndup(). However, strndup() is also > declared in string.h, which is included by this file. If I rename this > function to estrndup() (and also where it is called, further down) the > compilation succeeds. I included strndup because some systems didn't seem to have it. Any idea what else I could do? Okay, I could rename it and use only the renamed function as it's just used internally. What surprises me is that it compiles fine for me despite using the very same system as Oliver to compile. Michael -- Michael Meskes Email: Michael at Fam-Meskes dot De ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!
On Fri, 2003-09-19 at 07:38, Michael Meskes wrote: > I included strndup because some systems didn't seem to have it. Any idea > what else I could do? Okay, I could rename it and use only the renamed > function as it's just used internally. > > What surprises me is that it compiles fine for me despite using the very > same system as Oliver to compile. Perhaps you should enclose your definition in #ifndef __USE_GNU #endif src/include/port/linux.h now forces _GNU_SOURCE on, which in turn defines __USE_GNU. Do you somehow override the definition of _GNU_SOURCE? -- Oliver Elphick Oliver.Elphick@lfix.co.uk Isle of Wight, UK http://www.lfix.co.uk/oliver GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C ======================================== "Bring ye all the tithes into the storehouse, that there may be meat in minehouse, and prove me now herewith, saith the LORD of hosts, if I will not open you the windows of heaven, andpour you out a blessing, that there shall not be room enough to receive it." Malachi 3:10
For now I simply renamed the function. We can look for the reason later. I'd prefer to get ecpg release ready first. :-) Michael -- Michael Meskes Email: Michael at Fam-Meskes dot De ICQ: 179140304, AIM/Yahoo: michaelmeskes, Jabber: meskes@jabber.org Go SF 49ers! Go Rhein Fire! Use Debian GNU/Linux! Use PostgreSQL!