Hello,
Interesting. I'm also using cross-compiled GTK+ 3 and other libraries
for my applications. I use the libraries/etc from the mingw32/64 project
in OpenSUSE Build Service. I'm using GTK+ 3.6.1 though (which OBS
currently have), I'm too busy to compile GTK+ 3.8.0 myself.
I use it to build and create NSIS installers for a payroll application,
GPInstruct, gWaei and Anjuta.
On Wednesday, 10 April, 2013 06:50 PM, tarn...@tarnyko.net wrote:
OK folks.
As the initial contributor of the win32 buildenv, here are my reasons
for preferring a native build instead of cross-compiling from Linux.
Sorry if it is long, but I think explaining things will help.
First, please note that we don't have to buy a Windows license. There
is a *free* (as in free beer) edition of Windows named "Hyper-V
Server". It's stripped-down in terms of GUI, but works well for this
purpose.
Here is a link to licensing stuff :
http://social.technet.microsoft.com/Forums/en-US/winserverhyperv/thread/db3f
c7d7-1772-41fb-b878-4574b3c39703/
and a screenshot of it running "gtk3-demo" while buildenv is compiling
GLib :
http://www.tarnyko.net/repo/hyperv_gtk3.png
I don't know that there's a free version of Windows :D.
Short version : cross-compiling GTK+3 is a headaches generator. It's
not easy nor efficient, and hard to maintain.
I agree, it is hard to maintain. Though I still prefer
cross-compilation, since it's faster in compiling. I sometimes fell
asleep while compiling in MinGW in native Windows.
Long version with individual points for techs :
- MinGW/GCC for Windows is a standalone compiling environment :
basically, you just drop all files in a directory, and it will work,
regardless of the OS version you are using. That's because most of the
base utils and libraries are compiled statically.
Is it really compiled statically? I don't see any difference when I
moved from native MinGW to OBS. Some packages are static, most are not.
Or atleast the old GTK+ 2 builds in www.gtk.org have most of libraries
compiled dynamically.
MinGW under Linux is mostly installed via a package manager ("yum
install mingw32-gcc-c++" on Fedora e.g.). You don't get to choose
which version of the compiler you install. Same thing for the
dependencies (libtool, expat, perl, python...). These versions are
likely to change regarding the distro your are using, and you cannot
copy their files from one computer to another because binaries are
compiled dynamically (= depend on this particular box' libc a.s.o).
Cross-compiled GTK+ and other libraries use msvcrt, so usually the
difference in compiler versions is not a problem except for libstdc++.
I'm using Ubuntu, and use the builds for 32-bit and 64-bit Windows that
are built using OpenSUSE 12.3. I mix my libraries and programs compiled
using GCC 4.6.3 with the ones from OBS that use GCC 4.8.0. Seems to work
fine (I've been using them for two years now, I think), except that you
should make sure that you use the libstdc++ that comes with your
compiler (though it is used by g++, not gcc, and there are no GTK+
dependency that use g++, I believe; I only got this problem last week
when I started porting Anjuta since its C++ parser uses g++).
The problem might be python though, the cross-compiled Python that OBS
uses are quite old (2.6). I don't use python so I'm not sure how big the
impact would be, but you could compile the base GTK+ stack without python.
That means you depend on a precise distro version.
I recently moved from the builds for OpenSUSE 12.1 to 12.3 (and did that
before many times before), upgraded my system many times too (since
Ubuntu Oneiric I think), and been using it for about 2 years, so I don't
think it is a problem. And I still use the packages I compiled myself
before along with the newer set of libraries, seems like there are no
problems.
Plus, my tests have proven that it matters while building. There are
some fixes for libtool and the compiler itself in the buildenv (see
the 64-bit one) ; if you use a different version, it will sometimes
break the build.
A solution would be to have a standalone MinGW install for Linux. I've
googled for one without success. If one doesn't exist, the ultimate
solution whould be to create one by recompiling MinGW statically
myself, that means recompiling the compiler : I don't know anything
about that, it will take lots of time.
Ubuntu, Fedora and OpenSUSE have the cross-compilers in their repos. OBS
uses MinGW-w64 GCC 4.8 while I use MinGW-w64 GCC 4.6.3 in Ubuntu. I use
their builds alongside each other. A year before I even combine MinGW-32
and MinGW-w64 builds, though I thought that might be a bad idea, and
Ubuntu has MinGW-w64 cross-compilers anyway. If you want to build
MinGW-w64, you could check OBS which have the most recent GCC
cross-compilers.
- GTK+3 build process sometimes needs to run the binaries it has just
generated.
For instance, it runs "glib-compile-schemas" on its XML files to
create the "schemas.compiled" catalog. Without it, GTK+ programs won't
run.
You cannot obviously run Win binaries under Linux -and using wine is
not an option here. The only way is to generate, at the same time, the
Linux version of the same binary ; that is to say, generate the stack
*twice*. One time you obtain "glib-compile-schemas" for Linux, put it
safe somewhere, then later during the Windows build you tell it to use
*this* particular binary at this particular point. Ugly patches. Or
you let the end-user do this, which is not user-friendly.
OBS uses the native tools that come with the build system while
cross-compiling the packages. Package mingw32-glib2, while being built
by OBS, uses the tools from the glib2* packages (which the build system
will already have by default). This way gschemas.compiled is only needed
before running applications, since the build system will use its native
tools.
- You won't be able to test and Q/A the binaries you just produced.
Wine cannot be used because it's not reliable with GTK+3 ; last time I
tried under Debian, fonts were disproportional and pictures sometimes
stripped. You have to run them on a native Windows OS.
I think I have covered the most important points ; opinions and
arguments are welcome. I'm sometimes available on IRC channel for
discussions, too.
I use GTK+ 3 in Wine. Just install gnome-themes-standard (actually,
compile first since it is not in OBS), then set Adwaita as theme. The
default theme sucks in Wine (and sometimes in Windows too, so I use
Adwaita in my installers).
The problem with the pictures is probably related to the loading of
gdk-pixbuf loaders. Probably the loaders cache is not created yet.
The reason why I like the builds from OBS is that they are already
separated and most libraries are already available. I just pick which do
I want to install. The only libraries and programs that I need to
compile myself are gdl, glade, gnome-themes-standard, gtksourceview,
libgda and libgee (gdl, glade and gtksourceview are dependencies of
Anjuta; I use libgda and libgee for the payroll application that I built
that we use at the office where I work.). Then I just run a script that
calls a modified download-mingw-rpm.py, fixes the pkg-config path,
builds the schemas, reinstalls my compiled packages, fills the GTK+ 2 &
3 settings and copies the libstdc++ of my compiler, then I could build
and test my programs.
Sorry for a very long response. I'm not even sure if I was able to
explain things properly.
Regards,
Arnel
_______________________________________________
gtk-devel-list mailing list
gtk-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-devel-list