Building Windows installer for my application, what .dll do I need?

Hello, Windows version of my application is now OK and I’m willing to create an installer. For the moment I’m putting into this the .exe and a set of .dll for GTK, but I don’t know how to test if I don’t need anymore of those .dll librairies.

Here’s my current list

  • cairo.dll
  • expat.dll
  • fontconfig-1.dll
  • freetype-6.dll
  • libpng16.dll

I only have Windows 11 on one PC and I created another user to test but I’m not sure that msys2 and environment variables are only per user. It would be nice to have a tool that could give those dependencies. I tried to use a tool like “dependency walker” but it didn’t seem to work.

I found a way to list all dependencies using ldd from msys2 console. I will try to put all dlls from msys2 into my installer setup.

It gave me

$ ldd deplUI_A4.exe
        ntdll.dll => /c/WINDOWS/SYSTEM32/ntdll.dll (0x7fffd36f0000)
        KERNEL32.DLL => /c/WINDOWS/System32/KERNEL32.DLL (0x7fffd2e80000)
        KERNELBASE.dll => /c/WINDOWS/System32/KERNELBASE.dll (0x7fffd0c80000)
        msvcrt.dll => /c/WINDOWS/System32/msvcrt.dll (0x7fffd35f0000)
        libgobject-2.0-0.dll => /mingw64/bin/libgobject-2.0-0.dll (0x7fffa41b0000)
        libcairo-2.dll => /mingw64/bin/libcairo-2.dll (0x7fffa4090000)
        ADVAPI32.dll => /c/WINDOWS/System32/ADVAPI32.dll (0x7fffd2dd0000)
        sechost.dll => /c/WINDOWS/System32/sechost.dll (0x7fffd3540000)
        RPCRT4.dll => /c/WINDOWS/System32/RPCRT4.dll (0x7fffd1c80000)
        GDI32.dll => /c/WINDOWS/System32/GDI32.dll (0x7fffd3370000)
        win32u.dll => /c/WINDOWS/System32/win32u.dll (0x7fffd1310000)
        gdi32full.dll => /c/WINDOWS/System32/gdi32full.dll (0x7fffd11f0000)
        msvcp_win.dll => /c/WINDOWS/System32/msvcp_win.dll (0x7fffd1020000)
        ucrtbase.dll => /c/WINDOWS/System32/ucrtbase.dll (0x7fffd13c0000)
        USER32.dll => /c/WINDOWS/System32/USER32.dll (0x7fffd2c10000)
        ole32.dll => /c/WINDOWS/System32/ole32.dll (0x7fffd3180000)
        combase.dll => /c/WINDOWS/System32/combase.dll (0x7fffd1810000)
        libffi-8.dll => /mingw64/bin/libffi-8.dll (0x7fffbe280000)
        libgio-2.0-0.dll => /mingw64/bin/libgio-2.0-0.dll (0x7fffa3e50000)
        SHELL32.dll => /c/WINDOWS/System32/SHELL32.dll (0x7fffd2400000)
        SHLWAPI.dll => /c/WINDOWS/System32/SHLWAPI.dll (0x7fffd3000000)
        WS2_32.dll => /c/WINDOWS/System32/WS2_32.dll (0x7fffd16a0000)
        libglib-2.0-0.dll => /mingw64/bin/libglib-2.0-0.dll (0x7fffa3cf0000)
        libglib-2.0-0.dll => /mingw64/bin/libglib-2.0-0.dll (0x260d2540000)
        MSIMG32.dll => /c/WINDOWS/SYSTEM32/MSIMG32.dll (0x7fffbe270000)
        libgcc_s_seh-1.dll => /mingw64/bin/libgcc_s_seh-1.dll (0x7fffa7810000)
        libfontconfig-1.dll => /mingw64/bin/libfontconfig-1.dll (0x7fffa3c90000)
        libfreetype-6.dll => /mingw64/bin/libfreetype-6.dll (0x7fffa3bd0000)
        libpixman-1-0.dll => /mingw64/bin/libpixman-1-0.dll (0x7fffa3b20000)
        libgtk-4-1.dll => /mingw64/bin/libgtk-4-1.dll (0x7fffa3430000)
        comdlg32.dll => /c/WINDOWS/System32/comdlg32.dll (0x7fffd33e0000)
        shcore.dll => /c/WINDOWS/System32/shcore.dll (0x7fffd1da0000)
        CRYPT32.dll => /c/WINDOWS/System32/CRYPT32.dll (0x7fffd0b10000)
        IMM32.dll => /c/WINDOWS/System32/IMM32.dll (0x7fffd33a0000)
        SETUPAPI.dll => /c/WINDOWS/System32/SETUPAPI.dll (0x7fffd1f70000)
        DNSAPI.dll => /c/WINDOWS/SYSTEM32/DNSAPI.dll (0x7fffcf720000)
        libpng16-16.dll => /mingw64/bin/libpng16-16.dll (0x7fffa33e0000)
        IPHLPAPI.DLL => /c/WINDOWS/SYSTEM32/IPHLPAPI.DLL (0x7fffcf6a0000)
        zlib1.dll => /mingw64/bin/zlib1.dll (0x260d2550000)
        zlib1.dll => /mingw64/bin/zlib1.dll (0x7fffa33b0000)
        libstdc++-6.dll => /mingw64/bin/libstdc++-6.dll (0x7fffa31b0000)
        libintl-8.dll => /mingw64/bin/libintl-8.dll (0x260d2550000)
        libintl-8.dll => /mingw64/bin/libintl-8.dll (0x7fffa3180000)
        libgmodule-2.0-0.dll => /mingw64/bin/libgmodule-2.0-0.dll (0x7fffb93d0000)
        libpcre2-8-0.dll => /mingw64/bin/libpcre2-8-0.dll (0x7fffa3110000)
        libexpat-1.dll => /mingw64/bin/libexpat-1.dll (0x7fffa30d0000)
        libiconv-2.dll => /mingw64/bin/libiconv-2.dll (0x7fffa2fb0000)
        libwinpthread-1.dll => /mingw64/bin/libwinpthread-1.dll (0x7fffa6b20000)
        COMCTL32.dll => /c/WINDOWS/WinSxS/ (0x7fffbbf70000)
        dwmapi.dll => /c/WINDOWS/SYSTEM32/dwmapi.dll (0x7fffcdef0000)
        HID.DLL => /c/WINDOWS/SYSTEM32/HID.DLL (0x7fffcf410000)
        WINMM.dll => /c/WINDOWS/SYSTEM32/WINMM.dll (0x7fffc9550000)
        WINSPOOL.DRV => /c/WINDOWS/SYSTEM32/WINSPOOL.DRV (0x7fffaa900000)
        libbz2-1.dll => /mingw64/bin/libbz2-1.dll (0x7fffa6100000)
        libbrotlidec.dll => /mingw64/bin/libbrotlidec.dll (0x7fffa2f90000)
        libcairo-gobject-2.dll => /mingw64/bin/libcairo-gobject-2.dll (0x7fffa2f70000)
        libharfbuzz-0.dll => /mingw64/bin/libharfbuzz-0.dll (0x7fffa2e40000)
        libcairo-script-interpreter-2.dll => /mingw64/bin/libcairo-script-interpreter-2.dll (0x7fffa2e10000)
        libfribidi-0.dll => /mingw64/bin/libfribidi-0.dll (0x7fffa2de0000)
        libgdk_pixbuf-2.0-0.dll => /mingw64/bin/libgdk_pixbuf-2.0-0.dll (0x7fffa2db0000)
        libjpeg-8.dll => /mingw64/bin/libjpeg-8.dll (0x7fffa2ce0000)
        libgraphene-1.0-0.dll => /mingw64/bin/libgraphene-1.0-0.dll (0x7fffa2cb0000)
        libepoxy-0.dll => /mingw64/bin/libepoxy-0.dll (0x7fffa2b00000)
        libpango-1.0-0.dll => /mingw64/bin/libpango-1.0-0.dll (0x7fffa2a90000)
        libpangocairo-1.0-0.dll => /mingw64/bin/libpangocairo-1.0-0.dll (0x7fffa2a70000)
        USP10.dll => /c/WINDOWS/SYSTEM32/USP10.dll (0x7fffcc050000)
        libpangowin32-1.0-0.dll => /mingw64/bin/libpangowin32-1.0-0.dll (0x7fffa2a50000)
        libtiff-5.dll => /mingw64/bin/libtiff-5.dll (0x7fffa29c0000)
        gdiplus.dll => /c/WINDOWS/WinSxS/ (0x7fff76430000)
        libbrotlicommon.dll => /mingw64/bin/libbrotlicommon.dll (0x7fffa2990000)
        libgraphite2.dll => /mingw64/bin/libgraphite2.dll (0x7fffa2960000)
        liblzo2-2.dll => /mingw64/bin/liblzo2-2.dll (0x7fffa2930000)
        libthai-0.dll => /mingw64/bin/libthai-0.dll (0x7fffa2910000)
        libdeflate.dll => /mingw64/bin/libdeflate.dll (0x7fffa28f0000)
        libpangoft2-1.0-0.dll => /mingw64/bin/libpangoft2-1.0-0.dll (0x7fffa28d0000)
        libjbig-0.dll => /mingw64/bin/libjbig-0.dll (0x69500000)
        libLerc.dll => /mingw64/bin/libLerc.dll (0x7fffa2830000)
        DPAPI.DLL => /c/WINDOWS/SYSTEM32/DPAPI.DLL (0x7fffd07d0000)
        liblzma-5.dll => /mingw64/bin/liblzma-5.dll (0x7fffa2800000)
        libwebp-7.dll => /mingw64/bin/libwebp-7.dll (0x7fffa2780000)
        libzstd.dll => /mingw64/bin/libzstd.dll (0x7fffa26a0000)
        libdatrie-1.dll => /mingw64/bin/libdatrie-1.dll (0x7fffb8850000)
echo -n "Copy app dependency library......"
ldd "${SOURCEDIR}/build/src/kangaroo.exe" | grep "$MSYSTEM_PREFIX\/bin\/.*dll" -o | xargs -I{} cp -f "{}" "${TARGETDIR}/bin/"

More detail pls see blog: How to deploy GTK based app on windows?

1 Like

Thanks a lot for that. I searched for such code but as my application is on GTK4 I didn’t look at things targeting GTK3, but I should be aware that there are way more information on GTK3 than on GTK4.

I just made a setup executable with the 45 dlls from msys2/mingw64, but when I try to run my application .exe into the directory with the dlls, it runs but when I try to use it, it silently crashes. What only works is if I only open the parameters window. As it crashes when I open a file selector dialog to choose the file to work with, it can be something related to such dialogs. To have some feedback I tried to run from command line but this way it only runs the application and leaves no message when it crashes. I’m going to try to run using gdb.

Here’s what I have with gdb. At startup of the application there is 132 warning : onecore\com\combast… combase.dll … Classe non enregistrée (class not registered). Does it mean that those dlls need to be registered (to regsvr32.exe ?) before they can be used ? And last feedback from gdb was that

Thread 1 received signal SIGTRAP, Trace/breakpoint trap.
0x00007ffd6f453e23 in ?? () from C:\gigi\deplUI\libglib-2.0-0.dll

I tried to run the application from the MSys2 Mingw64 console and it works. But how can I build a windows installer so that users can run my application the same way ? I’m thinking that I need to be able to compile using MSVC but I’m having troubles to build GTK4 with Visual Studio 2022. For the latter version of my application that was a console application, I was able to use CMake but I didn’t manage to make this work with the GUI application.

Well, I am now compiling and linking with --static. And the executable runs, but it complains when I use a FileChooser with
No GSettings schemas are installed in the system

So, I need to add a script that will add those GSettings Schemas. As I can read from the link given by @taozuhong, the command is glib-compile-schemas. I’m trying this.

I created a file that I called like my application ID and .gschema.xml that makes

I looked at GNOME HowDoI/GSettings page to see what’s inside such file

<?xml version="1.0" encoding="utf-8"?>


  <schema path="/dev/depl/" id="com.github.gilboonet.deplieur">



But I’m not sure that the path will be correct on users installation directory, I may let path blank.

I recently installed Evince on Windows using a .msi and it works fine, I tried to find how they did that but didn’t find any information except that it was on a old version. It’s sad that my application deployment is stopped because I used FileChooser that needs GSettings. I didn’t expect to be digging into such technical things only to share my application with people using Windows.

Put your GSettings Schema file into the schema dir like /usr/share/glib-2.0/schemas, then compile it via glib-compile-schemas, then just publish app with the compiled schema file(gschema.dtd, gschemas.compiled), all done.

Thank you for your help. I found a directory named


I put my file


on it.
As I didn’t identify what path to use, I put

  <schema path="/com/github/gilboonet/deplieur/" id="com.github.gilboonet.deplieur">

Then I compiled with glib-compile-schemas which produced a file named gschemas.compiled and I put it with gschemas.dtd into my application directory, created the setup executable and run it. But my path was certainly wrong as when I use a FileChooser, I still have “No GSettings schemas are installed in the system”. I try to find information about what I should use as path on the schema on Windows but didn’t find anything, only examples of gschemas to do various things on Linux.

I’m starting to make a windows version of my application using Visual Studio from scratch, certainly in C# that I need to learn as there’s no easy Windows C library to replace Cairo, it has a little more than 3000 lines but the algorithms won’t change.

The right path on MSYS2 is:

Thank you again, I’m certainly missing something. I put my .gschema.xml file into c:\msys2\mingw64\share\glib-2.0\schemas compiled and put the compiled file + the dtd into my application directory. But when I run it, I have the same error “No Gsettings are installed in the system”. I also tried two things that worked

  • run the application using MSys2 mingw64 console from its directory
  • put the .exe into c:\msys2\mingw61\bin and run it from Msys mingw64 console without being into the application directory
    So it maybe something that msys2 has that need to be added to the application directory within the gtk dlls or/and that I’m doing wrong with the path on the application gschema.xml. I will read glib-compile-schemas code but I’m not expert al all on that, only an average non IT specialist that has enough knowledge of C language to code user softwares, not system ones.

I’m still trying to make my deployment possible, apparently your script is for a GTK3 application and mine is a GTK4 one, maybe it can be different, but I’m struggling to find information about deployment of GTK4 app. In fact, I found lots of things for GTK3 but nothing for GTK4 deployment on Windows. As a workaround I also tried to find a way to be able to compile using Microsoft toolchain, but every solution I tried (from collabora’s one to CMake that previously worked but with a console application using only Cairo dlls) failed. I wonder if there are GTK4 applications that can be deployed on Windows.

Well, I’m progressing. I managed to build GTK4 on Windows using Collabora’s blog note. Now with the help of their other blog note “build your own application with GTK4 as a Meson subproject” I’m trying to compile my code which is only a main.c file and has gtk4 as dependency. I don’t understand how to use the GTK4 that I build on c:\gnome as that dependency. So I tried the wrap-git method that the blog note gives but git cannot clone from it (fatal : “could not find remote branch master to clone”).

  • What I did is create a directory
  • put my main.c (and its main.h) into it
  • create a with
project('deplieur', 'c')
executable('deplieur', 'main.c',
  • create the file gtk.wrap into the sub-dir subprojects into my project directory
  • run “meson setup build --prefix C:\gnome” (on VS x64 native tools console)

Is there something that I did wrong ? Did someone build a GTK4 application on Windows using that method ? I see that on the GTK4 build there are examples applications that were built, maybe I add mine there and use the of the examples directory to build it ?

I finally solve that building problem by using MSVC that I configured manually as I’m not at ease with Meson.

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