How to distribute a GTK+ application on Windows?

bradrn picture bradrn · Mar 4, 2018 · Viewed 9.1k times · Source

I have installed GTK+ (specifically GTK3) via MSYS and MinGW on Windows. I now want to copy the GTK+ dlls to my application directory so that it can be run on a computer without a global GTK+ installation. Which dlls are required for GTK+ to operate?

EDIT: The GTK+ documentation now contains instructions for distributing the required icons and themes on Windows. (Although it doesn’t have instructions for distributing the relevant DLL files — for that see the answers below.)

Answer

liberforce picture liberforce · Mar 5, 2018

You have some hints on the Windows page of the GTK website. This is the section named Building and distributing your application. It features a blog post about distributing a GTK application on Windows.

The solution proposed there is to create a MSYS2 package for your application, and then install it and all its dependencies (GTK among them) in a specific directory, so that you can redistribute the whole package.

2020-12-09 EDIT:

Reading the other answers, I want to add that this method not only gets the dependencies for shared objects and binaries right, but that should also work with other kinds of ressources (images, help files, etc.) that are in the required packages, as well as shared objects loaded at runtime with dlopen-based functions. This is something you can't get with just calling ldd to find the dependencies.