gpredict icon indicating copy to clipboard operation
gpredict copied to clipboard

Building Gpredict 2.x for Windows

Open csete opened this issue 7 years ago • 10 comments

I am starting this new thread to track status and progress of windows builds, since the original pull request is now merged and closed.

Status as of writing:

  1. @phlash has updated the build files as well as some source files and can build a binary using mingw64 on Debian 9. He uses Gtk+/Glib binaries from Gnome project and these appear to be from 2012/2013. There is a test binary package on Phil's webiste for testing, but this has stability issues, which can be related to the age of the libraries. We need newer libraries.
  2. @gvanem has been building gpredict on windows using his own Makefile. This seems to support both MSYS2/MinGW and MSVC.
  3. I have installed MSYS2/MinGW64 on windows following the guidelines on the Gtk+ website. The default instructions set up a 64 bit development environment and I have managed to build a 64 bit binary package that runs stable and looks like the default Gnome 3 theme (see my comment below).

csete avatar Dec 29 '17 15:12 csete

I used the instruction on the Gtk+ website to setup MSYS2/MinGW. This has setup a more or less complete Unix environment and I could use the autotools method with a slightly modified configure.ac to build a binary.

The installation should also work using the updated Makefile as well as be able to build 32 bit binaries. I am going to try this next.


gpredict-win-main

gpredict-win-pref

csete avatar Dec 29 '17 15:12 csete

I continued with MSYS2/MinGW on windows and could install the 32 bit SDK along side the 64 bit SDK. I then copied the SDKs over to my Debian machine and could cross compile gpredict using the mingw-w64 cross compiler package.

So, using a standard MSYS2/MinGW installation we can build both 32 and 64 bit binaries on both windows and linux and using the latest Gtk+/Glib libraries.

I will now look into updating the runtime paths, icons, etc.

csete avatar Dec 30 '17 00:12 csete

Latest build, now using the new application icon (files no long available):

  • gpredict-win32-2.1.152.zip
  • gpredict-win64-2.1.152.zip

csete avatar Dec 30 '17 01:12 csete

Looks like MSYS2 is the way to go for up to date libraries, glad that sorted out the stability issue :)

Removing the experimental binary...

I spent a little while looking at how MSYS2 obtains it's libraries, with a view to avoiding the Windows installation + copy to Linux for a cross-build. It uses the Arch package manager pacman, with all the appropriate packages pulled from repo.msys2.org. This looks like it could work on an alien system such as Debian, sadly there is no port of pacman outside Arch or MSYS2 available for Debian-based distros. I will continue with building pacman from source to complete the experiment however.

phlash avatar Dec 30 '17 10:12 phlash

Experiment complete, it is possible to build pacman from source on Debian and use it to pull the appropriate MSYS2 i686/x86_64 dependencies for gpredict into local folders. I needed to re-compile the glib schemas (I suspect a native MSYS2 runs a post-fetch script for this):

cd /mingw32/share/glib-2.0/schemas/
/usr/lib/x86_64-linux-gnu/glib-2.0/glib-compile-schemas .

I also note that this approach appears to include a number of unnecessary libraries (eg: libpython2.7.so) that bloats the deployable ZIP by ~10M.

phlash avatar Dec 30 '17 14:12 phlash

I think I have now fixed all remaining issues with the windows binary. As far as I can tell everything is working now.

gpredict-win32-2.1.156.zip

I think this is sufficient for the 2.2 release and we can improve the readme and the makefile as we go.

csete avatar Jan 02 '18 22:01 csete

I've just tried building git master for windows on msys2 using both mingw32 and mingw64 (x86_64) toolchains.

In order to get it to build & run on both, I needed to make a few changed to the Makefiles which are attached.

Main changes are:

  • including the png and jpeg loaders (jpeg seems to be needed for png to work - not sure why)
  • including the icons/Adwaita/scalable directory in the distribution
  • it no longer seems necessary to manually adjust pkg-config paths
  • update compiler flags to support both 32-bit and 64-bit builds

win32_build_patch.txt

srcejon avatar Feb 13 '20 11:02 srcejon

I've been trying to build the latest master on an MSYS2 install for my windows machine. I've configured the config.mk file to properly point to my /mingw64 folder, and it seems to be finding all the dependencies properly, but the build is still failing.

The last few lines I get when running the makefile are:

/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x26e): undefined reference to `g_ascii_strtod'
/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x2f5): undefined reference to `g_ascii_strtod'
/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x324): undefined reference to `g_ascii_strtod'
/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x393): undefined reference to `g_ascii_strtod'
/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x402): undefined reference to `g_ascii_strtod'
/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x458): more undefined references to `g_ascii_strtod' follow
collect2: error: ld returned 1 exit status
make: *** [Makefile:227: libsgpsdp.dll] Error 1

Since I'm no pro C developer I can't just start digging into the files to figure out what's wrong. I'm guessing it's something simple in the toolchain that's just not configured right. However I followed all the instructions on the GTK windows setup page, and additionally had to keep installing various versions of the mingw gcc packages until I found the one that contained the correct i686-w64-mingw32-gcc command.

W3AXL avatar Jun 04 '21 21:06 W3AXL

I've been trying to build the latest master on an MSYS2 install for my windows machine. I've configured the config.mk file to properly point to my /mingw64 folder, and it seems to be finding all the dependencies properly, but the build is still failing.

The last few lines I get when running the makefile are:

/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x26e): undefined reference to `g_ascii_strtod'
/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x2f5): undefined reference to `g_ascii_strtod'
/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x324): undefined reference to `g_ascii_strtod'
/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x393): undefined reference to `g_ascii_strtod'
/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x402): undefined reference to `g_ascii_strtod'
/opt/lib/gcc/i686-w64-mingw32/10.2.0/../../../../i686-w64-mingw32/bin/ld: sgp_in.o:sgp_in.c:(.text+0x458): more undefined references to `g_ascii_strtod' follow
collect2: error: ld returned 1 exit status
make: *** [Makefile:227: libsgpsdp.dll] Error 1

Since I'm no pro C developer I can't just start digging into the files to figure out what's wrong. I'm guessing it's something simple in the toolchain that's just not configured right. However I followed all the instructions on the GTK windows setup page, and additionally had to keep installing various versions of the mingw gcc packages until I found the one that contained the correct i686-w64-mingw32-gcc command.

Same issue here, do you happen to remember which package it was?

Apace33 avatar Aug 18 '21 21:08 Apace33