GNU bug report logs - #8473
depcomp bug with HP-UX cc and VPATH build

Previous Next

Package: automake;

Reported by: Bruno Haible <bruno <at> clisp.org>

Date: Mon, 11 Apr 2011 00:45:06 UTC

Severity: normal

Done: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Bruno Haible <bruno <at> clisp.org>
Subject: bug#8473: closed (Re: bug#8473: depcomp bug with HP-UX cc and
 VPATH build)
Date: Mon, 11 Apr 2011 05:14:02 +0000
[Message part 1 (text/plain, inline)]
Your bug report

#8473: depcomp bug with HP-UX cc and VPATH build

which was filed against the automake package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to 8473 <at> debbugs.gnu.org.

-- 
8473: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8473
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Ralf Wildenhues <Ralf.Wildenhues <at> gmx.de>
To: Bruno Haible <bruno <at> clisp.org>, automake-patches <at> gnu.org
Cc: 8473-done <at> debbugs.gnu.org
Subject: Re: bug#8473: depcomp bug with HP-UX cc and VPATH build
Date: Mon, 11 Apr 2011 07:13:00 +0200
Hi Bruno,

* Bruno Haible wrote on Mon, Apr 11, 2011 at 02:44:48AM CEST:
> The dependencies mechanism of Automake leads to a compilation failure when
> used in a VPATH build (with GNU make, of course)

Actually, in this case you could have avoided this particular bug by
using HP make.  :-p

Automake still strives to be portable to non-GNU make, even if you have
decided to (understandably) not worry about the numerous and hideous
VPATH issues.

>   source='../../gllib/nonblocking.c' object='../../gllib/nonblocking.o' libtool=no \
>   DEPDIR=.deps depmode=hp /bin/sh ../../build-aux/depcomp \
>   cc -Ae -O -DHAVE_CONFIG_H -I. -I../../gllib -I..  -DGNULIB_STRICT_CHECKING=1   -g -c ../../gllib/nonblocking.c
>   cpp: "", line 0: error 4066: Cannot create "../../gllib/.deps/nonblocking.TPo" file for "-M../../gllib/.deps/nonblocking.TPo" option. (No such file or directory[errno=2])
>   gmake[4]: *** [../../gllib/nonblocking.o] Error 1

How nice, I just fixed a similar bug in makedepend mode last week.

I'm pushing this to maint (and merging to branch-1.11 and master) to fix
the above.

Thanks for the report,
Ralf

    Fix hp depmode for VPATH builds with GNU make.
    
    * lib/depcomp: Be sure to remove VPATH-prefixed object from
    dependency output when creating stub rule.
    * tests/depcomp10.test: New test.
    * tests/Makefile.am (TESTS): Update.
    * NEWS: Update.
    Report by Bruno Haible.

diff --git a/NEWS b/NEWS
index 3cd5ab0..c8219bd 100644
--- a/NEWS
+++ b/NEWS
@@ -57,7 +57,7 @@ Bugs fixed in 1.11.0a:
   - The parallel-tests driver now does not produce erroneous results
     with Tru64/OSF 5.1 sh upon unreadable log files any more.
 
-  - The makedepend depmode now works better with VPATH builds.
+  - The makedepend and hp depmodes now works better with VPATH builds.
 
   - Java sources specified with check_JAVA are not compiled anymore upon
     "make all", but only upon "make check".
diff --git a/lib/depcomp b/lib/depcomp
index 8097c19..e996e5d 100755
--- a/lib/depcomp
+++ b/lib/depcomp
@@ -1,7 +1,7 @@
 #! /bin/sh
 # depcomp - compile a program generating dependencies as side-effects
 
-scriptversion=2011-04-09-11; # UTC
+scriptversion=2011-04-11-05; # UTC
 
 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009, 2011,
 # Free Software Foundation, Inc.
@@ -158,10 +158,12 @@ gcc)
 ' < "$tmpdepfile" |
 ## Some versions of gcc put a space before the `:'.  On the theory
 ## that the space means something, we add a space to the output as
-## well.
+## well.  hp depmode also adds that space, but also prefixes the VPATH
+## to the object.  Take care to not repeat it in the output.
 ## Some versions of the HPUX 10.20 sed can't process this invocation
 ## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+    sed -e 's/^\\$//' -e '/^$/d' -e -e "s|.*$object$||" '/:$/d' \
+      | sed -e 's/$/ :/' >> "$depfile"
   rm -f "$tmpdepfile"
   ;;
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index bf07f2b..4e87805 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -278,6 +278,7 @@ depcomp7.test \
 depcomp8a.test \
 depcomp8b.test \
 depcomp9.test \
+depcomp10.test \
 depdist.test \
 depend.test \
 depend2.test \
diff --git a/tests/depcomp10.test b/tests/depcomp10.test
new file mode 100644
index 0000000..4fdee40
--- /dev/null
+++ b/tests/depcomp10.test
@@ -0,0 +1,81 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# hp depmode should work with GNU make in VPATH mode (bug similar to
+# depcomp9.test).
+
+# Here's the bug: hp depmode will prefix VPATH to the object file name,
+# thus the second gmake will invoke depcomp with object='../../src/foo.o',
+# causing errors such as:
+#   cpp: "", line 0: error 4066: Cannot create "../../gllib/.deps/nonblocking.TPo" file for "-M../../gllib/.deps/nonblocking.TPo" option. (No such file or dir
++ectory[errno=2])
+
+required=GNUmake
+. ./defs || Exit 1
+
+mkdir src src/sub build
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_CC_C_O
+AC_CONFIG_FILES([src/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = src
+END
+
+cat > src/Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c foo.h sub/subfoo.c
+END
+
+cat > src/foo.h <<EOF
+extern int subfoo (void);
+EOF
+
+cat >src/foo.c <<EOF
+#include "foo.h"
+int main (void)
+{
+  return subfoo ();
+}
+EOF
+
+cat >src/sub/subfoo.c <<EOF
+#include "foo.h"
+int subfoo (void)
+{
+  return 0;
+}
+EOF
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+cd build
+../configure am_cv_CC_dependencies_compiler_type=hp
+$MAKE || Exit 77
+$MAKE clean
+
+$MAKE >out 2>&1 || { cat out; Exit 1; }
+cat out
+grep 'src/[._]deps' out && Exit 1
+
+:

[Message part 3 (message/rfc822, inline)]
From: Bruno Haible <bruno <at> clisp.org>
To: bug-automake <at> gnu.org
Subject: depcomp bug with HP-UX cc and VPATH build
Date: Mon, 11 Apr 2011 02:44:48 +0200
Hi,

The dependencies mechanism of Automake leads to a compilation failure when
used in a VPATH build (with GNU make, of course) and HP-UX cc. The failure
occurs during the third command of this command sequence:
  $ gmake
  $ gmake clean
  $ gmake
  ...
  gmake[4]: Entering directory `/tmp/testdir1/build-vpath/gllib'
  source='../../gllib/nonblocking.c' object='../../gllib/nonblocking.o' libtool=no \
  DEPDIR=.deps depmode=hp /bin/sh ../../build-aux/depcomp \
  cc -Ae -O -DHAVE_CONFIG_H -I. -I../../gllib -I..  -DGNULIB_STRICT_CHECKING=1   -g -c ../../gllib/nonblocking.c
  cpp: "", line 0: error 4066: Cannot create "../../gllib/.deps/nonblocking.TPo" file for "-M../../gllib/.deps/nonblocking.TPo" option. (No such file or directory[errno=2])
  gmake[4]: *** [../../gllib/nonblocking.o] Error 1


Relevant software in use:

$ automake --version
automake (GNU automake) 1.11.1

$ autoconf --version
autoconf (GNU Autoconf) 2.68

$ uname -sr 
HP-UX B.11.00

$ gmake --version
GNU Make version 3.79.1, by Richard Stallman and Roland McGrath.
Built for hppa1.1-hp-hpux11.00

$ what `which cc`
/opt/ansic/bin/cc:
        $Revision: 92453-07 linker linker crt0.o B.11.47 051104 $
        LINT B.11.X.35098-35101.GP CXREF B.11.X.35098-35101.GP
        HP92453-01 B.11.X.35098-35101.GP HP C Compiler
         $ PATCH/11.00:PHCO_27774  Oct  3 2002 09:45:59 $ 

How to reproduce:

- Create a gnulib testdir for module 'nonblocking'.
  $ ./gnulib-tool --create-testdir --dir=/tmp/testdir nonblocking
- Transport it to the HP-UX 11.00 machine.
- On this machine, start 'bash', then
$ export PATH=/opt/langtools/bin:$PATH
$ export CC="cc -Ae -O"
$ mkdir build-vpath
$ cd build-vpath
$ ../configure
$ gmake
$ gmake clean
$ gmake

In a build with $(builddir) = $(srcdir), there is no problem.

Bruno
-- 
In memoriam Hendrik Nicolaas Werkman <http://en.wikipedia.org/wiki/Hendrik_Nicolaas_Werkman>



This bug report was last modified 14 years and 50 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.