From debbugs-submit-bounces@debbugs.gnu.org Sun Aug 05 14:30:11 2012 Received: (at submit) by debbugs.gnu.org; 5 Aug 2012 18:30:11 +0000 Received: from localhost ([127.0.0.1]:35792 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sy5ac-0002gL-4r for submit@debbugs.gnu.org; Sun, 05 Aug 2012 14:30:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57623) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SxxWN-0002oM-Vs for submit@debbugs.gnu.org; Sun, 05 Aug 2012 05:53:17 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxxOq-00081p-FX for submit@debbugs.gnu.org; Sun, 05 Aug 2012 05:45:29 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:53763) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxxOq-00081l-CI for submit@debbugs.gnu.org; Sun, 05 Aug 2012 05:45:28 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44911) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxxOp-0006Sh-CY for bug-automake@gnu.org; Sun, 05 Aug 2012 05:45:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SxxOm-00081M-CN for bug-automake@gnu.org; Sun, 05 Aug 2012 05:45:27 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:47930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SxxOm-00081I-6g for bug-automake@gnu.org; Sun, 05 Aug 2012 05:45:24 -0400 Received: from pomiocik.lan (213-238-106-67.adsl.inetia.pl [213.238.106.67]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id EC51367A1D; Sun, 5 Aug 2012 09:45:21 +0000 (UTC) Date: Sun, 5 Aug 2012 11:45:51 +0200 From: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= To: bug-automake@gnu.org Subject: automake tries to compile a program when 'foo' and 'foo.cxx' exist (though the former is header) Message-ID: <20120805114551.0b42412d@pomiocik.lan> Organization: Gentoo X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.11; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA256; boundary="Sig_/vjVly_LOeC6WskA1O_LRqbC"; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 05 Aug 2012 14:30:08 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) --Sig_/vjVly_LOeC6WskA1O_LRqbC Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable autoconf: 2.69 automake: 1.12.2 libtool: 2.4.2 Hello, I was writing a C++ library and I think I hit a pretty ugly bug within automake. My library was structured like the following: - src/foo (the header file), - src/foo.cxx (the code). These files assemble a library, let's call it libfoo.la. The problem is that every time I modify src/foo.cxx and call 'make', automake first (correctly) compiles the library, and then mistakenly tries to compile and link it into a program src/foo, either effectively overwriting or removing my header file, or failing early due to missing dependency file. What's interesting, 'make' calls not following src/foo.cxx changes work correctly; just the one after modifying src/foo.cxx fails. Here are the minimal configure.ac & Makefile.am files with which I can reproduce the issue: configure.ac: AC_PREREQ([2.60]) AC_INIT([foo], [0]) AM_INIT_AUTOMAKE([1.6 foreign]) AC_PROG_CXX LT_INIT AC_CONFIG_HEADERS([config.h]) AC_CONFIG_FILES([Makefile]) AC_OUTPUT Makefile.am: include_HEADERS =3D src/foo lib_LTLIBRARIES =3D libfoo.la libfoo_la_SOURCES =3D src/foo.cxx I've also prepared a git repository with the simple test case: git clone https://bitbucket.org/mgorny/automake-cxx-bug.git cd automake-cxx-bug autoreconf -vi ./configure --disable-static make # compiles fine touch src/foo.cxx make # fails Related Gentoo bug report: https://bugs.gentoo.org/show_bug.cgi?id=3D429972 --=20 Best regards, Micha=C5=82 G=C3=B3rny --Sig_/vjVly_LOeC6WskA1O_LRqbC Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iJwEAQEIAAYFAlAeQNQACgkQfXuS5UK5QB1V/AQAgx0EU1tAzhIoJADksGNRr7ZU osj6wBobUTDWEqClqojqKHMmkxN6aEqbJI5JTDUdxO2jCn4xrHpxz32SieEJUc6E fnnGB92wRvwl6dywHHG5n4YZK4wrOa1nO3DYPIJeord6B9JK5emAXEtf1B/07o79 aSCG57h4QduiftNE454= =Wfb7 -----END PGP SIGNATURE----- --Sig_/vjVly_LOeC6WskA1O_LRqbC-- From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 06 03:46:12 2012 Received: (at 12142) by debbugs.gnu.org; 6 Aug 2012 07:46:13 +0000 Received: from localhost ([127.0.0.1]:36590 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SyI0y-0004cP-IC for submit@debbugs.gnu.org; Mon, 06 Aug 2012 03:46:12 -0400 Received: from mail-bk0-f44.google.com ([209.85.214.44]:42412) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SyI0v-0004cG-Kp for 12142@debbugs.gnu.org; Mon, 06 Aug 2012 03:46:10 -0400 Received: by bkty7 with SMTP id y7so1075728bkt.3 for <12142@debbugs.gnu.org>; Mon, 06 Aug 2012 00:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=nFiSjFyMSKgyV+1Gk/Ub3nuweyum4JLp9ImtMeYByfg=; b=GueiQMDrcAiDoDk1eX3odDD6xRxx/ZQZbjy9JT2gidiMAPnvqUbNc22M8km5ISZGhL fYXbNsVpMt6R1ok0MCvd4O7ZPyXnPels7GwqQKRpVq9vKRBsCLvD8SXBa2Y5A1LWhpjG tfvSGThwCHGYRVyB6EE6KBtsThDhKYquOBDLk/Q2QtKrfL2+Mn/aT0MR9/EJxeRXphiy 8KVz25TZzrlcNU32AtdyHATrmElTJtuCFqBMb7HRs74u1VF7eJie3EBf6V0h1ZHMJOnm XPTS1qBE0Yzw8Kw/hXikH220eMkqfvrp4t+wxNz1/xC2rPtJql3JNtbESQ41rAEJ4j92 7qmw== Received: by 10.205.119.208 with SMTP id fv16mr3820612bkc.100.1344238697148; Mon, 06 Aug 2012 00:38:17 -0700 (PDT) Received: from [192.168.178.21] (host152-95-dynamic.2-87-r.retail.telecomitalia.it. [87.2.95.152]) by mx.google.com with ESMTPS id hg13sm6845379bkc.7.2012.08.06.00.38.15 (version=SSLv3 cipher=OTHER); Mon, 06 Aug 2012 00:38:16 -0700 (PDT) Message-ID: <501F7460.7030604@gmail.com> Date: Mon, 06 Aug 2012 09:38:08 +0200 From: Stefano Lattarini MIME-Version: 1.0 To: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= Subject: Re: bug#12142: automake tries to compile a program when 'foo' and 'foo.cxx' exist (though the former is header) References: <20120805114551.0b42412d@pomiocik.lan> In-Reply-To: <20120805114551.0b42412d@pomiocik.lan> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 12142 Cc: 12142@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) tags 12142 notabug thanks On 08/05/2012 11:45 AM, Michał Górny wrote: > autoconf: 2.69 > automake: 1.12.2 > libtool: 2.4.2 > Also, which version of make are you using? > Hello, > > I was writing a C++ library and I think I hit a pretty ugly bug within > automake. > What you describe below is not an Automake bug, but an unexpected interaction with the GNU make built-in rules. That is, GNU make contains (among other stuff) a built-in rule to compile programs from a C++ source files: and that is being somehow invoked as an unindented consequence of your declarations. More details below. > My library was structured like the following: > > - src/foo (the header file), > Why not simply using a more usual name like 'foo.h' for 'foo.hxx'? That would be unlikely to trigger unexpected problems in the first place ... > - src/foo.cxx (the code). > > These files assemble a library, let's call it libfoo.la. > > The problem is that every time I modify src/foo.cxx and call 'make', > automake > No, automake is doing nothing at this point. It's make that does the building and compiling, using both the instructions given in the Automake-generated Makefile and its own built-in rules. And it's one the latter that is wreaking havoc here. first (correctly) compiles the library, and then mistakenly > tries to compile and link it into a program src/foo, either effectively > overwriting or removing my header file, or failing early due to > missing dependency file. > I guess this doesn't happen if you run make with the '--no-builtin-rules' option. And in fact ... > What's interesting, 'make' calls not following src/foo.cxx changes work > correctly; just the one after modifying src/foo.cxx fails. > I've also prepared a git repository with the simple test case: > > git clone https://bitbucket.org/mgorny/automake-cxx-bug.git > cd automake-cxx-bug > autoreconf -vi > ./configure --disable-static > make # compiles fine > touch src/foo.cxx > make # fails > ... I've tried this out and verified that my diagnosis is correct. Bottom line: to avoid the issue, either rename the header file (the sanest thing to do IMO), or ensure make gets always run with the '--no-builtin-rules' option. Regards, Stefano From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 06 04:49:20 2012 Received: (at 12142) by debbugs.gnu.org; 6 Aug 2012 08:49:20 +0000 Received: from localhost ([127.0.0.1]:36639 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SyJ03-000626-Rb for submit@debbugs.gnu.org; Mon, 06 Aug 2012 04:49:20 -0400 Received: from mail-wg0-f46.google.com ([74.125.82.46]:55278) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SyIzz-00061v-QM for 12142@debbugs.gnu.org; Mon, 06 Aug 2012 04:49:16 -0400 Received: by wgbdq10 with SMTP id dq10so2133122wgb.15 for <12142@debbugs.gnu.org>; Mon, 06 Aug 2012 01:41:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=AfhyqyRwH/slj0jSBr0jkbxBg9EW8H+HjsXvhhOb1DQ=; b=L5qjQwCgp3IOwpqABND2HlxkUfraGUxGyLMIqoAlAVLJ1x/cfu7ji108yKYMHUXAVM RKarVYxhNXnfF0bmPaXMBrtrm8g6bNiyEtI/NLDr4TtfOunofL/w8wlcB8Jmpg8AUDcY BMu1r1hf8pcj8zUJUfAvZA4IwsKk1wG5wVB2+xQz9a8hTo5Dc8NdWM49mNsnrsHnES5U jkHgXrfv8w8ujihBjwS2J5+dDqemkFqy2BAS3DacYfwgLIU/zfISbNHq0xeE7rKQxEF3 1Mu5cQWvWVlFpE+JKcIFi4URV+XDLfH4cnQp3pzXLNuEMPAvE6VpEjp3rFR8s5RDjMfz VoTw== MIME-Version: 1.0 Received: by 10.216.99.199 with SMTP id x49mr5425170wef.171.1344242483178; Mon, 06 Aug 2012 01:41:23 -0700 (PDT) Received: by 10.194.93.196 with HTTP; Mon, 6 Aug 2012 01:41:23 -0700 (PDT) In-Reply-To: <501F7460.7030604@gmail.com> References: <20120805114551.0b42412d@pomiocik.lan> <501F7460.7030604@gmail.com> Date: Mon, 6 Aug 2012 18:41:23 +1000 X-Google-Sender-Auth: T-4swQ-V1kbv8HsUYp-T2t9tfEo Message-ID: Subject: Re: bug#12142: automake tries to compile a program when 'foo' and 'foo.cxx' exist (though the former is header) From: Jack Kelly To: Stefano Lattarini Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 12142 Cc: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= , 12142@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On Mon, Aug 6, 2012 at 5:38 PM, Stefano Lattarini wrote: > On 08/05/2012 11:45 AM, Micha=C5=82 G=C3=B3rny wrote: >> My library was structured like the following: >> >> - src/foo (the header file), >> > Why not simply using a more usual name like 'foo.h' for 'foo.hxx'? > That would be unlikely to trigger unexpected problems in the first > place ... I have a feeling it's mimicking the way modern C++ prefers `#include ' over `#include ' I propose a third fix: move the header file into a separate directory such as `include/' and add `-I$(top_srcdir)/include' to AM_CPPFLAGS. Is it worth providing a way to disable implicit rules as an option to AM_INIT_AUTOMAKE or via the AUTOMAKE_OPTIONS variable? It's not enough to pass --no-builtin-rules to AM_MAKEFLAGS as I don't know if that's portable. Further, the MAKEFLAGS only get propagated to submakes: the top-level make has already loaded the implicit rules before it sees MAKEFLAGS. -- Jack From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 06 04:57:02 2012 Received: (at 12142) by debbugs.gnu.org; 6 Aug 2012 08:57:02 +0000 Received: from localhost ([127.0.0.1]:36648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SyJ7V-0006CB-TA for submit@debbugs.gnu.org; Mon, 06 Aug 2012 04:57:02 -0400 Received: from mail-bk0-f44.google.com ([209.85.214.44]:32819) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SyJ7T-0006Bw-OS for 12142@debbugs.gnu.org; Mon, 06 Aug 2012 04:57:00 -0400 Received: by bkty7 with SMTP id y7so1100770bkt.3 for <12142@debbugs.gnu.org>; Mon, 06 Aug 2012 01:49:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=MbBLPkZpHT66dqGfVy8GjzgZZ+Lj0lv2RcS3Max3nYI=; b=WoxTW8p+jMevd+lQaFWQsyOpVRVrx+Krb9vaG5v6Z/qAQOvdStMn5BA5HJe60wzcB+ dO+j4J5xipjzV6zEdtJrd0knE/Sn7zjtQv19FNVNo7kik5FJm4GumUVkIRR3hukaxp1k sqJayhkxb506svDcs2vfn8h4aMPWLEdt+utM81/78ytp6QTzsNBGHzktkVBRVVyAx+tk xKqgWipiKLI17VcfnUrzTtIy1JzOxxp3FOMgPd3dgVZkbX63M5aitTra488YaOFW8qVe vQfSH5Pankj7IxsuvONWD/Kv984v0WJUgw5pD2lhHY2LkS2oqf7QnEW6zppK5RFLZMRG 773A== Received: by 10.204.156.17 with SMTP id u17mr3892780bkw.52.1344242946852; Mon, 06 Aug 2012 01:49:06 -0700 (PDT) Received: from [192.168.178.21] (host152-95-dynamic.2-87-r.retail.telecomitalia.it. [87.2.95.152]) by mx.google.com with ESMTPS id he8sm6955746bkc.3.2012.08.06.01.49.05 (version=SSLv3 cipher=OTHER); Mon, 06 Aug 2012 01:49:06 -0700 (PDT) Message-ID: <501F84FF.6020905@gmail.com> Date: Mon, 06 Aug 2012 10:49:03 +0200 From: Stefano Lattarini MIME-Version: 1.0 To: Jack Kelly Subject: Re: bug#12142: automake tries to compile a program when 'foo' and 'foo.cxx' exist (though the former is header) References: <20120805114551.0b42412d@pomiocik.lan> <501F7460.7030604@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 12142 Cc: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= , 12142@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 08/06/2012 10:41 AM, Jack Kelly wrote: > On Mon, Aug 6, 2012 at 5:38 PM, Stefano Lattarini > wrote: >> On 08/05/2012 11:45 AM, Michał Górny wrote: >>> My library was structured like the following: >>> >>> - src/foo (the header file), >>> >> Why not simply using a more usual name like 'foo.h' for 'foo.hxx'? >> That would be unlikely to trigger unexpected problems in the first >> place ... > > I have a feeling it's mimicking the way modern C++ prefers `#include > ' over `#include ' > > I propose a third fix: move the header file into a separate directory > such as `include/' and add `-I$(top_srcdir)/include' to AM_CPPFLAGS. > This seems unwarranted complexity just for the sake of an eye-candy like "#include " over "#include ". But of course, that is for the OP to decide. > Is it worth providing a way to disable implicit rules as an option to > AM_INIT_AUTOMAKE or via the AUTOMAKE_OPTIONS variable? > Trying to do that portably would be a nightmare I think (assuming it would be possible at all). OTOH, Automake-NG (the Automake fork whose generated Makefiles only target GNU make) does that unconditionally (for performance rather than correctness reasons): > It's not enough to pass --no-builtin-rules to AM_MAKEFLAGS as I don't > know if that's portable. > In fact, it's not. > Further, the MAKEFLAGS only get propagated to submakes: the > top-level make has already loaded the implicit rules before it sees > MAKEFLAGS. > Luckily, with GNU make, you can append to MAKEFLAGS in the Makefile: MAKEFLAGS += -r and have that take effect in the current make run as well. Regards, Stefano From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 06 05:27:45 2012 Received: (at 12142) by debbugs.gnu.org; 6 Aug 2012 09:27:45 +0000 Received: from localhost ([127.0.0.1]:36738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SyJbF-0006tQ-Hd for submit@debbugs.gnu.org; Mon, 06 Aug 2012 05:27:45 -0400 Received: from smtp.gentoo.org ([140.211.166.183]:41607) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SyJbD-0006tH-AD for 12142@debbugs.gnu.org; Mon, 06 Aug 2012 05:27:44 -0400 Received: from pomiocik.lan (77-254-77-13.adsl.inetia.pl [77.254.77.13]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 4EA431B4021; Mon, 6 Aug 2012 09:19:49 +0000 (UTC) Date: Mon, 6 Aug 2012 11:20:22 +0200 From: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= To: Stefano Lattarini Subject: Re: bug#12142: automake tries to compile a program when 'foo' and 'foo.cxx' exist (though the former is header) Message-ID: <20120806112022.168b6662@pomiocik.lan> In-Reply-To: <501F7460.7030604@gmail.com> References: <20120805114551.0b42412d@pomiocik.lan> <501F7460.7030604@gmail.com> Organization: Gentoo X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.11; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA256; boundary="Sig_/1dgHdM5QcmIU9jGy5mQ7Nco"; protocol="application/pgp-signature" X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 12142 Cc: 12142@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) --Sig_/1dgHdM5QcmIU9jGy5mQ7Nco Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Mon, 06 Aug 2012 09:38:08 +0200 Stefano Lattarini wrote: > On 08/05/2012 11:45 AM, Micha=C5=82 G=C3=B3rny wrote: > > autoconf: 2.69 > > automake: 1.12.2 > > libtool: 2.4.2 > > > Also, which version of make are you using? GNU Make 3.82 > > My library was structured like the following: > >=20 > > - src/foo (the header file), > > > Why not simply using a more usual name like 'foo.h' for 'foo.hxx'? > That would be unlikely to trigger unexpected problems in the first > place ... Because it is a legit name. > > - src/foo.cxx (the code). > >=20 > > These files assemble a library, let's call it libfoo.la. > >=20 > > The problem is that every time I modify src/foo.cxx and call 'make', > > automake > > > No, automake is doing nothing at this point. It's make that does the > building and compiling, using both the instructions given in the > Automake-generated Makefile and its own built-in rules. And it's one > the latter that is wreaking havoc here. >=20 > first (correctly) compiles the library, and then mistakenly > > tries to compile and link it into a program src/foo, either > > effectively overwriting or removing my header file, or failing > > early due to missing dependency file. > > > I guess this doesn't happen if you run make with the > '--no-builtin-rules' option. And in fact ... You are right indeed. However, AFAICS it's not exactly that simple. Automake-generated Makefile first clears the default suffix list, then explicitly adds new suffixes. Is there a reason for that? Just removing the second '.SUFFIXES: ...' line helps indeed. Yet it's probably not as portable as I'd like it to be. Still, it's worth considering if the explicit suffix list is beneficial at all. --=20 Best regards, Micha=C5=82 G=C3=B3rny --Sig_/1dgHdM5QcmIU9jGy5mQ7Nco Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.19 (GNU/Linux) iJwEAQEIAAYFAlAfjFsACgkQfXuS5UK5QB25aQQAgLYNxc49+Z0jZZ9dsgsMrUXM Z1Noc7zqLrN6XjdPxag80PA1Mn5Q9E+oJiG/uUJLONx7yQPBRzn0H2mT8ZiPkCEr tJEQ0V/dDUXfJkbc47bbzyv9SLpN70DSlMVaHzO45p012qxJqFTr/2X+h6GCwhQG qfw7mLaLw3hux1ZZLu8= =+NN7 -----END PGP SIGNATURE----- --Sig_/1dgHdM5QcmIU9jGy5mQ7Nco-- From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 07 12:20:48 2012 Received: (at 12142) by debbugs.gnu.org; 7 Aug 2012 16:20:48 +0000 Received: from localhost ([127.0.0.1]:39996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SymWW-0007m0-AP for submit@debbugs.gnu.org; Tue, 07 Aug 2012 12:20:48 -0400 Received: from mail-ey0-f172.google.com ([209.85.215.172]:53039) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SymWT-0007lr-JR for 12142@debbugs.gnu.org; Tue, 07 Aug 2012 12:20:46 -0400 Received: by eaai11 with SMTP id i11so1096660eaa.3 for <12142@debbugs.gnu.org>; Tue, 07 Aug 2012 09:12:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type:content-transfer-encoding; bh=OBhr9T0PodOm46SfsmUu4i6ElGvqgmnbrqFEsy4LyDs=; b=xbwSaO3j3OVda2PNM185+SH8GwviayODt9diS+dwXucAAGgwIdJ/7nQ+i3eI4UPcYX CCGhpV0WeYib5KRN3JfsD/VtPz0A4ZzkJCXgs4MAzHus/H9Rv3iB6dWtrZ55VMtklcal oXTZHrZIVEVZD7snZBsEAUiJIwzDCY1gTLJ1PMCY15VfBp7yynvPl7JPqpX06mFhH23Q wsUtzCa3LyETgRV2T5LP9cZDJqg3TgDwxX1qhG/LM4sCcE+UwOaB4xrbMfOhUUbqXANV MukX5GsitWcALwXydOC4dQp8ODrP2UK05j06MRoeMic2YHMtQcwUeaFVY266ifpSm1Bo KBJA== Received: by 10.14.218.5 with SMTP id j5mr4739717eep.16.1344355965415; Tue, 07 Aug 2012 09:12:45 -0700 (PDT) Received: from [192.168.178.21] (host152-95-dynamic.2-87-r.retail.telecomitalia.it. [87.2.95.152]) by mx.google.com with ESMTPS id 9sm57412768eei.12.2012.08.07.09.12.43 (version=SSLv3 cipher=OTHER); Tue, 07 Aug 2012 09:12:44 -0700 (PDT) Message-ID: <50213E7A.6040401@gmail.com> Date: Tue, 07 Aug 2012 18:12:42 +0200 From: Stefano Lattarini MIME-Version: 1.0 To: =?UTF-8?B?TWljaGHFgiBHw7Nybnk=?= Subject: Re: bug#12142: automake tries to compile a program when 'foo' and 'foo.cxx' exist (though the former is header) References: <20120805114551.0b42412d@pomiocik.lan> <501F7460.7030604@gmail.com> <20120806112022.168b6662@pomiocik.lan> In-Reply-To: <20120806112022.168b6662@pomiocik.lan> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 12142 Cc: 12142@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 08/06/2012 11:20 AM, Michał Górny wrote: > On Mon, 06 Aug 2012 09:38:08 +0200 > Stefano Lattarini wrote: > >> On 08/05/2012 11:45 AM, Michał Górny wrote: >>> autoconf: 2.69 >>> automake: 1.12.2 >>> libtool: 2.4.2 >>> >> Also, which version of make are you using? > > GNU Make 3.82 > OK, as I assumed. >>> My library was structured like the following: >>> >>> - src/foo (the header file), >>> >> Why not simply using a more usual name like 'foo.h' for 'foo.hxx'? >> That would be unlikely to trigger unexpected problems in the first >> place ... > > Because it is a legit name. > I'm not contending that, but if it's causing problems due to bugs or limitations of other important tools (GNU make, in this case), it would be a good idea not to do so anyway IMHO. Of course, you can agree to differ on this. >>> - src/foo.cxx (the code). >>> >>> These files assemble a library, let's call it libfoo.la. >>> >>> The problem is that every time I modify src/foo.cxx and call 'make', >>> automake >>> >> No, automake is doing nothing at this point. It's make that does the >> building and compiling, using both the instructions given in the >> Automake-generated Makefile and its own built-in rules. And it's one >> the latter that is wreaking havoc here. >> >> first (correctly) compiles the library, and then mistakenly >>> tries to compile and link it into a program src/foo, either >>> effectively overwriting or removing my header file, or failing >>> early due to missing dependency file. >>> >> I guess this doesn't happen if you run make with the >> '--no-builtin-rules' option. And in fact ... > > You are right indeed. However, AFAICS it's not exactly that simple. > Automake-generated Makefile first clears the default suffix list, then > explicitly adds new suffixes. Is there a reason for that? > Portability to some vendor make I believe. > Just removing the second '.SUFFIXES: ...' line helps indeed. > But that will cause the '.cxx.o' suffix rule to stop working with some make implementations. That's not something I prepared to risk lightly. > Yet it's > probably not as portable as I'd like it to be. Still, it's worth > considering if the explicit suffix list is beneficial at all. > I wouldn't if we could use pattern rules rather than suffix rules (Automake-NG does exactly that). But of course, they are not portable :-( Regards, Stefano From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 08 10:28:47 2012 Received: (at control) by debbugs.gnu.org; 8 Aug 2012 14:28:47 +0000 Received: from localhost ([127.0.0.1]:42414 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sz7Ff-0007cm-Fs for submit@debbugs.gnu.org; Wed, 08 Aug 2012 10:28:47 -0400 Received: from mail-bk0-f44.google.com ([209.85.214.44]:33431) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sz7Fa-0007cZ-MN for control@debbugs.gnu.org; Wed, 08 Aug 2012 10:28:46 -0400 Received: by bkty7 with SMTP id y7so355990bkt.3 for ; Wed, 08 Aug 2012 07:20:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:mime-version:to:subject:content-type :content-transfer-encoding; bh=W1eahnLkz+Fh7RQiFAZa5m2ttf12GLY2dnJjYR/8FoY=; b=pDWtgkQ3FMiRaYD6kPmQObOKW+AAP8f7Wqc2G+hJ6YxaP5kllvKcw8TbxPDVcrZ3zO jnfQtjwVeS7+pPLJ4bvGU0416Gwc9GRaAOBy+yp6nxAbaXRoHHjjlthfo5ua9Im4oiEK 2yYxnzs7QwgkoOOlIYJBiX8CQc5cIVIGKCYbkFihWPZQeT5o9L9tuwJJA2fB+uDUe9vb rMpESWtMfjNWqEk9fO+ZddE051M9uIekviPjqIYBfr0WL78I9l51uBIZPaBZX7QJ5oRr gj8GPfiW9xJmGGPK20+7XA+VUnzDhx5PylfHrCdDwULBWXP4EE16fA6ZE7gk1tyIoKSq BAaQ== Received: by 10.204.154.202 with SMTP id p10mr7700684bkw.105.1344435637186; Wed, 08 Aug 2012 07:20:37 -0700 (PDT) Received: from [192.168.178.21] (host152-95-dynamic.2-87-r.retail.telecomitalia.it. [87.2.95.152]) by mx.google.com with ESMTPS id c18sm10428650bkv.8.2012.08.08.07.20.33 (version=SSLv3 cipher=OTHER); Wed, 08 Aug 2012 07:20:34 -0700 (PDT) Message-ID: <502275AF.5090907@gmail.com> Date: Wed, 08 Aug 2012 16:20:31 +0200 From: Stefano Lattarini MIME-Version: 1.0 To: control@debbugs.gnu.org Subject: x Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) tags 12142 notabug thanks From debbugs-submit-bounces@debbugs.gnu.org Tue Aug 14 16:29:58 2012 Received: (at 12142) by debbugs.gnu.org; 14 Aug 2012 20:29:58 +0000 Received: from localhost ([127.0.0.1]:57065 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T1NkU-0003AI-4o for submit@debbugs.gnu.org; Tue, 14 Aug 2012 16:29:58 -0400 Received: from mx.scalarmail.ca ([98.158.95.75]:19619 helo=ironport-01.sms.scalar.ca) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1T1NkR-0003AA-IR for 12142@debbugs.gnu.org; Tue, 14 Aug 2012 16:29:56 -0400 Received: from unknown (HELO sms-zimbra-mta-01.sms.scalar.ca) ([192.168.32.56]) by ironport-01.sms.scalar.ca with ESMTP; 14 Aug 2012 16:21:15 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by sms-zimbra-mta-01.sms.scalar.ca (Postfix) with ESMTP id 17A4217F4B; Tue, 14 Aug 2012 16:21:15 -0400 (EDT) Received: from sms-zimbra-mta-01.sms.scalar.ca ([127.0.0.1]) by localhost (sms-zimbra-mta-01.sms.scalar.ca [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Dcptnik7SHuA; Tue, 14 Aug 2012 16:21:14 -0400 (EDT) Received: from mail.ellipticsemi.com (dsl-67-204-24-19.acanac.net [67.204.24.19]) (Authenticated sender: nbowler@elliptictech.com) by sms-zimbra-mta-01.sms.scalar.ca (Postfix) with ESMTPSA id 935D617F4A; Tue, 14 Aug 2012 16:21:13 -0400 (EDT) Received: by mail.ellipticsemi.com (nbSMTP-1.00) for uid 550 (using TLSv1/SSLv3 with cipher DHE-RSA-AES256-SHA (256/256 bits)) nbowler@mail.ellipticsemi.com; Tue, 14 Aug 2012 16:21:13 -0400 (EDT) Date: Tue, 14 Aug 2012 16:21:13 -0400 From: Nick Bowler To: Stefano Lattarini Subject: Re: bug#12142: automake tries to compile a program when 'foo' and 'foo.cxx' exist (though the former is header) Message-ID: <20120814202113.GA23436@elliptictech.com> References: <20120805114551.0b42412d@pomiocik.lan> <501F7460.7030604@gmail.com> <20120806112022.168b6662@pomiocik.lan> <50213E7A.6040401@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <50213E7A.6040401@gmail.com> Organization: Elliptic Technologies Inc. User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 12142 Cc: =?utf-8?B?TWljaGHFgiBHw7Nybnk=?= , 12142@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 2012-08-07 18:12 +0200, Stefano Lattarini wrote: > On 08/06/2012 11:20 AM, Michał Górny wrote: > > On Mon, 06 Aug 2012 09:38:08 +0200 > > Stefano Lattarini wrote: > > > >> On 08/05/2012 11:45 AM, Michał Górny wrote: [...] > >>> My library was structured like the following: > >>> > >>> - src/foo (the header file), [...] > >>> - src/foo.cxx (the code). > >>> > >>> These files assemble a library, let's call it libfoo.la. > >>> > >>> The problem is that every time I modify src/foo.cxx and call 'make', > >>> automake > >>> > >> No, automake is doing nothing at this point. It's make that does the > >> building and compiling, using both the instructions given in the > >> Automake-generated Makefile and its own built-in rules. And it's one > >> the latter that is wreaking havoc here. > >> > >> first (correctly) compiles the library, and then mistakenly > >>> tries to compile and link it into a program src/foo, either > >>> effectively overwriting or removing my header file, or failing > >>> early due to missing dependency file. > >>> > >> I guess this doesn't happen if you run make with the > >> '--no-builtin-rules' option. And in fact ... > > > > You are right indeed. However, AFAICS it's not exactly that simple. > > Automake-generated Makefile first clears the default suffix list, then > > explicitly adds new suffixes. Is there a reason for that? > > > Portability to some vendor make I believe. > > > Just removing the second '.SUFFIXES: ...' line helps indeed. > > > But that will cause the '.cxx.o' suffix rule to stop working with > some make implementations. That's not something I prepared to > risk lightly. The original test case URL no longer seems to be valid, so I can only guess what's actually happening at this point (please, reporters, attach test cases or post them inline to avoid link rot!) >From the discussion, it sounds to me like the problem is GNU make's built-in rule to link a binary from a single .o file, together with Automake's .cxx.o suffix rule, so you end up with the implicit rule chain foo.cxx -> foo.o -> foo Moreover, because some source file presumably #includes foo, Automake's automatic dependency tracking (or an explicit prerequisite in the Makefile) is causing make to try and update foo. Make sees that foo.cxx is newer than foo, so it carries out the rules to update foo. Fortunately, the workaround is simple in this case. All you need to do is add an explicit rule for foo, and implicit rule search will not be performed. Just putting foo: ; in Makefile.am (which says that foo has no prerequisites and can be updated by doing nothing) should fix it right up, without relying on any GNU-make-specific features. Cheers, -- Nick Bowler, Elliptic Technologies (http://www.elliptictech.com/) From debbugs-submit-bounces@debbugs.gnu.org Mon Aug 31 17:14:35 2020 Received: (at 12142) by debbugs.gnu.org; 31 Aug 2020 21:14:35 +0000 Received: from localhost ([127.0.0.1]:53925 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCr8N-0005xZ-Me for submit@debbugs.gnu.org; Mon, 31 Aug 2020 17:14:35 -0400 Received: from freefriends.org ([96.88.95.60]:38620) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kCr8L-0005xO-OF; Mon, 31 Aug 2020 17:14:34 -0400 X-Envelope-From: karl@freefriends.org Received: from freefriends.org (freefriends.org [96.88.95.60]) by freefriends.org (8.14.7/8.14.7) with ESMTP id 07VLEVel010414 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 31 Aug 2020 15:14:32 -0600 Received: (from apache@localhost) by freefriends.org (8.14.7/8.14.7/Submit) id 07VLEVEh010413; Mon, 31 Aug 2020 15:14:31 -0600 Date: Mon, 31 Aug 2020 15:14:31 -0600 Message-Id: <202008312114.07VLEVEh010413@freefriends.org> From: Karl Berry To: 12142@debbugs.gnu.org Subject: Re: bug#12142: automake tries to compile a program when 'foo' and 'foo.cxx' exist (though the former is header) X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 12142 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) It seems there is nothing left unresolved here, so closing ... From unknown Thu Sep 11 06:33:42 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 29 Sep 2020 11:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator