Cross compile loaders.cache


I’m trying to cross compile gtk application on Linux to Windows. I’m testing with an extremely simple application that has only a window (basically the one of “getting started with gtk” except written in rust with gtk-rs).

I’ve cross-compiled my exe, found all the dll necessary, but I can’t get the icons on the top right shown correctly, as it suggests that Image type "png" is not supported.

I’m aware of the cause which is the absence of loaders.cache, but I can’t figure out how I’m supposed to cross build a loaders.cache since the linux version of gdk-pixbuf-query-loaders can’t generate information from dlls.

I have the last option of using wine, but before that, I’d like to ask if there’s any other solutions.


You should get a target (Windows) build of gdk-pixbuf-query-loaders and you can run this on the target (Windows) to generate the list before your program starts. You would probably do this as a “hook” at the end of the build process.

There are some more things you might run at this post-build, pre-execution stage - looking at the old list of triggers in jhbuild can give you some ideas.

Though not quite what the OP asked for, an option is to run gdk-pixbuf-query-loaders as part of the install process. It can be done with tools such as NSIS, Wix Toolset, etc. Of course that does not solve the problem when shipping the application as a simple archive.

Thank you for your suggestion, but running on target (Windows) is a bit off topic. What I’m trying to do is cross compiling, which obviously meaning that using no windows.

I also checked the trigger s in jhbuild, which shows no hint for ‘cross compilation’: they just executed gdk-pixbuf-query-loaders.

That might be a good idea, but which also means that gdk-pixbuf-query-loaders should be included in the build?

For a Windows build, I’d strongly recommend building all pixbuf loaders as built-ins into gdk-pixbuf. PNG and JPEG should already be built in by default if you’re building gdk-pixbuf from Git; in doubt, use -Dbuiltin_loaders=all when configuring gdk-pixbuf.

The only non-built-in loader that you might need is the SVG one, shipped by librsvg; cross-compiling that for Windows is slightly more complicated, and at that time, you’ll need a native build of gdk-pixbuf-query-loaders and run it at installation time, or at least a build of gdk-pixbuf with -Drelocatable=true and then run gdk-pixbuf-query-loaders locally and copy the loaders.cache.

Thank you for your reply.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.