Compiling Gnome Text Editor for Msys2

To bring the light of open-source to Windows (and because I need it for another project of mine) I’ve been trying to compile Gnome Text Editor for Windows using Msys2 Mingw64. Over the past month and a half I’ve figured out how to use Meson to a large extent, how to use a gitlab pipeline, gotten a 22(!) year old bug in Meson patched as well as, just last night, patching an issue that was preventing proper linking due to a lack of invoking linking arguments for the project that’s being compiled in a number of project’s meson.build files. Currently, I can get to step 3460/3560 before compilation will fail. The error I get is as follows (the gitlab thread for the issue can be found at https://gitlab.gnome.org/GNOME/gnome-text-editor/-/issues/451):

[3460/3560] Compiling C object src/gnome-text-editor.exe.p/editor-path.c.obj
FAILED: src/gnome-text-editor.exe.p/editor-path.c.obj 
"cc" "-Isrc/gnome-text-editor.exe.p" "-Isrc" "-I../src" "-I." "-I.." "-Isrc/editorconfig" "-I../src/editorconfig" "-Isubprojects/glib/gio" "-I../subprojects/glib/gio" "-Isubprojects/glib/gmodule" "-I../subprojects/glib/gmodule" "-Isubprojects/glib" "-I../subprojects/glib" "-Isubprojects/glib/glib" "-I../subprojects/glib/glib" "-Isubprojects/glib/gobject" "-I../subprojects/glib/gobject" "-Isubprojects/gtk" "-I../subprojects/gtk" "-Isubprojects/gtk/gtk" "-I../subprojects/gtk/gtk" "-I../subprojects/gtk/gdk/x11" "-Isubprojects/gtk/gdk" "-I../subprojects/gtk/gdk" "-Isubprojects/gtksourceview" "-I../subprojects/gtksourceview" "-Isubprojects/libadwaita/src" "-I../subprojects/libadwaita/src" "-Isubprojects/gtk/gtk/css" "-Isubprojects/gtk/gsk" "-Isubprojects/gtksourceview/gtksourceview" "-IC:/msys64/mingw64/include/pango-1.0" "-IC:/msys64/mingw64/include" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-IC:/msys64/mingw64/include/harfbuzz" "-IC:/msys64/mingw64/include/freetype2" "-IC:/msys64/mingw64/include/libpng16" "-IC:/msys64/mingw64/include/fribidi" "-IC:/msys64/mingw64/include/cairo" "-IC:/msys64/mingw64/include/lzo" "-IC:/msys64/mingw64/include/pixman-1" "-IC:/msys64/mingw64/include/gdk-pixbuf-2.0" "-IC:/msys64/mingw64/include/graphene-1.0" "-IC:/msys64/mingw64/lib/graphene-1.0/include" "-IC:/msys64/mingw64/include/libxml2" "-IC:/msys64/mingw64/include/enchant-2" "-fdiagnostics-color=always" "-D_FILE_OFFSET_BITS=64" "-Wall" "-Winvalid-pch" "-Wextra" "-std=gnu17" "-O0" "-g" "-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_74" "-DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_74" "-DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_4_8" "-DGDK_VERSION_MAX_ALLOWED=GDK_VERSION_4_8" "-DGTK_SOURCE_VERSION_MIN_REQUIRED=GTK_SOURCE_VERSION_5_6" "-DGTK_SOURCE_VERSION_MAX_ALLOWED=GTK_SOURCE_VERSION_5_6" "-Wcast-align" "-Wdeclaration-after-statement" "-Werror=address" "-Werror=array-bounds" "-Werror=empty-body" "-Werror=implicit" "-Werror=init-self" "-Werror=int-conversion" "-Werror=int-to-pointer-cast" "-Werror=main" "-Werror=misleading-indentation" "-Werror=missing-braces" "-Werror=missing-include-dirs" "-Werror=nonnull" "-Werror=overflow" "-Werror=pointer-arith" "-Werror=pointer-to-int-cast" "-Werror=return-type" "-Werror=sequence-point" "-Werror=shadow" "-Werror=strict-prototypes" "-Werror=trigraphs" "-Werror=undef" "-Werror=write-strings" "-Wformat-nonliteral" "-Werror=format-security" "-Werror=format=2" "-Wignored-qualifiers" "-Wimplicit-function-declaration" "-Wlogical-op" "-Wmissing-format-attribute" "-Wmissing-include-dirs" "-Wmissing-noreturn" "-Wnested-externs" "-Wno-cast-function-type" "-Wno-missing-field-initializers" "-Wno-sign-compare" "-Wno-unused-parameter" "-Wold-style-definition" "-Wpointer-arith" "-Wstrict-prototypes" "-Wswitch-default" "-Wswitch-enum" "-Wundef" "-Wuninitialized" "-Wunused" "-fno-strict-aliasing" "-fstack-protector-strong" "-fstack-protector-strong" "-Wmissing-declarations" "-mms-bitfields" "-mms-bitfields" "-mms-bitfields" "-mms-bitfields" "-mms-bitfields" "-mms-bitfields" "-mms-bitfields" "-mfpmath=sse" "-msse" "-msse2" "-mms-bitfields" "-mms-bitfields" "-mms-bitfields" "-mms-bitfields" "-mms-bitfields" "-DHAVE_ENCHANT" -MD -MQ src/gnome-text-editor.exe.p/editor-path.c.obj -MF "src/gnome-text-editor.exe.p/editor-path.c.obj.d" -o src/gnome-text-editor.exe.p/editor-path.c.obj "-c" ../src/editor-path.c
../src/editor-path.c:27:10: fatal error: wordexp.h: No such file or directory
   27 | #include <wordexp.h>
      |          ^~~~~~~~~~~
compilation terminated.

[3461/3560] Compiling C object src/gnome-text-editor.exe.p/editor-position-label.c.obj
[3462/3560] Compiling C object src/gnome-text-editor.exe.p/editor-preferences-dialog.c.obj
[3463/3560] Compiling C object src/gnome-text-editor.exe.p/editor-preferences-font.c.obj
[3464/3560] Compiling C object src/gnome-text-editor.exe.p/editor-page-vim.c.obj
ninja: build stopped: subcommand failed.

To reproduce run (in an msys2 environment):

yes | pacman -S mingw-w64-x86_64-pkg-config
yes | pacman -S pkg-config
yes | pacman -S mingw-w64-x86_64-gstreamer
yes | pacman -S mingw-w64-x86_64-gst-plugins-base
yes | pacman -S mingw-w64-x86_64-gst-plugins-bad
yes | pacman -S mingw-w64-x86_64-gst-plugins-bad-libs
yes | pacman -S mingw-w64-x86_64-gst-plugins-good
yes | pacman -S mingw-w64-x86_64-gst-plugins-ugly
yes | pacman -S mingw-w64-x86_64-gst-plugins-bad-libs
yes | pacman -S mingw-w64-x86_64-gtk4
yes | pacman -S mingw-w64-x86_64-meson
yes | pacman -S mingw-w64-x86_64-meson
yes | pacman -S mingw-w64-x86_64-libadwaita
yes | pacman -S mingw-w64-x86_64-gobject-introspection
yes | pacman -S mingw-w64-x86_64-python-gobject
yes | pacman -S mingw-w64-x86_64-vala
yes | pacman -S mingw-w64-x86_64-enchant
yes | pacman -S mingw-w64-x86_64-itstool
yes | pacman -S mingw-w64-x86_64-editorconfig-core-c
yes | pacman -S mingw-w64-x86_64-gobject-introspection
yes | pacman -S mingw-w64-x86_64-python-gobject
yes | pacman -S mingw-w64-x86_64-vala
yes | pacman -S mingw-w64-x86_64-enchant
yes | pacman -S mingw-w64-x86_64-itstool
yes | pacman -S mingw-w64-x86_64-editorconfig-core-c
yes | pacman -S itstool
yes | pacman -s mingw-w64-x86_64-libssp
yes | pacman -S mingw-w64-clang
yes | pacman -S clang
yes | pacman -R gtksourceview
yes | pacman -R glib
yes | pacman -S mingw-w64-x86_64-gcc
echo "all" | pacman -S --needed base-devel mingw-w64-x86_64-toolchain
yes | pacman -S meson
yes | pacman -Syu
git clone https://gitlab.gnome.org/Zacharymk1213/gnome-text-editor.git
cd gnome-text-editor
meson setup builddir -Dforce_fallback_for=libadwaita,glib,gtk4,binutils,gtksourceview

The issue is that the job is failing because (as explained here:gcc - Standard C library in mingW - Stack Overflow) Gnome Text Editor invokes headers from glibc while Mingw builds against msvcrt and hence it cannot find the required headers (wordexp.h in this case). I do not know C and hence cannot reimplement this myself (much as I’d like to). Is there a Visual C compatible implementation of these headers? If not, could someone possibly create such an implementation?

The logs from my pipeline can be found here: https://gitlab.gnome.org/Zacharymk1213/gnome-text-editor/-/jobs/2199858/raw

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