[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#37499: Wrong location of deps directory when using AC_SUBST

From: Fabrizio Bertocci
Subject: bug#37499: Wrong location of deps directory when using AC_SUBST
Date: Tue, 24 Nov 2020 15:09:15 -0500

It took me a while to remember what this issue was about... but I managed to get to my old reproducer.

Ok, let me do one step back. The root problem is how do I ensure that paths passed through ./configure command line are valid when building source code under 'src' (for example).

Look at the two attached .tar.gz. and un-tar the one called 'autotool-bug-rel.tar.gz'. 
In this project I have:
/proj             <- Here is where is the configure script
/proj/src       <- Here is the source code
/lib               <- This is another location of some lib I want to be able to define through ./configure

Enter the `proj/src` and generate the configure script (./bootstrap.sh or just use autoreconf).

The configure script accepts a parameter `--with-mylib=<dir>` where the library code is located. 
Launch it with:
./configure --with-mylib=../lib

Note that now ../lib is a valid path only for the /proj directory, when building inside the '/proj/src' directory, that directory is no longer valid (that's why it needs to be converted somehow to something that makes sense for the `src` directory).

I have two options at this point:
1. Make this library path relative to the 'src' directory
2. Convert the provided path to absolute

These two approaches although very similar lead to an error when using absolute paths. Note the issue is not in the conversion between relative/absolute paths. 
If I don't change the path provided through the --with-mylib parameter, and I enter an absolute path, I'm getting the same problem.

Let's go back to my test example, this version of the configure.ac follows the first approach (converts all the values to paths relative to the src directory):
MYLIB_PATH=`realpath --relative-to src "${MYLIB_PATH}"`

Do a build. After the building completes, you end up with two .deps directories, one under 'test/proj/src' and one under the 'test/lib' directory:
test/proj/src/.deps   <- .Po files for the files under 'src'
test/lib/.deps           <- .Po files for the files under 'lib'

So far so good. 
Cleanup everything (do an rm -Rf of the autotool-bug directory entirely) and un-tar the other file (autotool-bug-abs.tar.gz).
This example is exactly like the other one, but the configure.ac converts the library path to absolute:
MYLIB_PATH=`readlink -f ${MYLIB_PATH}`

Again, generate the configure script and run: configure --with-mylib=../lib

Now when you build you are going to get an error because it is looking for the .Po file in the (right/wrong?) directory.
The .Po file is trying to locate (expected to be under `/lib/.deps`) is in a wrong directory: proj/src/home/fabrizio/test/lib/.deps

See the problem? It seems when using absolute paths, the .Po file is created in the wrong directory and the build fails.
Take a look at the content of the src/home/...../.deps. There is a .Po file containing only a "# dummy" line.

Tested with autoconf 2.69.


On Mon, Nov 23, 2020 at 9:06 PM Karl Berry <karl@freefriends.org> wrote:
Hi Fabrizio - sorry for the absurdly delayed reply.
Also sorry, but I don't exactly understand.

    dnl Use absolute path of lib
    MYLIB_PATH=`readlink -f ${MYLIB_PATH}`
    testApp_SOURCES = main.c @MYLIB_PATH@/mylib_log.c
    testApp_CFLAGS = -I@MYLIB_PATH@/lib
    After running configure, I get the .deps directory created here:

Are you saying an older version used to not insert the full directory
path when making the .deps? So that it ended up being (I guess):
Do you know what version worked?

If it worked with an older version and doesn't work now, I could try to
look. Otherwise it is hard to guess what could have changed. My first
reaction is that automake is just using the path it's given; I wouldn't
expect it to the relativization itself? I suspect I'm misunderstanding

    I have a full reproducible project I could attach. Just let me know.

For sure a reproducible case would be helpful in understanding. The
smaller the better.


Attachment: autotool-bug-abs.tar.gz
Description: application/gzip

Attachment: autotool-bug-rel.tar.gz
Description: application/gzip

reply via email to

[Prev in Thread] Current Thread [Next in Thread]