Skip to content
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 can't find GLib/GObject on Windows #10

Open
wardjk opened this issue Jun 21, 2018 · 4 comments
Open

CMake can't find GLib/GObject on Windows #10

wardjk opened this issue Jun 21, 2018 · 4 comments

Comments

@wardjk
Copy link

wardjk commented Jun 21, 2018

Building Dependencies lists Glib/GObject (http://www.gtk.org). I installed GTK+ using MSYS2 on Windows 10.
My paths:
GStreamer: C:\gstreamer
GTK: C:\Programs\gtk\gtk-3.19
qt-gstreamer: C:\Programs\qt-gstreamer

During build, CMake reported

Could NOT find GLIB2 (missing: GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)
Could NOT find GObject (missing: GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES)

I might not have the necessary environment variables or paths that must be defined. I don't know if they were supposed to be created during installation or if I'm supposed to create or define them.

The file C:\Programs\qt-gstreamer\cmake\modules\FindGLIB2.cmake contains

find_path(GLIB2_MAIN_INCLUDE_DIR glib.h
PATH_SUFFIXES glib-2.0
HINTS ${PKG_GLIB_INCLUDE_DIRS} ${PKG_GLIB_INCLUDEDIR})

so to the environment variable "PKG_CONFIG_PATH" I added "C:\Programs\gtk\gtk-3.19\include" because glib.h is in "C:\Programs\gtk\gtk-3.19\include\glib-2.0".
Something I found that doesn't seem right is in C:\Programs\gtk\gtk-3.19\lib\pkgconfig\glib-2.0.pc which contains

prefix=/opt
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include

which makes this appear to be for linux, not Windows.
What seems to be more appropriate is what I found in C:\gstreamer\1.0\x86\lib\pkgconfig\glib-2.0.pc which contains

prefix=/c/gstreamer/1.0/x86
exec_prefix=${prefix}
libdir=/c/gstreamer/1.0/x86/lib
includedir=${prefix}/include

but when I replaced the previous path with "C:\gstreamer\1.0\x86\lib\pkgconfig" in "PKG_CONFIG_PATH", this didn't change the symptoms.
If you could let me know what I might be missing that would let cmake know where to find GLib/GObject, I'd greatly appreciate it.

@detrout
Copy link
Owner

detrout commented Jun 22, 2018

So at the worst case you could try using one of the CMake guis to try and manually set the paths.

Could you check your environment? I thought I'd seen a something that there might be some environment variables pointing to where the pkgconfig directories are? or even better is there a variable pointing to the gtk-3.19 dir?

The gstreamer .pc file does definitely look more correct for windows than the gtk file.

I don't have a windows machine so I can't help much. But I can try to help puzzle it out with you. (Ideally would be to get to a pull request)

@wardjk
Copy link
Author

wardjk commented Jun 22, 2018

While grasping for straws, I tried CMake GUI but the paths I tried evidently weren't sufficient. I don't even know if the glib-2.0.pc files I found are useable as-is but they are what were installed. I was expecting environment variables to have already been set by the installers but because the right variables may not even be present, I don't know what's missing. I was hoping someone would be able to spot which variables are required and where they should point. I've tried adding multiple combinations but nothing has worked yet. It seems that if anyone else had tried installing the required components on Windows 10, they would have run into the same build problems too. Maybe Windows isn't letting the installers do their job completely but there weren't any complaints from the installers.

@detrout
Copy link
Owner

detrout commented Jul 4, 2018

Got distracted....

The gstreamer glib config file looks more like its using windows confentions... though possibly like it was built under cygwin?

Is there a pkg-config command? does pkg-config --cflags glib-2.0 return anything? or just errors out?

@wardjk
Copy link
Author

wardjk commented Jul 10, 2018

An ugly workaround I used to get CMake to find GLib & GObject was to change the linuxy prefix path from "/c/gstreamer/1.0/x86" to "C:\gstreamer\1.0\x86". I only had to edit glib-2.0.pc and none of the other 99 .pc files in the same directory. It seems that the prefix could/should be set with an environment variable but whatever variable it may take, I didn't have it. The installation was for Windows but these files weren't compatible out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants