Open Sahnvour opened 3 years ago
Does it work if you install the dependency before running meson (i.e. like you're supposed to)?
It does not matter, the conan installation part runs fine (ie it produces the expected Finglfw3.cmake), but I guess something in how its cmake is written prevents meson from detecting it ?
When you say "it doesn't matter", do you mean "I think it's a bug if meson cares when/how you do it", or do you mean "meson still fails when you run conan install before running meson"?
I mean the latter
meson still fails when you run conan install before running meson
As far as I understand, meson uses the FindXYZ.cmake files to setup fake projects and find dependency's paths/settings.
From meson's point of view, it does not matter if the conan install ...
has run before configuring the build or during it, since in both cases the Findglfw3.cmake is present before the call to dependency('glfw', ...)
.
Since it works with a different packaging of glfw3, I guess it has something to do with how they are configured on the cmake side.
What does this Findglfw3.cmake
look like? How does it compare to the one installed via the bincrafters project?
The only real difference seems to be, the broken dependency('glfw3') requires opengl, the detected/working dependency('glfw') does not...
Does meson-logs/meson-log.txt have any interesting information about the lookup attempt?
Unfortunately it doesn't (to me at least).
Conan installs glfw3 and opengl (it's kind of a fake dependency) just fine:
broken.txt: Installing package
Requirements
glfw/3.3.2 from 'conan-center' - Cache
opengl/system from 'conan-center' - Cache
Packages
glfw/3.3.2:d3cffeefc8c8bcb6be8abdd182cb1b56fc81bacc - Cache
opengl/system:5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9 - Cache
Installing (downloading, building) binaries...
opengl/system: Already installed!
glfw/3.3.2: Already installed!
broken.txt: Generator txt created conanbuildinfo.txt
broken.txt: Generator cmake_find_package created Findglfw3.cmake
broken.txt: Generator cmake_find_package created Findopengl.cmake
broken.txt: Generated conaninfo.txt
broken.txt: Generated graphinfo
and then from stderr:
--- stderr ---
Pkg-config binary for MachineChoice.HOST is not cached.
None of 'PKG_CONFIG' are defined in the environment, not changing global flags.
Pkg-config binary missing from cross or native file, or env var undefined.
Trying a default Pkg-config fallback at pkg-config
Found pkg-config: home\scoop\shims\pkg-config.EXE (0.26)
Determining dependency 'glfw' with pkg-config executable 'home\\scoop\\shims\\pkg-config.EXE'
PKG_CONFIG_PATH: C:\Program Files\Git\usr\lib\pkgconfig;C:\Program Files\Git\usr\share\pkgconfig;C:\Program Files\Git\lib\pkgconfig
Called `home\scoop\shims\pkg-config.EXE --modversion glfw` -> 1
CMake binary for MachineChoice.HOST is not cached
None of 'CMAKE' are defined in the environment, not changing global flags.
CMake binary missing from cross or native file, or env var undefined.
Trying a default CMake fallback at cmake
Found CMake: home\scoop\shims\cmake.EXE (3.18.4)
None of 'CMAKE_PREFIX_PATH' are defined in the environment, not changing global flags.
Extracting basic cmake information
Try CMake generator: auto
Calling CMake (['home\\scoop\\shims\\cmake.EXE']) in repro_glfw\build\meson-private\cmake_glfw with:
- "--trace-expand"
- "--trace-format=json-v1"
- "--no-warn-unused-cli"
- "--trace-redirect=cmake_trace.txt"
- "-DCMAKE_TOOLCHAIN_FILE=repro_glfw/build/meson-private/cmake_glfw/CMakeMesonToolchainFile.cmake"
- "."
-- Module search paths: ['/Program Files', '/Program Files (x86)', 'home/scoop/apps/cmake/3.18.4']
-- CMake root: home/scoop/apps/cmake/3.18.4/share/cmake-3.18
-- CMake architectures: []
-- CMake lib search paths: ['lib', 'lib32', 'lib64', 'libx32', 'share']
Preliminary CMake check failed. Aborting.
Run-time dependency glfw found: NO (tried pkgconfig and cmake)
meson.build:14:0: ERROR: Dependency "glfw" not found, tried pkgconfig and cmake
OK, looks like the Preliminary CMake check failed. Aborting.
message is the main issue here.
Could you please try cloning Meson and commenting out this line (or the entire branch) to check if this "fixes" the issue?
Tried removing the early return or even the whole branch, it goes a bit further and does a second call to cmake but still ultimately fails.
CMake binary for MachineChoice.HOST is not cached
CMake binary missing from cross or native file, or env var undefined.
Trying a default CMake fallback at cmake
Found CMake: home\scoop\shims\cmake.EXE (3.20.1)
Extracting basic cmake information
Try CMake generator: auto
Calling CMake (['home\\scoop\\shims\\cmake.EXE']) in repro_glfw\build\meson-private\cmake_glfw with:
- "--trace-expand"
- "--trace-format=json-v1"
- "--no-warn-unused-cli"
- "--trace-redirect=cmake_trace.txt"
- "-DCMAKE_TOOLCHAIN_FILE=repro_glfw/build/meson-private/cmake_glfw/CMakeMesonToolchainFile.cmake"
- "."
-- Module search paths: ['C:/Program Files', 'C:/Program Files (x86)', 'home/scoop/apps/cmake/3.20.1']
-- CMake root: home/scoop/apps/cmake/3.20.1/share/cmake-3.20
-- CMake architectures: []
-- CMake lib search paths: ['lib', 'lib32', 'lib64', 'libx32', 'share']
Determining dependency 'glfw' with CMake executable 'home\\scoop\\shims\\cmake.EXE'
Try CMake generator: auto
Calling CMake (['home\\scoop\\shims\\cmake.EXE']) in repro_glfw\build\meson-private\cmake_glfw with:
- "-DNAME=glfw"
- "-DARCHS="
- "-DVERSION="
- "-DCOMPS="
- "-DCMAKE_MODULE_PATH=repro_glfw\build"
- "--trace-expand"
- "--trace-format=json-v1"
- "--no-warn-unused-cli"
- "--trace-redirect=cmake_trace.txt"
- "-DCMAKE_TOOLCHAIN_FILE=repro_glfw/build/meson-private/cmake_glfw/CMakeMesonToolchainFile.cmake"
- "."
Run-time dependency glfw found: NO (tried pkgconfig and cmake)
meson.build:14:0: ERROR: Dependency "glfw" not found, tried pkgconfig and cmake
OK, the "-DCMAKE_MODULE_PATH=repro_glfw\build"
part looks suspect (as in the \
is completely broken).
Where does repro_glfw\build
come from? Is it set manually or by conan?
This is the path I'm instructing conan to install packages into, in this case the build dir ('--install-folder', meson.current_build_dir()
).
The backslash probably comes from the fact that I'm on windows (but doing my cli stuff under git bash
). However replacing it with forward slashes does not help.
I managed to get it to work with your meson.build
(on Linux) with by adding modules: ['glfw::glfw']
to the dependency call. Are you sure you have a Findglfw3.cmake
in your build dir?
I'm using
conan
inside my meson script to retrieve dependencies.Usually it works well, but the
glfw
package from conan-center does not.I'm currently using another packaging of glfw from a non-official repository but it's not ideal for various reasons.
I've attached a minimal repro. Just run the configuration step. Inside
meson.build
, change the if to switch between working and non-working packages. In the broken case, neitherglfw
norglfw3
are found.Tested on windows and linux.
repro_glfw.zip