On 2013-04-16 15:00, Patrick 'P. J.' McDermott wrote: [...] > > I'm trying to build and install GCC 4.7.2, and I'm getting the following > error from the "install-mkheaders" target of gcc/Makefile: [...] > > The deletion of syslimits.h, movement of limits.h to syslimits.h, and > change to the metadata of syslimits.h all look like the behavior of the > "stmp-fixinc" target. But as far as I can tell that target isn't being > updated with the top-level "install" target. (Nor should it be, as far > as I know.) > > Does anyone have any idea what's happening here? Why is > gcc/include-fixed/limits.h being moved when updating the "install" > target?
I've found the issue. I'm using build helper utilities (similar to Debian's debhelper) to build a distribution package of GCC. The utility that runs `make install` first checks for an "install" target by running `make -n install` [1], which is supposed to perform a dry run and print commands without executing them. (debhelper's dh_auto_install does this check as well [2].) Running `make -n install` (or `MAKEFLAGS=n make install`) in GCC (4.7 at least – I haven't tested 4.8 yet) instead actually executes commands. Additionally, it updates the "stmp-fixinc" target of gcc/Makefile, which as far as I can tell should not be updated with the top-level "install" target. As a result, gcc/include-fixed/limits.h is moved to gcc/include-fixed/syslimits.h, which causes the installation of a fixed limits.h in the "install-mkheaders" target of gcc/Makefile to fail. Example: $ ../src/configure [...] [...] $ make bootstrap-lean [...] $ cp -Rp . ../gcc-build.build # Backup the build dir for comparison $ make -n install [...] rm -rf include-fixed; mkdir include-fixed chmod a+rx include-fixed if [ -d ../prev-gcc ]; then \ cd ../prev-gcc && \ make real-install-headers-tar DESTDIR=`pwd`/../gcc/ \ libsubdir=. ; \ else \ set -e; for ml in `cat fixinc_list`; do \ sysroot_headers_suffix=`echo ${ml} | sed -e 's/;.*$//'`; \ multi_dir=`echo ${ml} | sed -e 's/^[^;]*;//'`; \ fix_dir=include-fixed${multi_dir}; \ [...] rm -f ${fix_dir}/syslimits.h; \ if [ -f ${fix_dir}/limits.h ]; then \ mv ${fix_dir}/limits.h ${fix_dir}/syslimits.h; \ else \ cp ../../src/gcc/gsyslimits.h ${fix_dir}/syslimits.h; \ fi; \ chmod a+r ${fix_dir}/syslimits.h; \ done; \ fi [...] $ diff -Nur ../gcc-build.build . | diffstat -b diff: ../gcc-build.build/x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stamp-bits: Too many levels of symbolic links diff: ./x86_64-unknown-linux-gnu/libstdc++-v3/include/bits/stamp-bits: Too many levels of symbolic links include-fixed/limits.h | 172 ------------------------------------------- include-fixed/syslimits.h | 180 +++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 172 insertions(+), 180 deletions(-) The execution of commands appears to be caused by the use of the "MAKE" macro [3], e.g. this line in the long command in the "stmp-fixinc" target: $(MAKE) real-$(INSTALL_HEADERS_DIR) DESTDIR=`pwd`/../gcc/ \ So this is partly an issue in the way GCC's makefiles use "$(MAKE)" in long commands and mostly an issue in the (arguably non-standard and surprising) way GNU Make (and System V make) treats commands that contain "$(MAKE)". (Relevant: threads [4][5][6] on GNU Make mailing lists and the discussion of proposals for -n and $(MAKE) behavior in POSIX.1 [7].) It could be avoided by defining a new macro, e.g. `_MAKE = $(MAKE)` and replacing all expansions of MAKE in commands with expansions of the new macro, e.g.: $(_MAKE) real-$(INSTALL_HEADERS_DIR) DESTDIR=`pwd`/../gcc/ \ Thoughts? [1]: http://git.proteanos.com/opkhelper/opkhelper.git/tree/lib/buildsystem/make.sh?id=bf055e8#n99 [2]: http://anonscm.debian.org/gitweb/?p=debhelper/debhelper.git;a=blob;f=Debian/Debhelper/Buildsystem/makefile.pm;h=c63b58e#l13 [3]: https://www.gnu.org/software/make/manual/html_node/MAKE-Variable.html [4]: https://lists.gnu.org/archive/html/bug-make/2010-01/msg00014.html [5]: https://lists.gnu.org/archive/html/help-make/2003-06/msg00048.html [6]: https://lists.gnu.org/archive/html/help-make/2008-07/msg00017.html [7]: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/make.html#tag_20_76_18 -- Patrick "P. J." McDermott http://www.pehjota.net/ http://www.pehjota.net/contact.html