std.Build: add search prefix "exact" variant #22552
Open
+130
−27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows more granurality when adding search pathes for cross-compiling. By default old (
all
variant) system addedbin
,include
andlib
subdirectories fromsearch-prefix
argument path when cross-compiling, but on some distros it's not correct and can lead to some errors.For example, on my Gentoo system I have
libcurl
installed as both 32-bit and 64-bit versions, which are located in/usr/lib
and/usr/lib64
directories respectively. If I use plain--search-prefix
, it fails because it tries to add 32-bit libraries:Another example is
libgccjit
library, which shared objects are located (at least on my system) in/usr/lib/gcc/x86_64-pc-linux-gnu/14/
, and include files ininclude
subdir there. One solution I used recently was to create temporary directory and symlink files so that they have names expected by Zig, but it's not the best solution.With this PR you can now supply file which will instruct build system to add pathes written there as-is, without trying to guess subdirs there. Something like:
or
can be saved in some file like
paths.zon
and then passed using--search-prefix-exact paths.zon
. This also helps to use this config on a system (distro) level, without messing with build.zig.