-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
artificial limitation of directories (forced to be in prefix) #2561
Comments
Generally I think this restriction is good to have. meson excludes a few directories from this check: Line 369 in 7b9843d
sbindir to the list.
|
The problem is that in this case, meson would impose a specific worldview onto the user/downstream developer using meson. As arekm showed, GNU Autoconfigure allows for this fine-tuning. We can of course argue about the merits, pros and cons of either approach, but GNU Autoconfigure provides more flexibility here WHEN needed, whereas this appears to not be the case for meson. In general I believe that flexibility is better, but I can also understand restrictions coming from another point of view since it may lead to a more complex/complicated codebase. What I disagree with is to limit the flexibility-discussion solely to the NAMES of directories alone, though, because users can already, at their own discretion, arbitrarily rename all directories anyway - so I really think that this is just an option for more flexibility, and from this point of view, I completely agree with arekm. But it's just my half 2 cc anyway on the general topic of directory names; often the "bin/" versus "sbin/" distinction does not even make any real sense either, IMO. :) |
The solution in such a case is to set the prefix as This restriction is on purpose, and is useful in many situations, see #1209 for why. |
Setting prefix to / forces me to set every other possible path to something desired like /usr/share or /usr/lib64 etc which sucks badly especially I can not automate that (or is there a sane way to list all directories that can to be set in a project at build time? ) |
|
Upstream insists on not allowing bindir and other dir options outside of prefix for some reason: mesonbuild/meson#2561 We remove the check so multiple outputs can work sanely.
Upstream insists on not allowing bindir and other dir options outside of prefix for some reason: mesonbuild/meson#2561 We remove the check so multiple outputs can work sanely.
Upstream insists on not allowing bindir and other dir options outside of prefix for some reason: mesonbuild/meson#2561 We remove the check so multiple outputs can work sanely.
Upstream insists on not allowing bindir and other dir options outside of prefix for some reason: mesonbuild/meson#2561 We remove the check so multiple outputs can work sanely.
Upstream insists on not allowing bindir and other dir options outside of prefix for some reason: mesonbuild/meson#2561 We remove the check so multiple outputs can work sanely.
There are legitimate reasons for having multiple prefixes. To allow installing multiple versions of the same package, Nix uses different directories in @nirbheek could you clarify why single prefix is on purpose, I do not see any explanation in #1209. Trying to emulate multiple prefixes with For example, systemd files need to go to Some projects also do it for other reasons (e.g. https://github.com/elementary/greeter/blob/ae716eb3af636f7ea52da8f8ee40f569c6b1d20a/src/meson.build#L11), though, these should probably be fixed. |
The reason is because Meson allows passing either a path relative to the prefix or an absolute path for This behavior is impossible to adhere to if
How does NixOS handle that? |
We are patching meson to allow out-of-prefix paths: |
I meant, where does NixOS install systemd's unit files? It seems to me that on ordinary Linux systems, the installation path should be |
To |
@nirbheek It should only return a path relative to prefix when |
Agreed. This is what CMake’s We (Nixpkgs) have been patching Meson to allow this for ages and only encountered few projects where it caused breakage (they were concatenating a |
Yes given a major distro like NixOS needs this, and given that it hasn't proved a problem in practice, I don't see why we don't just do this. |
Why isn't Nix setting |
Because packages are not allowed to install to arbitrary paths in I am aware that it is part of the API contract but contracts can change. Yes, it would be a backwards incompatible change but in practice, we have only encountered few breakages in Nixpkgs, one of the largest software repositories there is. And all of those breakages were just caused by not following best practices like joining paths with There would not even be effect on users and we are more than willing to continue to work with upstream project to improve their Meson build files. Having this artificial limitation (that neither Autotools or CMake exhibit) relaxed would allow us to link to official Meson documentation as one more point. Since it is an artificial limitation that fortunately almost no-one relies on, I see no reason to hold onto it when there are clearly use cases and a demand. |
To be entirely blunt I still don't understand why this conversation needs to happen. This is just yet another example of meson doing things terribly wrong and making things harder for distro maintainers for no perceivable reason. Just fix it? |
I could reopen this, but I'll wait a bit first, as I think it would be better if @nirbheek or somebody no afiliated with one of the affected distros did. |
QEMU as recently switch its build system to use meson and the ./configure step with meson is more restrictive that the step used to be, most installation path wants to be within prefix, otherwise we have this error message: ERROR: The value of the 'datadir' option is '/usr/share/qemu-xen' which must be a subdir of the prefix '/usr/lib/xen'. In order to workaround the limitation, we will set prefix to the same one as for the rest of Xen installation, and set all the other paths. For reference, a thread in qemu-devel: "configure with datadir outside of --prefix fails with meson" https://lore.kernel.org/qemu-devel/20200918133012.GH2024@perard.uk.xensource.com/t/ And an issue in meson: "artificial limitation of directories (forced to be in prefix)" mesonbuild/meson#2561 Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> Tested-by: Paul Durrant <paul@xen.org> Acked-by: Wei Liu <wl@xen.org>
It's just the usual nonsense, there is absolutely no one in need of this behavior, but a proven number of people who do, but they are still being refused to fix it. |
Hello! What is the status of this bug? Has it been resolved or not? If not, can we please reopen this issue, to make it easier for affected users to find it? Edit: seems the code responsible for this check is now at https://github.com/mesonbuild/meson/blob/master/mesonbuild/coredata.py#L538 (and still enforcing the problematic check). |
Now that we have If we can alleviate the risk of that breakage, this could be changed now. |
I suppose one way to "alleviate" that breakage is to say "if you break it you get to keep both pieces and negotiate gluing them back together yourself, with upstream". It seems like NixOS has been doing that already while maintaining their own meson patches, so... hopefully this should not be a significant real-world problem. |
This bring us in line with Autotools and CMake and it is useful for platforms like Nix, which install projects into multiple independent prefixes. As a consequence, `get_option` might return absolute paths for some directory options, if a directory outside of prefix is passed. This is technically a backwards incompatible change but its effect should be minimal, thanks to widespread use of `join_paths`/`/` operator and pkg-config generator module. It should only cause an issue when a path were constructed by concatenating the value of directory path option. Fixes: mesonbuild#2561
This bring us in line with Autotools and CMake and it is useful for platforms like Nix, which install projects into multiple independent prefixes. As a consequence, `get_option` might return absolute paths for some directory options, if a directory outside of prefix is passed. This is technically a backwards incompatible change but its effect should be minimal, thanks to widespread use of `join_paths`/`/` operator and pkg-config generator module. It should only cause an issue when a path were constructed by concatenating the value of directory path option. Fixes: mesonbuild#2561
This bring us in line with Autotools and CMake and it is useful for platforms like Nix, which install projects into multiple independent prefixes. As a consequence, `get_option` might return absolute paths for some directory options, if a directory outside of prefix is passed. This is technically a backwards incompatible change but its effect should be minimal, thanks to widespread use of `join_paths`/`/` operator and pkg-config generator module. It should only cause an issue when a path were constructed by concatenating the value of directory path option. Also remove a comment about commonpath since we do not use that since <mesonbuild@00f5dad>. Fixes: mesonbuild#2561
This bring us in line with Autotools and CMake and it is useful for platforms like Nix, which install projects into multiple independent prefixes. As a consequence, `get_option` might return absolute paths for some directory options, if a directory outside of prefix is passed. This is technically a backwards incompatible change but its effect should be minimal, thanks to widespread use of `join_paths`/`/` operator and pkg-config generator module. It should only cause an issue when a path were constructed by concatenating the value of directory path option. Also remove a comment about commonpath since we do not use that since <mesonbuild@00f5dad>. Fixes: mesonbuild#2561
This bring us in line with Autotools and CMake and it is useful for platforms like Nix, which install projects into multiple independent prefixes. As a consequence, `get_option` might return absolute paths for some directory options, if a directory outside of prefix is passed. This is technically a backwards incompatible change but its effect should be minimal, thanks to widespread use of `join_paths`/`/` operator and pkg-config generator module. It should only cause an issue when a path were constructed by concatenating the value of directory path option. Also remove a comment about commonpath since we do not use that since <mesonbuild@00f5dad>. Fixes: mesonbuild#2561
This bring us in line with Autotools and CMake and it is useful for platforms like Nix, which install projects into multiple independent prefixes. As a consequence, `get_option` might return absolute paths for some directory options, if a directory outside of prefix is passed. This is technically a backwards incompatible change but its effect should be minimal, thanks to widespread use of `join_paths`/`/` operator and pkg-config generator module. It should only cause an issue when a path were constructed by concatenating the value of directory path option. Also remove a comment about commonpath since we do not use that since <00f5dad>. Fixes: #2561
meson artificially limits location of directories for example:
The common configuration here is to specify exact destination for directories like:
but sometimes it's desired to put one directory outside prefix for example
That's the case where /usr is on separate partition, sbin tools are needed at boot, bin tools are additional utilities that are not required at boot and thus live in /usr.
Currently meson forbits such configuration which is a problem.
Workaround: mv files around after meson finishes installation. Ugly workaround.
Not sure what's the point of limiting flexibility. If none exists then please drop this check and allow such configuration to succeed.
The text was updated successfully, but these errors were encountered: