tools: don't expand prefix and exec_prefix too early
PATCH 1/1 tools: don't expand prefix and exec_prefix too early
A comment in tools/configure says that it is intended for these to be command line overridable, so they shouldn't get expanded at configure time.
The patch is fixing tools/m4/default_lib.m4 as far as I can see myself doing this, but imo it is flawed altogether and should rather be removed:
- setting prefix and exec_prefix to default values is being done later in tools/configure anyway
- setting LIB_PATH based on the (non-)existence of a lib64 directory underneath ${exec_prefix} is plain wrong (it can obviously exist on a 32-bit installation)
- I wasn't able to locate any use of LIB_PATH
(I did see IanC's comment in c/s 25594:ad08cd8e7097 that removing it supposedly causes other problems, but I don't see how that would happen).
---
This will require tools/configure to be re-generated.
config/Tools.mk.in +2 -1
@@ -1,5 +1,6 @@ # Prefix and install folder -PREFIX := @prefix@ +prefix := @prefix@ +PREFIX := $(prefix) exec_prefix := @exec_prefix@ LIBDIR := @libdir@
tools/m4/default_lib.m4 +10 -5
@@ -1,14 +1,19 @@ AC_DEFUN([AX_DEFAULT_LIB], -[AS_IF([test "\${exec_prefix}/lib" = "$libdir"], - [AS_IF([test "$exec_prefix" = "NONE" && test "$prefix" != "NONE"], - [exec_prefix=$prefix]) - AS_IF([test "$exec_prefix" = "NONE"], [exec_prefix=$ac_default_prefix]) - AS_IF([test -d "${exec_prefix}/lib64"], [ +[AS_IF([test "\${exec_prefix}/lib" = "$libdir"], [ + AS_IF([test "$prefix" = "NONE"], [prefix=$ac_default_prefix]) + AS_IF([test "$exec_prefix" = "NONE"], [exec_prefix='${prefix}']) + AS_IF([eval test -d "${exec_prefix}/lib64"], [ LIB_PATH="lib64" ],[ LIB_PATH="lib" ]) ], [ LIB_PATH="${libdir:`expr length "$exec_prefix" + 1`}" + AS_IF([test -z "${libdir##\$\{exec_prefix\}/*}"], [ + LIB_PATH="${libdir:15}" + ]) + AS_IF([test -z "${libdir##\$exec_prefix/*}"], [ + LIB_PATH="${libdir:13}" + ]) ]) AC_SUBST(LIB_PATH)])
A comment in tools/configure says that it is intended for these to be command line overridable, so they shouldn't get expanded at configure time.
The patch is fixing tools/m4/default_lib.m4 as far as I can see myself doing this, but imo it is flawed altogether and should rather be removed:
- setting prefix and exec_prefix to default values is being done later in tools/configure anyway
- setting LIB_PATH based on the (non-)existence of a lib64 directory underneath ${exec_prefix} is plain wrong (it can obviously exist on a 32-bit installation)
- I wasn't able to locate any use of LIB_PATH
(I did see IanC's comment in c/s 25594:ad08cd8e7097 that removing it supposedly causes other problems, but I don't see how that would happen).
---
This will require tools/configure to be re-generated.
config/Tools.mk.in +2 -1
@@ -1,5 +1,6 @@ # Prefix and install folder -PREFIX := @prefix@ +prefix := @prefix@ +PREFIX := $(prefix) exec_prefix := @exec_prefix@ LIBDIR := @libdir@
tools/m4/default_lib.m4 +10 -5
@@ -1,14 +1,19 @@ AC_DEFUN([AX_DEFAULT_LIB], -[AS_IF([test "\${exec_prefix}/lib" = "$libdir"], - [AS_IF([test "$exec_prefix" = "NONE" && test "$prefix" != "NONE"], - [exec_prefix=$prefix]) - AS_IF([test "$exec_prefix" = "NONE"], [exec_prefix=$ac_default_prefix]) - AS_IF([test -d "${exec_prefix}/lib64"], [ +[AS_IF([test "\${exec_prefix}/lib" = "$libdir"], [ + AS_IF([test "$prefix" = "NONE"], [prefix=$ac_default_prefix]) + AS_IF([test "$exec_prefix" = "NONE"], [exec_prefix='${prefix}']) + AS_IF([eval test -d "${exec_prefix}/lib64"], [ LIB_PATH="lib64" ],[ LIB_PATH="lib" ]) ], [ LIB_PATH="${libdir:`expr length "$exec_prefix" + 1`}" + AS_IF([test -z "${libdir##\$\{exec_prefix\}/*}"], [ + LIB_PATH="${libdir:15}" + ]) + AS_IF([test -z "${libdir##\$exec_prefix/*}"], [ + LIB_PATH="${libdir:13}" + ]) ]) AC_SUBST(LIB_PATH)])
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Jan Beulich
A comment in
tools/configuresays that it is intended for these to be command line overridable, so they shouldn't get expanded at configure time.
In addition, it would have been _very_ nice if it had been prominently announced that with (I believe) 25594:ad08cd8e7097 it is now _required_ to configure with --libdir on x86-64, or else all the .so-s end up under /usr/lib. Figuring this out and getting the patch here in the right form to be able to use the most compatible form --libdir='${exec_prefix}'/lib64 has taken me a good part of the day, which could have been avoided if this whole configure adjustment (much like had apparently been missing already in earlier cases) had been done properly. I just can't imagine I'm the only one having used no options at all, and things working nevertheless despite .../lib not being in the library search paths used when running xl et al.
Jan
Quoted 8 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Jan Beulich
A comment in
tools/configuresays that it is intended for these to be command line overridable, so they shouldn't get expanded at configure time.In addition, it would have been _very_ nice if it had been prominently announced that with (I believe) 25594:ad08cd8e7097
Quoted 10 lines
it is now _required_ to configure with --libdir on x86-64, or else all the .so-s end up under
/usr/lib. Figuring this out and getting the patch here in the right form to be able to use the most compatible form --libdir='${exec_prefix}'/lib64 has taken me a good part of the day, which could have been avoided if this whole configure adjustment (much like had apparently been missing already in earlier cases) had been done properly. I just can't imagine I'm the only one having used no options at all, and things working nevertheless despite .../lib not being in the library search paths used when running xl et al.
I'm sorry for the trouble it cause you today, Jan. I thought I called it out sufficiently in the commit log:
With this change, packagers can supply the desired location for shared libraries on the ./configure command line. Packagers need to note that the default behaviour on 64-bit Linux systems will be to install shared libraries in /usr/lib, not /usr/lib64, unless a --libdir value is provided to ./configure.
The new behavior is consistent with all packages that use autoconf.
Would a separate email on the topic to xen-devel, apart from the patch discussion, have helped raise awareness?
Matt
Quoted 21 lines
Quoted 1 line
Quoted 1 line · Matt Wilson
Quoted 8 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Jan Beulich
A comment in
tools/configuresays that it is intended for these to be command line overridable, so they shouldn't get expanded at configure time.In addition, it would have been _very_ nice if it had been prominently announced that with (I believe) 25594:ad08cd8e7097
Quoted 10 lines
it is now _required_ to configure with --libdir on x86-64, or else all the .so-s end up under
/usr/lib. Figuring this out and getting the patch here in the right form to be able to use the most compatible form --libdir='${exec_prefix}'/lib64 has taken me a good part of the day, which could have been avoided if this whole configure adjustment (much like had apparently been missing already in earlier cases) had been done properly. I just can't imagine I'm the only one having used no options at all, and things working nevertheless despite .../lib not being in the library search paths used when running xl et al.
Quoted 8 lines
I'm sorry for the trouble it cause you today, Jan. I thought I called it out sufficiently in the commit log:
With this change, packagers can supply the desired location for shared libraries on the ./configure command line. Packagers need to note that the default behaviour on 64-bit Linux systems will be to install shared libraries in
/usr/lib, not/usr/lib64, unless a --libdir value is provided to ./configure.
No, this comment says "can", not "have to". Plus you don't really expect people to read every changeset's description, do you?
Quoted 1 line
The new behavior is consistent with all packages that use autoconf.
That indeed appears to be the case, admittedly to my not insignificant surprise.
Quoted 2 lines
Would a separate email on the topic to xen-devel, apart from the patch discussion, have helped raise awareness?
Yes. I for my part follow only very selected tools side discussions, and expect the tools maintainers to get things sorted out. But of course I need to build and run the tools, so if some change gets done to the way things need to get built (or run) successfully then announcing this independently of the patch would certainly be helpful in general.
Jan
Quoted 41 lines · Jan Beulich
Quoted 21 lines
Quoted 1 line
Quoted 1 line · Matt Wilson
Quoted 8 lines · Jan Beulich
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Jan Beulich
A comment in
tools/configuresays that it is intended for these to be command line overridable, so they shouldn't get expanded at configure time.In addition, it would have been _very_ nice if it had been prominently announced that with (I believe) 25594:ad08cd8e7097
Quoted 10 lines
it is now _required_ to configure with --libdir on x86-64, or else all the .so-s end up under
/usr/lib. Figuring this out and getting the patch here in the right form to be able to use the most compatible form --libdir='${exec_prefix}'/lib64 has taken me a good part of the day, which could have been avoided if this whole configure adjustment (much like had apparently been missing already in earlier cases) had been done properly. I just can't imagine I'm the only one having used no options at all, and things working nevertheless despite .../lib not being in the library search paths used when running xl et al.Quoted 8 lines
I'm sorry for the trouble it cause you today, Jan. I thought I called it out sufficiently in the commit log:
With this change, packagers can supply the desired location for shared libraries on the ./configure command line. Packagers need to note that the default behaviour on 64-bit Linux systems will be to install shared libraries in
/usr/lib, not/usr/lib64, unless a --libdir value is provided to ./configure.No, this comment says "can", not "have to". Plus you don't really expect people to read every changeset's description, do you?
Quoted 1 line
The new behavior is consistent with all packages that use autoconf.
That indeed appears to be the case, admittedly to my not insignificant surprise.
Quoted 2 lines
Would a separate email on the topic to xen-devel, apart from the patch discussion, have helped raise awareness?
Quoted 6 lines
Yes. I for my part follow only very selected tools side discussions, and expect the tools maintainers to get things sorted out. But of course I need to build and run the tools, so if some change gets done to the way things need to get built (or run) successfully then announcing this independently of the patch would certainly be helpful in general.
FWIW I've just added it http://wiki.xen.org/wiki/Xen_4.2_Release_Notes
which probably wouldn't have helped you but should help in general.
Ian.
Quoted 2 lines · Ian Campbell
FWIW I've just added it http://wiki.xen.org/wiki/Xen_4.2_Release_Notes
which probably wouldn't have helped you but should help in general.
Maybe we can simplify configure like this (untested patch):
configure +6 -1
@@ -1,2 +1,7 @@ #!/bin/sh -e -cd tools && ./configure $@ +_easy_lib64= +if test "`arch`" = "x86_64" +then + _easy_lib64=--libdir=/usr/lib64 +fi +cd tools && ./configure ${_easy_lib64} $@
Quoted 6 lines · Olaf Hering
Quoted 2 lines · Ian Campbell
FWIW I've just added it http://wiki.xen.org/wiki/Xen_4.2_Release_Notes
which probably wouldn't have helped you but should help in general.Maybe we can simplify configure like this (untested patch):
Ew, what a horribly opaque way to go about this.
Unless there is some common autoconf macro which all autoconf-using projects use to get this sort of behaviour we should just leave things as is, i.e. our behaviour should match the behaviour of every other autoconf-using project not invent our own madness.
Quoted 13 lines
diff -r
f9f47654484econfigureconfigure +6
-1@@ -1,2 +1,7 @@ #!/bin/sh -e -cd tools && ./configure $@ +_easy_lib64= +if test "`arch`" = "x86_64" +then + _easy_lib64=--libdir=/usr/lib64 +fi +cd tools && ./configure ${_easy_lib64} $@
Jan Beulich writes ("Re: [Xen-devel] [PATCH] tools: don't expand prefix and exec_prefix too early"):
Quoted 3 lines
In addition, it would have been _very_ nice if it had been prominently announced that with (I believe) 25594:ad08cd8e7097 it is now _required_ to configure with --libdir on x86-64,
This is only required on FHS-noncompliant systems. On (for example) a Debian amd64 system the default directory /usr/lib is correct.
I expect we will revisit all of this in 4.3 since it might be a good idea to support multiarch.
Ian.
Quoted 3 lines · Jan Beulich
A comment in
tools/configuresays that it is intended for these to be command line overridable, so they shouldn't get expanded at configure time.
I'm not sure which comment you're referencing, or which command line it's intended that you're able to override prefix/exec_prefix. Could you point it out? What's not working?
Quoted 9 lines
The patch is fixing
tools/m4/default_lib.m4as far as I can see myself doing this, but imo it is flawed altogether and should rather be removed:
- setting prefix andexec_prefixto default values is being done later intools/configureanyway
- settingLIB_PATHbased on the (non-)existence of a lib64 directory underneath ${exec_prefix} is plain wrong (it can obviously exist on a 32-bit installation)
- I wasn't able to locate any use ofLIB_PATH
I believe that the LIB_PATH portions can now be removed. I also believe you're right that all of this can be removed. Did you attempt that as well?
Quoted 3 lines
(I did see IanC's comment in c/s 25594:ad08cd8e7097 that removing it supposedly causes other problems, but I don't see how that would happen).
The tail of the thread where IanC had trouble is here:
http://lists.xen.org/archives/html/xen-devel/2012-07/msg00268.html
If we're going back into this code, I think that adding a lowercase prefix variable and removing default_lib.m4 altogether should resolve remaining problems. But we should probably only do that for 4.2 if something's very broken with what's in the tree now.
Quoted 4 lines
Signed-off-by Jan Beulich <[email protected]>---
This will requiretools/configureto be re-generated.
This is typically part of the same commit.
Matt
Quoted 40 lines
config/Tools.mk.in +2
-1@@ -1,5 +1,6 @@ # Prefix and install folder -PREFIX := @prefix@ +prefix := @prefix@ +PREFIX := $(prefix) exec_prefix := @exec_prefix@ LIBDIR := @libdir@tools/m4/default_lib.m4 +10
-5@@ -1,14 +1,19 @@ AC_DEFUN([AX_DEFAULT_LIB], -[AS_IF([test "\${exec_prefix}/lib" = "$libdir"], - [AS_IF([test "$exec_prefix" = "NONE" && test "$prefix" != "NONE"], - [exec_prefix=$prefix]) - AS_IF([test "$exec_prefix" = "NONE"], [exec_prefix=$ac_default_prefix]) - AS_IF([test -d "${exec_prefix}/lib64"], [ +[AS_IF([test "\${exec_prefix}/lib" = "$libdir"], [ + AS_IF([test "$prefix" = "NONE"], [prefix=$ac_default_prefix]) + AS_IF([test "$exec_prefix" = "NONE"], [exec_prefix='${prefix}']) + AS_IF([eval test -d "${exec_prefix}/lib64"], [ LIB_PATH="lib64" ],[ LIB_PATH="lib" ]) ], [ LIB_PATH="${libdir:`expr length "$exec_prefix" + 1`}" + AS_IF([test -z "${libdir##\$\{exec_prefix\}/*}"], [ + LIB_PATH="${libdir:15}" + ]) + AS_IF([test -z "${libdir##\$exec_prefix/*}"], [ + LIB_PATH="${libdir:13}" + ]) ]) AC_SUBST(LIB_PATH)])
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Matt Wilson
Quoted 3 lines · Jan Beulich
A comment in
tools/configuresays that it is intended for these to be command line overridable, so they shouldn't get expanded at configure time.I'm not sure which comment you're referencing, or which command line it's intended that you're able to override prefix/exec_prefix. Could you point it out? What's not working?
The comment (around line 790 currently) reads
"# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
# and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.)"
The thing that wasn't working for me was passing
--libdir='${exec_prefix}'/lib64 to ./configure.
Quoted 10 lines
Quoted 9 lines
The patch is fixing
tools/m4/default_lib.m4as far as I can see myself doing this, but imo it is flawed altogether and should rather be removed:
- setting prefix andexec_prefixto default values is being done later intools/configureanyway
- settingLIB_PATHbased on the (non-)existence of a lib64 directory underneath ${exec_prefix} is plain wrong (it can obviously exist on a 32-bit installation)
- I wasn't able to locate any use ofLIB_PATH
Quoted 3 lines
I believe that the
LIB_PATHportions can now be removed. I also believe you're right that all of this can be removed. Did you attempt that as well?
No, I didn't, not the least because I don't have the right autoconf version around and didn't dare to re-generate tools/configure myself (instead I did the resulting adjustments manually).
Quoted 3 lines
Quoted 1 line
This will require
tools/configureto be re-generated.This is typically part of the same commit.
Sure, just that generally one wouldn't include generated parts in the patch, but expect them to be produced when committing (and as said above, I'd have to rely on the tools maintainers for this in order to not risk corrupting something).
Jan
Quoted 13 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · Matt Wilson
Quoted 3 lines · Jan Beulich
A comment in
tools/configuresays that it is intended for these to be command line overridable, so they shouldn't get expanded at configure time.I'm not sure which comment you're referencing, or which command line it's intended that you're able to override prefix/exec_prefix. Could you point it out? What's not working?
The comment (around line 790 currently) reads
"# Installation directory options.
# These are left unexpanded so users can "make install exec_prefix=/foo"
Quoted 7 lines
# and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.)"The thing that wasn't working for me was passing
--libdir='${exec_prefix}'/lib64 to ./configure.
Aah, OK. That's not something that I commonly see packaging control files (RPM .spec / dpkg rules) do, but you're right that it's intended to work.
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
The patch is fixing
tools/m4/default_lib.m4as far as I can see myself doing this, but imo it is flawed altogether and should rather be removed:
- setting prefix andexec_prefixto default values is being done later intools/configureanyway
- settingLIB_PATHbased on the (non-)existence of a lib64 directory underneath ${exec_prefix} is plain wrong (it can obviously exist on a 32-bit installation)
- I wasn't able to locate any use ofLIB_PATH
Quoted 7 lines
Quoted 3 lines
I believe that the
LIB_PATHportions can now be removed. I also believe you're right that all of this can be removed. Did you attempt that as well?No, I didn't, not the least because I don't have the right autoconf version around and didn't dare to re-generate
tools/configuremyself (instead I did the resulting adjustments manually).
Indeed, it's a bit of a pain to set it up. I imagine that's why the autogenerated files are committed into mercurial, which is a practice I don't like...
Quoted 8 lines
Quoted 3 lines
Quoted 1 line
This will require
tools/configureto be re-generated.This is typically part of the same commit.
Sure, just that generally one wouldn't include generated parts in the patch, but expect them to be produced when committing (and as said above, I'd have to rely on the tools maintainers for this in order to not risk corrupting something).
Fair enough. :-)
Would you like me to take another pass at fixing this the "right" way, by removing this bit altogether and adding lowercase variables to tools/Config.mk?
Matt
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Matt Wilson
Would you like me to take another pass at fixing this the "right" way, by removing this bit altogether and adding lowercase variables to
tools/Config.mk?
Oh, yes, if you can do this in a more complete fashion, removing the suspicious default_dir.m4 altogether, that would be wonderful. Not sure what the tools maintainers think of this, though.
Jan
Jan Beulich writes ("Re: [Xen-devel] [PATCH] tools: don't expand prefix and exec_prefix too early"):
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Matt Wilson
Would you like me to take another pass at fixing this the "right" way, by removing this bit altogether and adding lowercase variables to
tools/Config.mk?Oh, yes, if you can do this in a more complete fashion, removing the suspicious default_dir.m4 altogether, that would be wonderful. Not sure what the tools maintainers think of this, though.
That would be fine by me. Before throwing it into 4.2 I will do a few build tests and check that differences in the output file layout are as expected.
Thanks,
Ian.
Quoted 6 lines · Ian Jackson
Jan Beulich writes ("Re: [Xen-devel] [PATCH] tools: don't expand prefix and
exec_prefixtoo early"):Quoted 5 lines
Quoted 4 lines
Quoted 1 line
Quoted 1 line · Matt Wilson
Would you like me to take another pass at fixing this the "right" way, by removing this bit altogether and adding lowercase variables to
tools/Config.mk?
Quoted 7 lines
Quoted 3 lines
Oh, yes, if you can do this in a more complete fashion, removing the suspicious default_dir.m4 altogether, that would be wonderful. Not sure what the tools maintainers think of this, though.
That would be fine by me. Before throwing it into 4.2 I will do a few build tests and check that differences in the output file layout are as expected.
OK, I'll get my development environment set up again with the right version of autoconf and work on implementing this in the next few days.
Matt