From bc8849fa220da6c8b9eb34840abbc09b25a0d54c Mon Sep 17 00:00:00 2001 From: Steffen Pohle Date: Wed, 24 Nov 2021 19:05:45 +0100 Subject: [PATCH] converting from pain text to md file --- HowTo-Cross-Compile.md | 134 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 HowTo-Cross-Compile.md diff --git a/HowTo-Cross-Compile.md b/HowTo-Cross-Compile.md new file mode 100644 index 0000000..c40f368 --- /dev/null +++ b/HowTo-Cross-Compile.md @@ -0,0 +1,134 @@ +# Cross Compile + +This manual explains the steps to prepare a basic cross compiling environment on Debian. The build will be installed to `/opt/W64-cross-compile`. If the destination folder is set up right, you do not need any root rights. + +The following packages are needed: +- wine +- wine64 +- mingw-w64 +- mingw-w64-tools + +# Prepare the `cross-file.ini` + +This configuration file will be needed on all meson builds. + + [host_machine] + system = 'windows' + cpu_family = 'x86_64' + cpu = 'x86_64' + endian = 'little' + + [properties] + c_args = [] + c_link_args = [] + + [binaries] + c = '/usr/bin/x86_64-w64-mingw32-gcc' + cpp = '/usr/bin/x86_64-w64-mingw32-g++' + ar = '/usr/bin/x86_64-w64-mingw32-ar' + strip = '/usr/bin/x86_64-w64-mingw32-strip' + pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config' + windres = '/usr/bin/x86_64-w64-mingw32-windres' + ld = '/usr/bin/x86_64-w64-mingw32-ld' + exe_wrapper = 'wine64' + + +# lib-glib + +Compile the library using the following steps. + + mkdir build + cd build + meson --buildtype=release --prefix=/opt/W64-cross-compile/ --cross-file ../../cross-file.ini + mseon compile + meson install + +Because not all compiled `*.dll` files are installed into the destination we need to copy them manualy. + + cp `find -name "*.dll"` /opt/W64-cross-compile/lib/ + +# atk + +Compile the library using the following steps. + + mkdir build + cd build + PKG_CONFIG_PATH=/opt/W64-cross-compile/lib/pkgconfig meson --buildtype=release --prefix=/opt/W64-cross-compile/ --cross-file ../../cross-file.ini + mseon compile + meson install + +Copy manualy all compiled `*.dll` files to the destination + + cp `find -name "*.dll"` /opt/W64-cross-compile/lib/ + +# pango + +Compile the library using the following steps. + + mkdir build + cd build + PKG_CONFIG_PATH=/opt/W64-cross-compile/lib/pkgconfig meson --buildtype=release --prefix=/opt/W64-cross-compile/ --cross-file ../../cross-file.ini + mseon compile + meson install + cp `find -name "*.dll"` /opt/W64-cross-compile/lib/ + +# gdk-pixbuf + + mkdir build + cd build + PKG_CONFIG_PATH=/opt/W64-cross-compile/lib/pkgconfig meson --buildtype=release --prefix=/opt/W64-cross-compile/ --cross-file ../../cross-file.ini + mseon compile + meson install + cp `find -name "*.dll"` /opt/W64-cross-compile/lib/ + +# libepoxy + + +Compile the library using the following steps. + + mkdir build + cd build + PKG_CONFIG_PATH=/opt/W64-cross-compile/lib/pkgconfig meson --buildtype=release --prefix=/opt/W64-cross-compile/ --cross-file ../../cross-file.ini + mseon compile + meson install + cp `find -name "*.dll"` /opt/W64-cross-compile/lib/ + + +# GTK + +## preparation beacuse of `wine` + +Copy all compiled executeble and library files into the wine windows/system folder. + + cp /opt/W64-cross-compile/bin/*.exe ~/.wine/drive_c/windows/system32/ + cp /opt/W64-cross-compile/lib/*.dll ~/.wine/drive_c/windows/system32/ + +## workaround 1 for some issues + +edit the file `gdk/win32/gdkprivate-win32.h` and search around line 300 for the following declaration. The compiler is missing the **extern** statement here. + 300 /* The singleton selection object pointer */ + 301 extern GdkWin32Selection *_win32_selection; + +## compile first attempt + +Configure and compile the library. + + PKG_CONFIG_PATH=/opt/W64-cross-compile/lib/pkgconfig ./configure --prefix=/opt/W64-cross-compile/ --host=x86_64-w64-mingw32 + PKG_CONFIG_PATH=/opt/W64-cross-compile/lib/pkgconfig make + make install + +## fix and install the compilation + + /bin/bash: Zeile 1: ../../gtk/gtk-update-icon-cache.exe: Kann die Binärdatei nicht ausführen: Fehler im Format der Programmdatei + make[3]: *** [Makefile:1673: install-update-icon-cache] Fehler 126 + +Edit the Makefile in demos/gtk-demos and add in line the wine prefix. Try to run the `make install`command and do the same for the next errors. + + /bin/bash: Zeile 1: ../../gtk/gtk-update-icon-cache.exe: Kann die Binärdatei nicht ausführen: Fehler im Format der Programmdatei + make[5]: *** [Makefile:1184: install-update-icon-cache] Fehler 126 + make[5]: Verzeichnis „/home/steffen/gtkcrosscompile/gtk+-3.24.0/demos/widget-factory“ wird verlassen + +If the compilation did well copy all *.dll files into the destination. + + cp `find -name "*.dll"` /opt/W64-cross-compile/lib/ +