Hi, When building a libiconv snapshot with --enable-relocatable on Cygwin, "make install" fails with
libtool: link: gcc -g -O2 iconv.o iconv.res -o .libs/iconv.exe -L/usr/local/cygwin64/lib ../srclib/libicrt.a /tmp/inst/lib/libiconv.dll.a -L/tmp/inst/lib RELOC_LIBRARY_PATH_VAR="PATH" RELOC_LIBRARY_PATH_VALUE="/tmp/inst/lib" RELOC_PREFIX="/tmp/inst" RELOC_DESTDIR="" RELOC_COMPILE_COMMAND="gcc -I/usr/local/cygwin64/include -Wall -g -O2 -L/usr/local/cygwin64/lib" RELOC_SRCDIR="../../srclib" RELOC_BUILDDIR="../srclib" RELOC_CONFIG_H_DIR=".." RELOC_EXEEXT=".exe" RELOC_STRIP_PROG=":" RELOC_INSTALL_PROG="/usr/bin/install -c" /bin/sh ../libtool --mode=install ../../build-aux/install-reloc iconv.exe /tmp/inst/bin/iconv.exe libtool: install: ../../build-aux/install-reloc .libs/iconv.exe /tmp/inst/bin/iconv.exe /usr/bin/install -c .libs/iconv.exe /tmp/inst/bin/iconv.exe gcc -I/usr/local/cygwin64/include -Wall -g -O2 -L/usr/local/cygwin64/lib -I../srclib -I../../srclib -I.. -DHAVE_CONFIG_H -DIN_RELOCWRAPPER -DNO_XMALLOC -DINSTALLPREFIX="/tmp/inst" -DINSTALLDIR="/tmp/inst/bin" -DLIBPATHVAR="PATH" -DLIBDIRS="/tmp/inst/lib", -DEXEEXT=".exe" ../../srclib/relocwrapper.c ../../srclib/progname.c ../../srclib/progreloc.c ../../srclib/areadlink.c ../../srclib/careadlinkat.c ../../srclib/allocator.c ../../srclib/strerror-override.c ../../srclib/stat.c ../../srclib/lstat.c ../../srclib/readlink.c ../../srclib/canonicalize-lgpl.c ../../srclib/malloca.c ../../srclib/relocatable.c ../../srclib/setenv.c ../../srclib/strerror.c ../../srclib/c-ctype.c -o /tmp/inst/bin/iconv.wrapper.exe In file included from /usr/include/sys/_types.h:159:0, from /usr/include/sys/reent.h:15, from /usr/include/sys/errno.h:11, from /usr/include/errno.h:9, from ../../srclib/strerror-override.h:21, from ../../srclib/strerror-override.c:22: ../../srclib/strerror-override.h:53:38: error: expected identifier or '(' before 'void' # define strerror_override(ignored) NULL ^ ../../srclib/strerror-override.c:35:1: note: in expansion of macro 'strerror_override' strerror_override (int errnum) ^ ../../srclib/strerror-override.h:53:38: error: expected ')' before numeric constant # define strerror_override(ignored) NULL ^ ../../srclib/strerror-override.c:35:1: note: in expansion of macro 'strerror_override' strerror_override (int errnum) ^ make[1]: *** [Makefile:115: install] Error 1 This is caused by the fix from http://lists.gnu.org/archive/html/bug-gnulib/2014-08/msg00001.html that was added on 2014-08-07. It contained several mistakes: - Adding strerror-override.c to the compilation runs against the intent of the change from 2011-05-21 relocatable-prog-wrapper: Assume strerror() exists. - Some .o files were not removed. - Source files were not listed in module description. Additionally, my change from 2011-05-21 also had two mistakes: - It should have done #undef strerror to avoid dragging in rpl_strerror. - It should have removed the dependency to the 'intprops' module. This fixes it. 2016-11-19 Bruno Haible <br...@clisp.org> relocatable-prog-wrapper: Fix breakage on Cygwin. * modules/relocatable-prog-wrapper (Files): Add lib/stat.c, lib/lstat.c. (Depends-on): Remove intprops. * lib/relocwrapper.c: Update dependency tree. (strerror): Undefine. * build-aux/install-reloc (func_create_wrapper): Do not compile strerror.c and strerror-override.c. Erase stat.o and lstat.o. diff --git a/lib/relocwrapper.c b/lib/relocwrapper.c index 5eefa2b..69a6e98 100644 --- a/lib/relocwrapper.c +++ b/lib/relocwrapper.c @@ -19,16 +19,23 @@ relocwrapper -> progname -> progreloc - -> areadlink - -> careadlinkat + -> areadlink + -> careadlinkat -> allocator - -> readlink - -> canonicalize-lgpl - -> malloca - -> readlink + -> readlink + -> stat + -> dosname + -> pathmax + -> verify + -> canonicalize-lgpl + -> malloca + -> lstat + -> readlink -> relocatable -> setenv -> malloca + -> fprintf-posix [ignore, cut dependency tree here] + -> strerror [ignore, cut dependency tree here] -> c-ctype Macros that need to be set while compiling this file: @@ -60,6 +67,7 @@ /* Use the system functions, not the gnulib overrides in this file. */ #undef fprintf +#undef strerror /* Return a copy of the filename, with an extra ".bin" at the end. More generally, it replaces "${EXEEXT}" at the end with ".bin${EXEEXT}". */ diff --git a/modules/relocatable-prog-wrapper b/modules/relocatable-prog-wrapper index a75b426..50444b1 100644 --- a/modules/relocatable-prog-wrapper +++ b/modules/relocatable-prog-wrapper @@ -15,9 +15,11 @@ lib/careadlinkat.c lib/allocator.h lib/allocator.c lib/readlink.c +lib/stat.c lib/canonicalize-lgpl.c lib/malloca.h lib/malloca.c +lib/lstat.c lib/relocatable.h lib/relocatable.c lib/setenv.c @@ -43,7 +45,6 @@ stdint stdlib unistd environ -intprops string verify diff --git a/build-aux/install-reloc b/build-aux/install-reloc index 979a056..1a2b5a4 100755 --- a/build-aux/install-reloc +++ b/build-aux/install-reloc @@ -232,15 +232,13 @@ func_create_wrapper () "$srcdir"/areadlink.c \ "$srcdir"/careadlinkat.c \ "$srcdir"/allocator.c \ - "$srcdir"/strerror-override.c \ - "$srcdir"/stat.c \ - "$srcdir"/lstat.c \ "$srcdir"/readlink.c \ + "$srcdir"/stat.c \ "$srcdir"/canonicalize-lgpl.c \ "$srcdir"/malloca.c \ + "$srcdir"/lstat.c \ "$srcdir"/relocatable.c \ "$srcdir"/setenv.c \ - "$srcdir"/strerror.c \ "$srcdir"/c-ctype.c \ -o "$destprog.wrapper$exeext" rc=$? @@ -253,11 +251,12 @@ func_create_wrapper () careadlinkat.o \ allocator.o \ readlink.o \ + stat.o \ canonicalize-lgpl.o \ malloca.o \ + lstat.o \ relocatable.o \ setenv.o \ - strerror.o \ c-ctype.o test $rc = 0 || exit $? # Clean up debugging information left over by the native C compiler on MacOS X.