15

Unfortunately, I am using Windows (Windows7 x64). With MinGW compiler in Code::Blocks and GTK+3.6.4. I compiled manually all the schemas from glib.


When I use File Chooser dialogue / colorpicker - it doesn't matter, I am getting the following error: GLib-GIO-ERROR**: No GSettings schemas are installed on the system and the program terminates.


What do I have to do to fix this?

DeltaProxy
  • 208
  • 1
  • 2
  • 7

3 Answers3

17

GSettings looks at the compiled schemas in the directories pointed by the $XDG_DATA_DIR environment variable. You can either use a launcher script that sets up the environment for you, or you can rely on the prefix, and install the gschemas.compiled files in the share/glib-2.0/schemas directory under the same prefix as your app binary is, e.g. if you have the following layout:

YourApp/
  bin/
    YourApp.exe
  lib/
    libgtk3.dll
    libgobject.dll
    …
  share/
    …
    glib-2.0/
      schemas/

Make sure that the gschemas.compiled file is under YourApp/share/glib-2.0/schemas, and that the org.gtk.Settings.FileChooser.gschema.xml is there as well.

ebassi
  • 8,648
  • 27
  • 29
  • I never understood exactly the thing with that variable. Is this system environment variable that I can set from Advanced System Settings with the name `XDG_DATA_DIR` and the value of `D:\apps\gtk\share\glib-2.0\schemas` Also I am aiming to compile my programs statically. – DeltaProxy Mar 10 '15 at 11:28
  • 2
    The `XDG_DATA_DIR` environment variable is a colon-separated list of directories, in decreasing order of preference, used to compute paths for files — see: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html – ebassi Mar 10 '15 at 19:47
  • 1
    As an aside: GLib and GTK+ do not like much being statically compiled, as they have, or depend, on various run-time loadable modules. You can tweak the loading paths for most of them. In this case, though, loading a file has no bearing to static or dynamic linking. It's a location for ancillary files, and you can use environment variables to handle relocatability. – ebassi Mar 10 '15 at 19:49
  • Might sound insolent.. but I see that you have enough knowledge to help. Do you have any free time to help by Team Viewer. I will keep one in mind for returning the favor. RETURN_SUCCESS – DeltaProxy Mar 10 '15 at 20:08
  • +1. This fixed it for me, and probably answers the question, though it's not marked as such (and was derailed). – underscore_d Apr 01 '16 at 15:44
  • @DeltaProxy XDG_DATA_DIRS should not include the `\share\glib-2.0\schemas` part, i.e. only `D:\apps\gtk` in your case. – Jonas Berlin May 30 '16 at 12:48
10

The problem is with the Glib schemas that apparently are not compiled on your system.

You need the glib-compile-schemas and find the glib-2.0/schemas directory which is located in /usr/share/glib-2.0/schemas, I don't know if it will be found in the same path within MinGW, but I don't see why it wouldn't, so you must execute the following command1

glib-compile-schemas /usr/share/glib-2.0/schemas/

and that will create a file gschemas.compiled so you need write permission, then the error will go away.


1Provided that the GLib schemas are installed in that directory.

Cole Tobin
  • 9,206
  • 15
  • 49
  • 74
Iharob Al Asimi
  • 52,653
  • 6
  • 59
  • 97
  • Because I am stuck to Windows so as many other users. By the way, I've already mentioned that I have compiled them successfully.. though they are already compiled in the bundle anyway (i.e `gschemas.compiled` already exists) – DeltaProxy Mar 10 '15 at 00:06
  • Delete it an recompile it, or search for the `.gschema.xml` file corresponding to the missing `schema` and check if it was compiled successfuly or if it was compiled at all. – Iharob Al Asimi Mar 10 '15 at 00:09
  • Well I tried with two different `gschemas.compiled` the first, that is compiled by default (as a bundle's 3rd party dependent) and the other, compiled manually by me. Though.. I needed to use `intl.dll` from gtk2's bin, because it didn't exist and that caused crash when using `gsettings`. On the other hand I have no idea of what checking you mind. – DeltaProxy Mar 10 '15 at 00:12
  • Not compiled, or simply not copied into the executable's redistributable folder (along with DLLs, icons, themes, etc.) – underscore_d Apr 01 '16 at 15:45
0

I could solve this issue from the following documentation as below https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html following environment variable to the share folders similar to below in my case

XDG_DATA_DIRS : D:\vcpkg\installed\x64-windows\share

solmon
  • 41
  • 1
  • 6