GNU bug report logs - #37499
Wrong location of deps directory when using AC_SUBST

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: automake; Reported by: Fabrizio Bertocci <fabriziobertocci@HIDDEN>; dated Tue, 24 Sep 2019 14:32:02 UTC; Maintainer for automake is bug-automake@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 24 Sep 2019 14:31:30 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Sep 24 10:31:30 2019
Received: from localhost ([127.0.0.1]:39812 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iClqe-0005kM-7M
	for submit <at> debbugs.gnu.org; Tue, 24 Sep 2019 10:31:28 -0400
Received: from mail-lj1-f173.google.com ([209.85.208.173]:41647)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <fabriziobertocci@HIDDEN>) id 1iCkMT-0002gV-6z
 for submit <at> debbugs.gnu.org; Tue, 24 Sep 2019 08:56:12 -0400
Received: by mail-lj1-f173.google.com with SMTP id f5so1755082ljg.8
 for <submit <at> debbugs.gnu.org>; Tue, 24 Sep 2019 05:56:09 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=mime-version:from:date:message-id:subject:to;
 bh=RU/RPGFvDl17c003P0qJmP/yBgdDBsg8U0yLE/kyuhw=;
 b=osxx99vaa4Rh9NwBTlNYI4Fzk6/2nxtemoXaYmLHwyb/ddkNYlnCsl+farTExO8BLz
 RLsWYwxdxkoHm4h1tvbs8YM+a47Oq86Ro33JDeCwehzkQ1HU/YeEeRYif2mWImkw/UOz
 0YxzSblJtJjjWMQWDzQ4+51WboDwPTbOo741mP3qyBBaZ07aTVCIsw1ro6JnUnaku2Sl
 lEFq6MY6M4MsEUZFJn9swIu9K6saBH+prcI1oyHAwGIvf3hqYU2zRyhsl+lRbkfafXFt
 yTEHvb2jOuO9xTaY0aEELpCDh0H1P0D577ngQ4L68G5X6rKXcAvB36UqhpK6kC/Lu8nI
 pnBg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=RU/RPGFvDl17c003P0qJmP/yBgdDBsg8U0yLE/kyuhw=;
 b=WL1kd64UvqKaW0X9wSD5lkqAlh2GWWpGHZmIAPt4bT9qXSC9i+DNq7e81LtEa1bcA0
 JMijplRDvU+9w4NBbOj8wwdWRtpxssz4Z/1ccZW0um/qM04G2JjbvsbMUHfxW+s16ksH
 2v7NLM9sSmVV+iVWttug4ZRc7sMi/cpi6P2TU6wOfPspPYNmofjAcFQ2LDVs9/l+Us+s
 GoT4lf5byXqpYPYx3UKthKktSchtFb/O1CLF9UUWsJUhpk9lomvUp0mgr8aBe7SXjKHQ
 +U2g999Wyf1po5PYTmM15hM0Kq9kbTbRrkzlCE1GBbCBnDPS2Huy6fWd4MkT1VUoF67Z
 Q4mQ==
X-Gm-Message-State: APjAAAVjw4g4ae4/0NS3QbAxZMRYG+SxjxW559fGBsTc7m/3+KDibqKF
 /m01DB3zCM339enTsrYsRVg8kBYC/RpEScbBqMK7kPv+jSs=
X-Google-Smtp-Source: APXvYqyp80up75bYMon1L5oDstycHmO24GxIgDzAX3cr6ygkmh8ui84Z0JOZKXgvszvLKPTvDDRN1/F7P0JmEBNZADg=
X-Received: by 2002:a2e:442:: with SMTP id 63mr1910732lje.66.1569329762278;
 Tue, 24 Sep 2019 05:56:02 -0700 (PDT)
MIME-Version: 1.0
From: Fabrizio Bertocci <fabriziobertocci@HIDDEN>
Date: Tue, 24 Sep 2019 08:55:50 -0400
Message-ID: <CADtzkx4QBhSO6zMNwySZP4qfz09sAN4j5znbQ22sPi8ius67RA@HIDDEN>
Subject: Wrong location of deps directory when using AC_SUBST
To: submit <at> debbugs.gnu.org
Content-Type: multipart/alternative; boundary="00000000000004eafc05934c0fb3"
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Tue, 24 Sep 2019 10:31:20 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000004eafc05934c0fb3
Content-Type: text/plain; charset="UTF-8"

Package: automake
Version: 1.15.1

I have noticed a strange/wrong behavior when using AC_SUBST to pass a path
to Makefile.am to be used to include additional source files.
In my configure.ac I allow definition of a MYLIB_PATH variable through
--with-mylib=...
The path identify a directory where I have additional common sources that I
want to include in my final build (I know I should build that as a separate
lib, but this is not the point).

This is the configure.ac:
-----------------------------------------
AC_INIT(testApp, 1.0, fabriziobertocci@HIDDEN)
AC_CONFIG_SRCDIR([src/main.c])
AM_INIT_AUTOMAKE([subdir-objects])
AC_PROG_CC
AC_CONFIG_MACRO_DIRS([m4])

AC_ARG_WITH(mylib,
[  --with-mylib=PATH     Sets PATH where my lib is checked out (../mylib) ],
[
        MYLIB_PATH="${withval}"
        AC_MSG_RESULT(Using MYLib library from ${withval})
],[
        MYLIB_PATH="../mylib"
])

dnl Verify the common lib dir is found
AC_CHECK_FILE("$MYLIB_PATH/mylib.h",
      [     AC_MSG_RESULT(Successfully found mylib.h under "${MYLIB_PATH}")
      ],[   AC_MSG_ERROR(Cannot find MyLibrary. Use --with-mylib parameter
to specify where lib is checked out)
] )

dnl Use relative path:
dnl MYLIB_PATH=`realpath --relative-to src "${MYLIB_PATH}"`

dnl Use absolute path of lib
MYLIB_PATH=`readlink -f ${MYLIB_PATH}`

AC_MSG_RESULT(Using MyLibrary relative to src: ${MYLIB_PATH})
AC_SUBST(MYLIB_PATH)
AC_OUTPUT(Makefile src/Makefile)
-----------------------------------
Then in my src/Makefile.am, I add to my sources, the files from @MYLI_PATH@:
-----------------------------------
bin_PROGRAMS = testApp
testApp_SOURCES = main.c @MYLIB_PATH@/mylib_log.c
testApp_CFLAGS = -I@MYLIB_PATH@/lib
------------------------------------

Problem:
If I define MYLIB_PATH as RELATIVE path to the 'src' directory (inside my
project), everything works fine (in the configure.ac, use the realpath
utility to convert any MYLIB_PATH to relative to the 'src' dir).
Unfortunately if MYLIB_PATH is an ABSOLUTE PATH (as in the example above),
it doesn't work.
After running configure, the .deps directory is created under src like if
the MYLIB_PATH is stripped out of the first '/':
So for example if I have my project under:
/home/fabrizio/test/autotool-issue/lib
/home/fabrizio/test/autotool-issue/proj   <- this is where is configure.ac
/home/fabrizio/test/autotool-issue/proj/src   <- This is where are the
sources
After running configure, I get the .deps directory created here:
/home/fabrizio/test/autotool-issue/proj/src/home/fabrizio/test/autotool-issue/lib/.deps/testApp-mylib_log.Po

The workaround is to use always relative path.
I have a full reproducible project I could attach. Just let me know.
I have used this pattern for more than 10 years, but I don't remember ever
seeing this issue (although I attempted to use absolute paths only now).
Tested with newer systems like Linux Mint 19.2 as well as a bit older
systems like CentOS 7. Same problem on both.

Regards,
Fabrizio Bertocci

--00000000000004eafc05934c0fb3
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Package: automake<div>Version: 1.15.1</div><div><br></div>=
<div>I have noticed a strange/wrong behavior when using AC_SUBST to pass a =
path to Makefile.am to be used to include additional source files.</div><di=
v>In my <a href=3D"http://configure.ac">configure.ac</a> I allow definition=
 of a MYLIB_PATH variable through --with-mylib=3D...</div><div>The path ide=
ntify a directory where I have additional common sources that I want to inc=
lude in my final build (I know I should build that as a separate lib, but t=
his is not the point).</div><div><br></div><div>This is the <a href=3D"http=
://configure.ac">configure.ac</a>:</div><div>------------------------------=
-----------</div><div>AC_INIT(testApp, 1.0, <a href=3D"mailto:fabrizioberto=
cci@HIDDEN">fabriziobertocci@HIDDEN</a>)<br>AC_CONFIG_SRCDIR([src/mai=
n.c])<br>AM_INIT_AUTOMAKE([subdir-objects])<br>AC_PROG_CC<br>AC_CONFIG_MACR=
O_DIRS([m4])<br><br></div><div>AC_ARG_WITH(mylib,<br>[ =C2=A0--with-mylib=
=3DPATH =C2=A0 =C2=A0 Sets PATH where my lib is checked out (../mylib) ],<b=
r>[<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 MYLIB_PATH=3D&quot;${withval}&quot;<br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 AC_MSG_RESULT(Using MYLib library from ${withva=
l})<br>],[<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 MYLIB_PATH=3D&quot;../mylib&quot;=
<br>])<br><br>dnl Verify the common lib dir is found<br>AC_CHECK_FILE(&quot=
;$MYLIB_PATH/mylib.h&quot;,<br>=C2=A0 =C2=A0 =C2=A0 [ =C2=A0 =C2=A0 AC_MSG_=
RESULT(Successfully found mylib.h under &quot;${MYLIB_PATH}&quot;)<br>=C2=
=A0 =C2=A0 =C2=A0 ],[ =C2=A0 AC_MSG_ERROR(Cannot find MyLibrary. Use --with=
-mylib parameter to specify where lib is checked out)<br>] )<br><br>dnl Use=
 relative path:<br>dnl MYLIB_PATH=3D`realpath --relative-to src &quot;${MYL=
IB_PATH}&quot;`<br><br>dnl Use absolute path of lib<br>MYLIB_PATH=3D`readli=
nk -f ${MYLIB_PATH}`<br><br>AC_MSG_RESULT(Using MyLibrary relative to src: =
${MYLIB_PATH})<br>AC_SUBST(MYLIB_PATH)<br>AC_OUTPUT(Makefile src/Makefile)<=
br></div><div>-----------------------------------</div><div>Then in my src/=
Makefile.am, I add to my sources, the files from=C2=A0@MYLI_PATH@:</div><di=
v>-----------------------------------</div><div>bin_PROGRAMS =3D testApp<br=
>testApp_SOURCES =3D main.c @MYLIB_PATH@/mylib_log.c<br>testApp_CFLAGS =3D =
-I@MYLIB_PATH@/lib<br></div><div>------------------------------------</div>=
<div><br></div><div>Problem:</div><div>If I define MYLIB_PATH as RELATIVE p=
ath to the &#39;src&#39; directory (inside my project), everything works fi=
ne (in the <a href=3D"http://configure.ac">configure.ac</a>, use the realpa=
th utility to convert any MYLIB_PATH to relative to the &#39;src&#39; dir).=
</div><div>Unfortunately if MYLIB_PATH is an ABSOLUTE PATH (as in the examp=
le above), it doesn&#39;t work.</div><div>After running configure, the .dep=
s directory is created under src like if the MYLIB_PATH is stripped out of =
the first &#39;/&#39;:</div><div>So for example if I have my project under:=
</div><div>/home/fabrizio/test/autotool-issue/lib</div><div>/home/fabrizio/=
test/autotool-issue/proj=C2=A0 =C2=A0&lt;- this is where is <a href=3D"http=
://configure.ac">configure.ac</a><br></div><div>/home/fabrizio/test/autotoo=
l-issue/proj/src=C2=A0 =C2=A0&lt;- This is where are the sources=C2=A0<br><=
/div><div>After running configure, I get the .deps directory created here:<=
/div><div>/home/fabrizio/test/autotool-issue/proj/src/home/fabrizio/test/au=
totool-issue/lib/.deps/testApp-mylib_log.Po</div><div><br></div><div>The wo=
rkaround is to use always relative path.</div><div>I have a full reproducib=
le project I could attach. Just let me know.</div><div>I have used this pat=
tern for more than 10 years, but I don&#39;t remember ever seeing this issu=
e (although I attempted to use absolute paths only now). Tested with newer =
systems like Linux Mint 19.2 as well as a bit older systems like CentOS 7. =
Same problem on both.</div><div><br></div><div>Regards,</div><div>Fabrizio =
Bertocci</div><div><br></div><div><br></div></div>

--00000000000004eafc05934c0fb3--




Acknowledgement sent to Fabrizio Bertocci <fabriziobertocci@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-automake@HIDDEN. Full text available.
Report forwarded to bug-automake@HIDDEN:
bug#37499; Package automake. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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