Thread: compile failure on xmalloc()
I am seeing the following compile failure in currrent CVS. Seems there is a conflict between readline and psql's use of the xmalloc function name. --------------------------------------------------------------------------- gcc -O2 -fno-strict-aliasing -Wall -Wmissing-prototypes -Wmissing-declarations -O1 -Wall -Wmissing-prototypes -Wmissing-declarations-Wpointer-arith -Wcast-align command.o common.o help.o input.o stringutils.o mainloop.o copy.o startup.oprompt.o variables.o large_obj.o print.o describe.o tab-complete.o mbprint.o -L../../../src/interfaces/libpq -lpq-L../../../src/port -L/usr/local/lib -L/usr/contrib/lib -Wl,-rpath,/usr/local/pgsql/lib -O1 -Wall -Wmissing-prototypes-Wmissing-declarations -Wpointer-arith -Wcast-align -lssl -lcrypto -lz -lreadline -ltermcap -lgetopt-lcompat -lipc -ldl -lm -lutil -lpgport -o psql /usr/local/lib/libreadline.a(xmalloc.o): In function `xmalloc': /u/src/lib/readline/readline-2.2.1/xmalloc.c:51: multiple definition of `xmalloc' common.o(.text+0x5c): first defined here ld: Warning: size of symbol `xmalloc' changed from 54 to 47 in xmalloc.o --------------------------------------------------------------------------- It seems it is from these commits: --------------------------------------------------------------------------- ---------------------------- revision 1.82 date: 2004/01/25 03:07:22; author: neilc; state: Exp; lines: +7 -8 More fallout from the recent psql patch: rename xmalloc and friends to pg_malloc, to avoid linker failures on same platforms. ---------------------------- revision 1.81 date: 2004/01/24 19:38:49; author: neilc; state: Exp; lines: +39 -7 This patch makes some of the memory manipulation performed by psql a little more sane. Some parts of the code was using a static function xmalloc() that did safe memory allocation (where "safe" means "bail out on OOM"), but most of it was just invoking calloc() or malloc() directly. Now almost everything invokes xmalloc() or xcalloc(). -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073
Bruce Momjian <pgman@candle.pha.pa.us> writes: > I am seeing the following compile failure in currrent CVS. Seems there > is a conflict between readline and psql's use of the xmalloc function > name. This should be fixed in the latest CVS HEAD code (i.e. r1.82 of common.c) -- can you make sure your sources are up to date and rebuild from scratch? > It seems it is from these commits: [...] Yes, my apologies -- my platform's linker is apparently less strict and I didn't get the error. -Neil
Neil Conway wrote: > Bruce Momjian <pgman@candle.pha.pa.us> writes: > > I am seeing the following compile failure in currrent CVS. Seems there > > is a conflict between readline and psql's use of the xmalloc function > > name. > > This should be fixed in the latest CVS HEAD code (i.e. r1.82 of > common.c) -- can you make sure your sources are up to date and rebuild > from scratch? Yes, compiles fine now. > > It seems it is from these commits: [...] > > Yes, my apologies -- my platform's linker is apparently less strict > and I didn't get the error. Yes, mine is BSD/OS, which is a little more particular, which is good for our testing. Thanks. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001+ If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania19073