-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
[CMake] Meson not properly respecting CMAKE_PREFIX_PATH when searching for dependencies on windows #7323
Comments
could you please retry this test with the current meson master? Some fixes for |
ok c: |
@mensinda no luck, still hasnt found it. looking into it a bit more atm. |
not sure if this is relevant, but the output of the build doesn't seem to be respecting case in the library names;
should be Lib[KF5Attica] |
What is the directory structure in |
@mensinda see attached |
could you please try applying diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index eed714a83..c08891dff 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -1203,10 +1203,13 @@ class CMakeDependency(ExternalDependency):
# Checks <path>, <path>/cmake, <path>/CMake
def find_module(path: str) -> bool:
+ mlog.debug('R: {}'.format(path))
for i in [path, os.path.join(path, 'cmake'), os.path.join(path, 'CMake')]:
if not self._cached_isdir(i):
continue
+ mlog.debug('MOD: {}'.format(i))
+
# Check the directory case insensitve
content = self._cached_listdir(i)
candidates = ['Find{}.cmake', '{}Config.cmake', '{}-config.cmake']
@@ -1217,10 +1220,13 @@ class CMakeDependency(ExternalDependency):
# Search in <path>/(lib/<arch>|lib*|share) for cmake files
def search_lib_dirs(path: str) -> bool:
+ mlog.debug('CP: {}'.format(self.cmakeinfo['common_paths']))
for i in [os.path.join(path, x) for x in self.cmakeinfo['common_paths']]:
if not self._cached_isdir(i):
continue
+ mlog.debug('LD: {}:'.format(i))
+
# Check <path>/(lib/<arch>|lib*|share)/cmake/<name>*/
cm_dir = os.path.join(i, 'cmake')
if self._cached_isdir(cm_dir):
@@ -1234,6 +1240,7 @@ class CMakeDependency(ExternalDependency):
# <path>/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/
content = self._cached_listdir(i)
content = list(filter(lambda x: x[1].startswith(lname), content))
+ mlog.debug(content)
for k in content:
if find_module(os.path.join(i, k[0])):
return True and uploading the resulting meson-log.txt ? |
absolutely, on it c: |
@mensinda see attached :) |
OK, thanks. Looks like |
ok! awesome thanks :) |
hey! any updates on this? ^^ |
It's on my todo, but I have an exam Friday. |
@mensinda mind if i give it a go? ;) |
Sure, feel free to. |
@mensinda dumped the stack into the log file at time of dep search, looking through to see where it should be getting the path from :) |
modification in
result:
|
looks like its not being fed the correct module path upstream from |
modification in
hardcoded dependency path to candidate, resulting in:
|
my first |
it's also ignoring the capitalisation of the path... |
when running the
CMake successfully found the project; it also seems to work with |
seems this may be related to #7305 |
'traced the issue down to '_detect_dep()' in 'mesonbuild/dependencies/base.py'.
|
added the following to 'mesonbuild/dependencies/base.py`
resulting log was
the cmake build isnt the reason the dependency isnt being found. |
ok so its creating the temp build project passing it in the correct shell command; yet meson cannot find it, and native cmake can. intresting. |
I think ive found the issue.. when you pass a single item to CMAKE_PREFIX_PATH on windows, it works perfectly fine. but, if you give it multiple paths (eg `CMAKE_PREFIX_PATH="C:\Program Files;C:\Program Files (x86)" its failing.. |
ok so i think this is just a huge rabbit hole that i've fallen down because it seems this might just be a repeat of #7305. it keeps giving very strange errors which have nothing to do with why its failing to find the dependency. again, modifying the installed cmake files seems to allow meson to find them. i dont know what i'm doing wrong here......... |
i did a bunch more digging, and it looks like its nothing to do with the dependency at all?! for some reason, when specifying the language types in the initial project() decleration, it breaks searching for dependencies on windows. weird. |
Hey @p01arst0rm I don't know if you got your issue resolved, but I think it's similar to a problem I was having, and was able to solve. |
its nothing to do with CMAKE_PREFIX_PATH, its to do with the variable being ignored or broken internally somewhere; the prefix path was set. |
Yes. It's being ignored, because it needs to "make itself visible". Hence export VAR=here-I-am |
again, no. This is an issue on windows, not *nix. on NT systems you use |
Okay Thanks. |
@Jillinger has a point here. The colon is used as path separator on *nix systems inside environment vars. I can see how -incorrectly applying the same logic in Windows- it could be getting confused by treating |
true, but that assumes youre running in a mingw like environment (/c/*) this is running native inside an nt shell |
Describe the bug
When searching for dependencies on windows, Meson is not capable of finding
an installed dependency with CMake. Native CMake is capable of finding the library
when
-DCMAKE_PREFIX_PATH=
is supplied at build time.To Reproduce
The current issue includes
LibKF5Attica
but i suspect this isnt to do withthe library. The following can be found in
build/meson-logs/meson-log.txt
Path enumerations have been tried, but the following provided path,
-DCMAKE_PREFIX_PATH="C:\Program Files (x86)\Attica"
allows the native CMake build to locatethe dependency.
Expected behavior
Find the cmake dependency using CMAKE_PREFIX_PATH
system parameters
native build
Windows 10 (Current patch KB4538461)
python version 3.7.1
meson version 0.54.1
ninja Not Applicable.
The text was updated successfully, but these errors were encountered: