Thread: psql compile errors
Peter, current sources tell gcc -I../../interfaces/libpq -I../../include -I../../backend -O2 -Wall -Wmissing-prototypes -g -c tab-complete.c -o tab-complete.o tab-complete.c: In function `initialize_readline': tab-complete.c:100: `rl_filename_quoting_function' undeclared (first use in this function) tab-complete.c:100: (Each undeclared identifier is reported only once tab-complete.c:100: for each function it appears in.) tab-complete.c:102: `rl_filename_quote_characters' undeclared (first use in this function) tab-complete.c:107: `rl_completion_query_items' undeclared (first use in this function) tab-complete.c: In function `psql_completion': tab-complete.c:206: `rl_completion_append_character' undeclared (first use in this function) tab-complete.c:262: warning: implicit declaration of function `snprintf' tab-complete.c: In function `quote_file_name': tab-complete.c:790: `SINGLE_MATCH' undeclared (first use in this function) tab-complete.c:786: warning: `length' might be used uninitialized in this function make[2]: *** [tab-complete.o] Error 1 Is it somthing missing here or a source error? Jan -- #======================================================================# # It's easier to get forgiveness for being wrong than for being right. # # Let's break this rule - forgive me. # #========================================= wieck@debis.com (Jan Wieck) #
On 1999-12-17, Jan Wieck mentioned: > gcc -I../../interfaces/libpq -I../../include -I../../backend -O2 -Wall -Wmissing-prototypes -g -c tab-complete.c -otab-complete.o > tab-complete.c: In function `initialize_readline': > tab-complete.c:100: `rl_filename_quoting_function' undeclared (first use in this function) > tab-complete.c:100: (Each undeclared identifier is reported only once > tab-complete.c:100: for each function it appears in.) > tab-complete.c:102: `rl_filename_quote_characters' undeclared (first use in this function) > tab-complete.c:107: `rl_completion_query_items' undeclared (first use in this function) > tab-complete.c: In function `psql_completion': > tab-complete.c:206: `rl_completion_append_character' undeclared (first use in this function) If these are indeed all the errors, then I would like to know what version of readline it is you're using. There is no constant or macro defined for that AFAICS, so you might have to infer that from a package name or other sources. Mine goes by the name of 2.2.1. Note that this is not the same as the version number on the libreadline shared library, where mine says 3.0. > tab-complete.c:262: warning: implicit declaration of function `snprintf' That looks a little odd, since that prototype is declared in c.h, which is included in tab-complete.c, conditional on config.h macros, which is also included in tab-complete.c (before c.h), so maybe a configure problem? > tab-complete.c: In function `quote_file_name': > tab-complete.c:790: `SINGLE_MATCH' undeclared (first use in this function) > tab-complete.c:786: warning: `length' might be used uninitialized in this function HUH??? [...] char * quote_file_name(char *text, int match_type, char * quote_pointer) { char *s; size_t length; (void)quote_pointer; /* not used */ length = strlen(text) + ( match_type==SINGLE_MATCH? 3 : 2 ); s = xmalloc(length); [...] Looks like a brain-dead compiler to me. > make[2]: *** [tab-complete.o] Error 1 All psql code should compile with -Wall -W with precisely this message: common.c: In function `handle_sigint': common.c:316: warning: unused parameter `postgres_signal_arg' Everything else is a problem which will get fixed. -- Peter Eisentraut Sernanders väg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden
Peter Eisentraut <peter_e@gmx.net> writes: > If these are indeed all the errors, then I would like to know what version > of readline it is you're using. There is no constant or macro defined for > that AFAICS, so you might have to infer that from a package name or other > sources. Mine goes by the name of 2.2.1. Note that this is not the same as > the version number on the libreadline shared library, where mine says 3.0. Hmm. I recall that I used to have an ancient copy of libreadline (2.something) but awhile ago (between 6.4 and 6.5, I think) someone changed psql in a way that rendered it incompatible with that version. Rather than arguing, I just upgraded to the current libreadline 4.0. Have you restored compatibility with the old readline version? That'd be nice, I guess, but it's probably more important to be sure psql still works with the current readline... >> tab-complete.c:262: warning: implicit declaration of function `snprintf' > That looks a little odd, since that prototype is declared in c.h, which is > included in tab-complete.c, conditional on config.h macros, which is also > included in tab-complete.c (before c.h), so maybe a configure problem? I've run into this myself (for vsnprintf not snprintf but I bet the problem is the same). c.h provides a declaration of these routines if HAVE_SNPRINTF etc are not set. But the configure script sets HAVE_SNPRINTF on the basis of a link check that tests whether such functions actually exist in libc. There are some braindead platforms that provide library functions but don't offer a declaration for them anywhere. I see this with vsnprintf on HPUX 10.20, and I'll bet snprintf is that way on other platforms. What's needed is for configure to test separately for the existence of the function and whether the system header files provide a prototype :-(. >> tab-complete.c: In function `quote_file_name': >> tab-complete.c:790: `SINGLE_MATCH' undeclared (first use in this function) >> tab-complete.c:786: warning: `length' might be used uninitialized in this function > HUH??? Yup, Jan's running a different libreadline than you are. AFAICS there's no compile-time symbol identifying the libreadline version, which is a dumb choice for a library that keeps adding new API. Perhaps more configure checks are needed to distinguish which libreadline we have, or at least to act like readline is not present at all if it's not at least version X. regards, tom lane
On 1999-12-18, Tom Lane mentioned: > Yup, Jan's running a different libreadline than you are. It looks like they changed the API quite a bit between 2.* and 4.0 (which might also explain why there was no 3.*). I'll make sure that this gets fixed before this thing goes out the door. Right now please work around. -- Peter Eisentraut Sernanders väg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden