Simon Josefsson wrote: > Quoting http://autobuild.josefsson.org/gnulib/log-200908060711491983000.txt > > gcc -std=gnu99 -g -O2 -o test-argp-version-etc test-argp-version-etc.o > ../gllib/libgnu.a -L/Users/jas/daily/lib -lintl -L/opt/local/lib -liconv -lc > -Wl,-framework -Wl,CoreFoundation -lm > /usr/libexec/gcc/powerpc-apple-darwin8/4.0.1/ld: Undefined symbols: > _argp_program_version > _argp_program_bug_address > collect2: ld returned 1 exit status > make[4]: *** [test-argp-version-etc] Error 1 > > What file is responsible for providing these symbols?
They are defined in lib/argp-pv.c and lib/argp-ba.c, which are contained in libgnu.a, which is on the link command line. powerpc-apple-darwin8 is MacOS X 10.4. I see this error also on MacOS X 10.3.9. It's the same linker bug as the one mentioned in lib/mbsrtowcs-state.c. I'm applying this fix: 2009-08-07 Bruno Haible <br...@clisp.org> Avoid link error on MacOS X 10.3 and 10.4. * lib/argp-ba.c (argp_program_bug_address): Explicitly zero-initialize on non-ELF systems. * lib/argp-pv.c (argp_program_version): Likewise. Reported by Simon Josefsson. --- lib/argp-ba.c.orig 2009-08-07 09:04:09.000000000 +0200 +++ lib/argp-ba.c 2009-08-07 09:03:11.000000000 +0200 @@ -1,5 +1,5 @@ /* Default definition for ARGP_PROGRAM_BUG_ADDRESS. - Copyright (C) 1996, 1997, 1999 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader <mi...@gnu.ai.mit.edu>. @@ -21,4 +21,14 @@ the ARGP_HELP_BUG_ADDR flag is set (as it is by various standard help messages), embedded in a sentence that says something like `Report bugs to ADDR.'. */ -const char *argp_program_bug_address; +const char *argp_program_bug_address +/* This variable should be zero-initialized. On most systems, putting it into + BSS is sufficient. Not so on MacOS X 10.3 and 10.4, see + <http://lists.gnu.org/archive/html/bug-gnulib/2009-01/msg00329.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00096.html>. */ +#if defined __ELF__ + /* On ELF systems, variables in BSS behave well. */ +#else + = (const char *) 0 +#endif + ; --- lib/argp-pv.c.orig 2009-08-07 09:04:09.000000000 +0200 +++ lib/argp-pv.c 2009-08-07 09:03:12.000000000 +0200 @@ -1,5 +1,5 @@ /* Default definition for ARGP_PROGRAM_VERSION. - Copyright (C) 1996, 1997, 1999, 2006 Free Software Foundation, Inc. + Copyright (C) 1996, 1997, 1999, 2006, 2009 Free Software Foundation, Inc. This file is part of the GNU C Library. Written by Miles Bader <mi...@gnu.ai.mit.edu>. @@ -20,4 +20,14 @@ --version is added (unless the ARGP_NO_HELP flag is used), which will print this string followed by a newline and exit (unless the ARGP_NO_EXIT flag is used). Overridden by ARGP_PROGRAM_VERSION_HOOK. */ -const char *argp_program_version; +const char *argp_program_version +/* This variable should be zero-initialized. On most systems, putting it into + BSS is sufficient. Not so on MacOS X 10.3 and 10.4, see + <http://lists.gnu.org/archive/html/bug-gnulib/2009-01/msg00329.html> + <http://lists.gnu.org/archive/html/bug-gnulib/2009-08/msg00096.html>. */ +#if defined __ELF__ + /* On ELF systems, variables in BSS behave well. */ +#else + = (const char *) 0 +#endif + ;