1

I'm trying to use a non-absolute directory name for --prefix:

$ ./configure --prefix=xxx
configure: error: expected an absolute directory name for --prefix: xxx

Why does configure script expect an absolute directory name for --prefix?

What are the obstacles for supporting a non-absolute directory name for --prefix?

0

1 Answer 1

1

Basically, it needs to be a fully explicit path [absolute] to ensure there is no relative path confusion at execution time for dependencies and such—and for Unix security default behavior perhaps.

One must type ./configure rather than simply configure to indicate to the shell that the script is in the current directory. This is because, as a security precaution, Unix configurations don't search the current directory for executables. So, to execute programs in that directory, one must explicitly specify their location.[1]

./configure --libs="-lmpfr -lgmp" 
./configure --prefix=/home/user/local 

The second line tells make to install the final version in /home/user/local

Source

A workaround may be to use $(pwd)/xxx with --prefix parameter if you cd or pushd to the directory you need it to be in relative wise it will make it absolute for you dynamically that way expanding it that way using $(pwd) with the parameter instead.

./configure --prefix=$(pwd)/xxx

Supporting Resources

2
  • I see other posts suggest ${pwd} in that format so may be worth testing. I'm not certain if the cd or pushd is needed if you got that $(pwd) baked into the script, so test accordingly to confirm this for certain. Commented 14 hours ago
  • 1
    In shells, $(pwd) is command expansion, ${pwd} is variable expansion, and there is no variable named 'pwd' out of the box – the latter would work in Bash/zsh as uppercase${PWD} or $PWD but not as lowercase pwd. Commented 14 hours ago

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .