csete / gpredict

Gpredict satellite tracking application
http://gpredict.oz9aec.net/
GNU General Public License v2.0
861 stars 252 forks source link

Building Gpredict 2.x for Windows #110

Open csete opened 6 years ago

csete commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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 commented 6 years ago

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

phlash commented 6 years ago

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 commented 6 years ago

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.

csete commented 6 years ago

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.

srcejon commented 4 years ago

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:

win32_build_patch.txt

W3AXL commented 3 years ago

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.

Apace33 commented 3 years ago

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?

curtiswilliams commented 2 months ago

Anyone got a working windows build that’s somewhat up to date with the Linux version?