> Date: Tue, 19 Feb 2013 15:56:41 +0000 (GMT) > From: Richard Lloyd <richard.ll...@connectinternetsolutions.com>
> cc -O -I/usr/local/include -Wl,+b -Wl,/usr/local/lib/hpux32 > -L/usr/local/lib/hpux32 -o makedoc makedoc.o ../gnulib/lib/libgnu.a -lncurses > /usr/local/lib/hpux32/libintl.so /usr/local/lib/hpux32/libiconv.so -Wl,+b > -Wl,/usr/local/lib/hpux32 > ld: Duplicate symbol "xnmalloc" in files makedoc.o and > ../gnulib/lib/libgnu.a[xmalloc.o] > ... > > This is because the functions have been declared globally in more than > one source file That should be OK, if things are working correctly. xmalloc.o should define the symbol xnmalloc, and the other files (such as makedoc.o) should use the symbol. This is because xmalloc.c should expand to something like this: extern inline void *xnmalloc (size_t n, size_t s) { return xmalloc (n * s); } and makedoc.c should expand to something like this: inline void *xnmalloc (size_t n, size_t s) { return xmalloc (n * s); } and C99 says that this should work. Evidently it's not working, though, and it'd be helpful to know why (as things stand, my fix disables inline functions entirely on HP-UX, which probably hurts performance). Does the config.h file have a #define for 'inline'? E.g., '#define inline /* empty */'? That might explain the problem. Can you investigate what these functions are actually macroexpanding to? You can do that by looking at the commands that compile xmalloc.c and makedoc.c, and by using 'cc -E' rather than 'cc -c'. > The __HP_cc macro therefore returns 111120 (PA-RISC) or 62600 (Itanium). Thanks. So if we wanted to base it on __HP_cc being less than something, we'd have to use a different number depending on the platform. Good to know.