|
|
# 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: (maybe wine is not anymore needed, haven't tested yet)
|
|
|
- wine
|
|
|
- wine64
|
|
|
- mingw-w64
|
|
|
- mingw-w64-tools
|
|
|
- binutils-mingw-w64
|
|
|
|
|
|
The following sources are needed:
|
|
|
- [glib](https://gitlab.gnome.org/GNOME/glib)
|
|
|
- [atk](https://gitlab.gnome.org/GNOME/atk)
|
|
|
- [pango](https://gitlab.gnome.org/GNOME/pango)
|
|
|
- [gdk-pixbuf](https://gitlab.gnome.org/GNOME/gdk-pixbuf)
|
|
|
- [libepoxy](https://github.com/anholt/libepoxy)
|
|
|
- [GTK+](https://www.gtk.org/)
|
|
|
|
|
|
## Prepare the `cross-file.ini`
|
|
|
|
|
|
This configuration file will be needed on all meson based builds.
|
|
|
|
|
|
[host_machine]
|
|
|
system = 'windows'
|
|
|
cpu_family = 'x86_64'
|
|
|
cpu = 'x86_64'
|
|
|
endian = 'little'
|
|
|
|
|
|
[built-in options]
|
|
|
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 = 'wine'
|
|
|
|
|
|
|
|
|
## lib-glib
|
|
|
|
|
|
Compile the library using the following steps.
|
|
|
|
|
|
mkdir build
|
|
|
cd build
|
|
|
meson setup --buildtype=release --prefix=/opt/W64-cross-compile/ --cross-file ../../cross-file.ini
|
|
|
meson compile
|
|
|
|
|
|
if an error like `glib/glibconfig.h:65:51: error: missing binary operator before token "("` occures edit the line and delete the **G_GNUC_EXTENSION** expression.
|
|
|
|
|
|
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
|
|
|
|
|
|
The flags -Dintrospection=false will tell meson to disable some building options. See the file `meson_options.txt` for some information. Compile the library using the following steps.
|
|
|
|
|
|
mkdir build
|
|
|
cd build
|
|
|
PKG_CONFIG_PATH=/opt/W64-cross-compile/lib/pkgconfig meson setup --buildtype=release -Dintrospection=false -Ddocs=false --prefix=/opt/W64-cross-compile/ --cross-file ../../cross-file.ini
|
|
|
meson 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. This will also download and compile some more librarys like `libpng` and `cairo` librarys.
|
|
|
|
|
|
mkdir build
|
|
|
cd build
|
|
|
PKG_CONFIG_PATH=/opt/W64-cross-compile/lib/pkgconfig meson setup --buildtype=release --prefix=/opt/W64-cross-compile/ --cross-file ../../cross-file.ini
|
|
|
|
|
|
For some reason the **harfbuzz** library wants to compile with the **HAVE_FT_GET_TRANSFORM** definition set. While this function is not defined in the sources at all. The workaround is to comment out the following line in `build/subprojects/harfbuzz/config.h` file.
|
|
|
|
|
|
// #define HAVE_FT_GET_TRANSFORM 1
|
|
|
|
|
|
Add `#include <cairo-dwrite.h> in file `../pango/pangocairo-dwrite-font.cpp` and start the compilation.
|
|
|
|
|
|
PKG_CONFIG_PATH=/opt/W64-cross-compile/lib/pkgconfig meson compile
|
|
|
|
|
|
In case of an error with unresolved symbols like undefined reference to '__strcat_chk'. You need to edit the `cross-file.ini` and add the linker flags/option `-lssp` to the `c_link_args` parameters. Remove the build directory and restart configuring and compiling this libraray again.
|
|
|
|
|
|
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 setup --buildtype=release --prefix=/opt/W64-cross-compile/ --cross-file ../../cross-file.ini
|
|
|
meson compile
|
|
|
meson install
|
|
|
cp `find -name "*.dll"` /opt/W64-cross-compile/lib/
|
|
|
|
|
|
## libepoxy
|
|
|
|
|
|
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
|
|
|
meson compile
|
|
|
meson install
|
|
|
cp `find -name "*.dll"` /opt/W64-cross-compile/lib/
|
|
|
|
|
|
|
|
|
## GTK+-4
|
|
|
|
|
|
### Configuration and Compilation of GTK
|
|
|
|
|
|
mkdir build
|
|
|
cd build
|
|
|
PKG_CONFIG_PATH=/opt/W64-cross-compile/lib/pkgconfig meson --buildtype=release --prefix=/opt/W64-cross-compile/ -Dmedia-gstreamer=disabled -Ddemos=false -Dbuild-examples=false -Dbuild-tests=false --cross-file ../../cross-file.ini
|
|
|
meson compile
|
|
|
|
|
|
If the compile process stops with error `../gdk/loaders/gdkjpeg.c:302:67: error: ‘free’ undeclared (first use in this function)` you need to add the line `#include <stdlib.h>`on top of the file, before the `#include <jpeglib.h>` line. Run the compile command again.
|
|
|
|
|
|
meson install
|
|
|
cp `find -name "*.dll"` /opt/W64-cross-compile/lib/
|
|
|
|
|
|
## GTK+-3
|
|
|
|
|
|
### 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/
|
|
|
cp /usr/x86_64-w64-mingw32/lib/zlib1.dll ~/.wine/drive_c/windows/system32/
|
|
|
|
|
|
|
|
|
### workaround for some issues
|
|
|
|
|
|
Edit the file `gdk/win32/gdkprivate-win32.h` and search around line 300 for the following declaration. In some releases 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
|
|
|
touch gdk/win32/winpointer.h
|
|
|
PKG_CONFIG_PATH=/opt/W64-cross-compile/lib/pkgconfig make
|
|
|
|
|
|
#### Compile Error: glib-compile-resources: file not found
|
|
|
|
|
|
make[2]: Verzeichnis „/home/steffen/test/GTKCross/gtk+-3.24.1/gdk“ wird betreten
|
|
|
/bin/bash: Zeile 1: /opt/W64-cross-compile/bin/glib-compile-resources: Datei oder Verzeichnis nicht gefunden
|
|
|
GEN gdkresources.h
|
|
|
/bin/bash: Zeile 1: /opt/W64-cross-compile/bin/glib-compile-resources: Datei oder Verzeichnis nicht gefunden
|
|
|
make[2]: *** [Makefile:2243: gdkresources.h] Fehler 127
|
|
|
|
|
|
Edit the file `gdk/Makefile` append the windows `.exe` extension at the place where `GLIB_COMPILE_RESOURCES` is defined.
|
|
|
Find **all the other** `GLIB_COMPILE_RESOURCES` occurences and add the `wine` command prior to **all** `$(GLIB_COMPILE_RESOURCES)` calls.
|
|
|
Try to compile.
|
|
|
|
|
|
### 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 where the `. 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/
|