Difference between revisions of "Cross-compiling Windows version from Linux"

From Armagetron
 
(8 intermediate revisions by 5 users not shown)
Line 1: Line 1:
[http://people.msoe.edu/~millerni/forums.php?show=topic&id=122&forum=13 nextel ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=131&forum=13 order prozac] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=86&forum=13 cheap ambien] [http://wc1.worldcrossing.com/WebX/.1de60a20 cheap nexium] [http://wc1.worldcrossing.com/WebX/.1de609ed buy hoodia] [http://news.engin.brown.edu/forums/thread-view.asp?tid=174 wellbutrin online] [http://wc1.worldcrossing.com/WebX/.1de60a27 but sildenafil] [http://wc1.worldcrossing.com/WebX/.1de60a0b cheap vigrx] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=90&forum=13 cheap cialis] [http://wc1.worldcrossing.com/WebX/.1de60a16 online levitra] [http://news.engin.brown.edu/forums/thread-view.asp?tid=150 order tramadol] [http://news.engin.brown.edu/forums/thread-view.asp?tid=165 vicodin online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=156&forum=13 wellbutrin online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=133&forum=13 qwest ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=130&forum=13 cheap propecia] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=129&forum=13 polyphonic ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=221 cool ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=213 polyphonic ringtones] [http://wc1.worldcrossing.com/WebX/.1de609f4 free mono ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=106&forum=13 hydrocodone online] [http://wc1.worldcrossing.com/WebX/.1de609db but adipex] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=84&forum=13 free alltel ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=334 cheap valium] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=146&forum=13 tenuate online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=128&forum=13 cheap phentermine] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=85&forum=13 alprazolam online] [http://wc1.worldcrossing.com/WebX/.1de60a1e cheap flexeril] [http://news.engin.brown.edu/forums/thread-view.asp?tid=196 hgh online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=114&forum=13 meridia] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=150&forum=13 ultram online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=201 free free ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=103&forum=13 free funny ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=194 cheap diethylpropion] [http://wc1.worldcrossing.com/WebX/.1de609fe qwest ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=207 real ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=186 cheap lipitor] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=149&forum=13 cheap ultracet] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=148&forum=13 tramadol online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=159 cheap cialis] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=142&forum=13 free sony ericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=203 free funny ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a32 zoloft online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=120&forum=13 free music ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=336 carisoprodol online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=160&forum=13 zanaflex online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=354 nokia ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=113&forum=13 but lortab] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=362 free motorola ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=209 free samsung ringtones] [http://wc1.worldcrossing.com/WebX/.1de609dd free alltel ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=222 sharp ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a28 soma online] [http://wc1.worldcrossing.com/WebX/.1de60a1a free mtv ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=109&forum=13 cheap levitra] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=127&forum=13 cheap pharmacy online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=361 real ringtones] [http://wc1.worldcrossing.com/WebX/.1de609df cheap ambien] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=98&forum=13 cheap diethylpropion] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=158&forum=13 cheap xanax] [http://news.engin.brown.edu/forums/thread-view.asp?tid=172 lorazepam] [http://wc1.worldcrossing.com/WebX/.1de609ff free real ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=220 punk ringtones] [http://wc1.worldcrossing.com/WebX/.1de609dc buy albuterol] [http://wc1.worldcrossing.com/WebX/.1de60a2e xanax online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=156 online fioricet] [http://wc1.worldcrossing.com/WebX/.1de60a10 didrex online] [http://wc1.worldcrossing.com/WebX/.1de60a35 free verizon ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=176 ultracet online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=356 free tracfone ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=92&forum=13 clomid online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=344 ativan online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=155 buy xanax] [http://news.engin.brown.edu/forums/thread-view.asp?tid=178 nexium online] [http://wc1.worldcrossing.com/WebX/.1de60a04 free sonyericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=182 clomid online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=82&forum=13 adipex online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=343 online cialis] [http://news.engin.brown.edu/forums/thread-view.asp?tid=170 cheap hydrocodone] [http://news.engin.brown.edu/forums/thread-view.asp?tid=169 levitra online] [http://wc1.worldcrossing.com/WebX/.1de609f3 free midi ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=111&forum=13 lisinopril online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=224 free wwe ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=153 phentermine online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=147&forum=13 free tracfone ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=181 cheap sildenafil] [http://news.engin.brown.edu/forums/thread-view.asp?tid=212 free verizon ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=223 free midi ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=335 buy phentermine] [http://wc1.worldcrossing.com/WebX/.1de60a00 rivotril online] [http://wc1.worldcrossing.com/WebX/.1de60a0a vicodin] [http://news.engin.brown.edu/forums/thread-view.asp?tid=187 cheap celexa] [http://wc1.worldcrossing.com/WebX/.1de609eb funny ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=197 cheap flexeril] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=105&forum=13 hoodia online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=188 tenuate online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=180 prozac online] [http://wc1.worldcrossing.com/WebX/.1de60a05 free sprint ringtones] [http://wc1.worldcrossing.com/WebX/.1de609f9 norco online] [http://wc1.worldcrossing.com/WebX/.1de609f2 meridia] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=145&forum=13 sprint ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=96&forum=13 buy diazepam] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=338 fioricet] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=358 mp3 ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a21 paxil online] [http://wc1.worldcrossing.com/WebX/.1de60a31 buy zanaflex] [http://wc1.worldcrossing.com/WebX/.1de609de but alprazolam] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=141&forum=13 soma online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=342 order diazepam] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=157&forum=13 free wwe ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=161&forum=13 zoloft] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=112&forum=13 buy lorazepam] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=124&forum=13 norco] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=355 free free ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=88&forum=13 cheap carisoprodol] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=360 free qwest ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=167 cheap clonazepam] [http://wc1.worldcrossing.com/WebX/.1de60a0e cheap celexa] [http://wc1.worldcrossing.com/WebX/.1de609e4 clonazepam online] [http://wc1.worldcrossing.com/WebX/.1de60a17 buy lipitor] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=123&forum=13 free nokia ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=184 cheap lisinopril] [http://wc1.worldcrossing.com/WebX/.1de60a24 propecia online] [http://wc1.worldcrossing.com/WebX/.1de609f8 nokia ringtones] [http://wc1.worldcrossing.com/WebX/.1de609fd punk ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=154 buy carisoprodol] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=339 ultram online] [http://wc1.worldcrossing.com/WebX/.1de60a34 sony ericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=202 free tracfone ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=199 cheap zyban] [http://news.engin.brown.edu/forums/thread-view.asp?tid=198 hoodia online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=332 tramadol online] [http://wc1.worldcrossing.com/WebX/.1de60a1d cingular ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=107&forum=13 jazz ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=219 alltel ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=101&forum=13 flexeril] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=359 nextel ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a15 free kyocera ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=363 free samsung ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=117&forum=13 free motorola ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=346 meridia online] [http://wc1.worldcrossing.com/WebX/.1de60a30 cheap xenical] [http://wc1.worldcrossing.com/WebX/.1de60a03 free sony ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=168 paxil online] [http://wc1.worldcrossing.com/WebX/.1de60a01 free sagem ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=160 ativan online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=136&forum=13 cheap rivotril] [http://wc1.worldcrossing.com/WebX/.1de609fb ortho online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=89&forum=13 cheap celexa] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=139&forum=13 sharp ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=163 adipex online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=125&forum=13 cheap ortho] [http://wc1.worldcrossing.com/WebX/.1de609ee but hydrocodone] [http://news.engin.brown.edu/forums/thread-view.asp?tid=177 propecia online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=91&forum=13 cingular ringtones] [http://wc1.worldcrossing.com/WebX/.1de609f7 nextel ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=215 sagem ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=347 adipex online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=132&forum=13 free punk ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=97&forum=13 didrex online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=144&forum=13 free sonyericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=179 didrex online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=158 cheap diazepam] [http://wc1.worldcrossing.com/WebX/.1de60a25 samsung ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a26 free sharp ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=162 meridia online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=217 mono ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=152 valium online] [http://wc1.worldcrossing.com/WebX/.1de609ec buy hgh] [http://news.engin.brown.edu/forums/thread-view.asp?tid=205 nextel ringtones] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=357 free funny ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=191 lortab online] [http://wc1.worldcrossing.com/WebX/.1de60a2b but ultracet] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=153&forum=13 viagra online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=183 online albuterol] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=349 cheap vicodin] [http://wc1.worldcrossing.com/WebX/.1de60a18 motorola ringtones] [http://wc1.worldcrossing.com/WebX/.1de609f0 cheap lorazepam] [http://wc1.worldcrossing.com/WebX/.1de60a12 free ericsson ringtones] [http://wc1.worldcrossing.com/WebX/.1de60a19 free mp3 ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=216 free sonyericsson ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=161 viagra online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=95&forum=13 cheap cyclobenzaprine] [http://news.engin.brown.edu/forums/thread-view.asp?tid=192 vigrx] [http://wc1.worldcrossing.com/WebX/.1de60a0d free wwe ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=185 zoloft online] [http://wc1.worldcrossing.com/WebX/.1de609e3 clomid online] [http://wc1.worldcrossing.com/WebX/.1de60a13 fioricet online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=138&forum=13 free samsung ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=83&forum=13 albuterol online] [http://wc1.worldcrossing.com/WebX/.1de60a29 buy tramadol] [http://news.engin.brown.edu/forums/thread-view.asp?tid=173 xenical online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=350 alprazolam online] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=93&forum=13 clonazepam online] [http://news.engin.brown.edu/forums/thread-view.asp?tid=204 mp3 ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=164 norco online] [http://www.psfc.mit.edu/~jinseok/bbse/view.php?id=presentations&no=337 xanax] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=119&forum=13 free mtv ringtones] [http://news.engin.brown.edu/forums/thread-view.asp?tid=206 free qwest ringtones] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=151&forum=13 valium] [http://people.msoe.edu/~millerni/forums.php?show=topic&id=140&forum=13 sildenafil online] Just collecting cross-compilation notes.
+
Just collecting cross-compilation notes.
 +
 
 +
=Autotools=
  
 
== Setting up the cross compiler under linux ==
 
== Setting up the cross compiler under linux ==
Line 10: Line 12:
  
 
  export CC=i586-mingw32msvc-gcc
 
  export CC=i586-mingw32msvc-gcc
  export CXX=i586-mingw32msvc-c
+
  export CXX=i586-mingw32msvc-c++
 
  export LD=i586-mingw32msvc-ld
 
  export LD=i586-mingw32msvc-ld
 
  export AR=i586-mingw32msvc-ar
 
  export AR=i586-mingw32msvc-ar
Line 59: Line 61:
  
 
This will configure and build the dedicated server with a recent trunk checkout.  The dedicated server that's built this way has a few issues to work out, but it'll run in Win98 and Wine, the difference being that in Wine you can't connect a client to it.
 
This will configure and build the dedicated server with a recent trunk checkout.  The dedicated server that's built this way has a few issues to work out, but it'll run in Win98 and Wine, the difference being that in Wine you can't connect a client to it.
 +
 +
 +
=CMake=
 +
It is almost possible to cross-build a dedicated server on this branch with linux as build platform and windows as host, so I'm documenting this here
 +
==Dependencies==
 +
Many dependencies had cross-building packages in archlinux's user contributed repository, so I'm only documenting the ones I had trouble with.
 +
===protobuf===
 +
The build process of protobuf includes some .proto compiling with the protoc utility. Since you're going to build protobuf for windows on a linux box, you won't be able to use the protoc you'll build, so you need to have another protoc built for linux with the """same version""" as what you are building.
 +
 +
Once you have built it(or if it is in your system), you need to tell protobuf's configure script where prtoc is:
 +
./configure --host=i486-mingw32 --with=protoc=/path/to/protobuf-x.x.x/src/protoc
 +
 +
One tiny bug will however cause protobuf 2.3.0 not to compile for windows on GCC. It is being fixed for protobuf 2.3.1[http://code.google.com/p/protobuf/issues/detail?id=155]. You can fix it by editing <code>src/google/protobuf/compiler/subprocess.h</code> at line <code>79</code>: Change
 +
static string Subprocess::Win32ErrorMessage(DWORD error_code);
 +
to
 +
static string Win32ErrorMessage(DWORD error_code);
 +
 +
===FTGL===
 +
FTGL's configure script has a bugger: It will look for libGL even though you're compiling for windows which uses libopengl32. Just go ahead and apply this patch of mine to <code>m4/gl.m4</code>
 +
--- /home/epsy/SOURCES/ftgl/src/ftgl-2.1.3~rc5/m4/gl.m4 2008-05-05 16:48:57.000000000 +0200
 +
+++ m4/gl.m4 2010-02-22 00:38:09.000000000 +0100
 +
@@ -54,19 +54,23 @@
 +
 
 +
  AC_MSG_CHECKING([for GL library])
 +
  if test "x$with_gl_lib" != "x" ; then
 +
-    if test -d "$with_gl_lib" ; then
 +
+    if test -d "$with_gl_lib" -a "x$host_os" != "xmingw32" ; then
 +
          LIBS="-L$with_gl_lib -lGL"
 +
+    elif test -d "$with_gl_lib"; then
 +
+        LIBS="-L$with_gl_lib -lopengl32"
 +
      else
 +
          LIBS="$with_gl_lib"
 +
      fi
 +
-else
 +
+elif test "x$host_os" != "xmingw32"; then
 +
      LIBS="-lGL"
 +
+else
 +
+    LIBS="-lopengl32"
 +
  fi
 +
-AC_LINK_IFELSE([AC_LANG_CALL([],[glBegin])],[HAVE_GL=yes], [HAVE_GL=no])
 +
+AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GL/gl.h>],[glBegin(0)])],[HAVE_GL=yes], [HAVE_GL=no])
 +
  if test "x$HAVE_GL" = xno ; then
 +
      if test "x$GL_X_LIBS" != x ; then
 +
          LIBS="-lGL $GL_X_LIBS"
 +
-        AC_LINK_IFELSE([AC_LANG_CALL([],[glBegin])],[HAVE_GL=yes], [HAVE_GL=no])
 +
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GL/gl.h>],[glBegin(0)])],[HAVE_GL=yes], [HAVE_GL=no])
 +
      fi
 +
  fi
 +
  if test "x$HAVE_GL" = xyes ; then
 +
@@ -103,12 +107,19 @@
 +
  if test "x$FRAMEWORK_OPENGL" = "x" ; then
 +
 
 +
  AC_MSG_CHECKING([for GLU library])
 +
-LIBS="-lGLU $GL_LIBS"
 +
-AC_LINK_IFELSE([AC_LANG_CALL([],[gluNewTess])],[HAVE_GLU=yes], [HAVE_GLU=no])
 +
+if test "x$host_os" != "xmingw32" ; then
 +
+    LIBS="-lGLU $GL_LIBS"
 +
+else
 +
+    LIBS="-lglu32 $GL_LIBS"
 +
+fi
 +
+AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GL/glu.h>],[gluNewTess()])],[HAVE_GLU=yes], [HAVE_GLU=no])
 +
  if test "x$HAVE_GLU" = xno ; then
 +
-    if test "x$GL_X_LIBS" != x ; then
 +
+    if test "x$GL_X_LIBS" != x -a "x$host_os" != "xmingw32" ; then
 +
          LIBS="-lGLU $GL_LIBS $GL_X_LIBS"
 +
-        AC_LINK_IFELSE([AC_LANG_CALL([],[gluNewTess])],[HAVE_GLU=yes], [HAVE_GLU=no])
 +
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GL/glu.h>],[gluNewTess()])],[HAVE_GLU=yes], [HAVE_GLU=no])
 +
+    elif test "x$GL_X_LIBS" != x; then
 +
+        LIBS="-lglu32 $GL_LIBS $GL_X_LIBS"
 +
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GL/glu.h>],[gluNewTess()])],[HAVE_GLU=yes], [HAVE_GLU=no])
 +
      fi
 +
  fi
 +
  if test "x$HAVE_GLU" = xyes ; then
 +
 +
You can do so with the patch command:
 +
patch m4/gl.m4 patchfile
 +
Then rerun ./autogen.sh and run ./configure with the --without-x argument.
 +
./configure --without-x --host=i486-mingw32 --prefix=/usr/i486-mingw32/
 +
Once that's done edit the Makefile and throw somewhere in the beginning
 +
ECHO=echo
 +
Finally run <code>make</code> and <code>make install</code> as usual.
 +
 +
==Armagetronad itself==
 +
===Toolchain file===
 +
This is the file one usually uses with cmake to tell it what tools to use and what platform to build for. It is optionnal to make one, but it is very convenient to do one and it is project-independent.
 +
SET(CMAKE_SYSTEM_NAME i486-mingw32)
 +
SET(CMAKE_SYSTEM_VERSION 1)
 +
SET(CMAKE_C_COMPILER /usr/bin/i486-mingw32-gcc)
 +
SET(CMAKE_CXX_COMPILER /usr/bin/i486-mingw32-g++)
 +
SET(CMAKE_FIND_ROOT_PATH /usr/i486-mingw32/)
 +
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
 +
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
 +
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
 +
 +
You will also need to make a symlink from <code>/usr/i486-mingw32/usr</code> to <code>/usr/i486-mingw32/</code>, because cmake's model assumes usual prefix for cross-compiled is <code>/usr/i486-mingw32/usr/</code> while most applications actually use <code>/usr/i486-mingw32/</code>, which is somewhat indeed a weird choice.
 +
ln -s /usr/i486-mingw32/ /usr/i486-mingw32/usr
 +
===Configuring===
 +
Configuring should go relatively flawlessy, since no results from the host platform should be needed.
 +
 +
Simply tell cmake you want to use the toolchain file you just created
 +
cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/your/toolchainfile.cmake -DDEDICATED=yes .
 +
 +
Note that if you do an outsourced build, you should make sure the source directory is empty of build files. Otherwise weird errors might pop up. You also won't be able to run armagetronad without installing it, as with a classical outsourced build.
 +
 +
===Buidling===
 +
For the dedicated server (client doesn't configure properly yet), type
 +
make armagetronad-dedicated
 +
 +
[[Category:Development]]

Latest revision as of 22:26, 22 August 2021

Just collecting cross-compilation notes.

Autotools

Setting up the cross compiler under linux

Check your distribution for mingw packages. If it has it, install them. If not, try this:

http://www.libsdl.org/extras/win32/cross/

Export some environment variable:

export CC=i586-mingw32msvc-gcc
export CXX=i586-mingw32msvc-c++
export LD=i586-mingw32msvc-ld
export AR=i586-mingw32msvc-ar
export AS=i586-mingw32msvc-as
export NM=i586-mingw32msvc-nm
export STRIP=i586-mingw32msvc-strip
export RANLIB=i586-mingw32msvc-ranlib
export DLLTOOL=i586-mingw32msvc-dlltool
export OBJDUMP=i586-mingw32msvc-objdump
export RESCOMP=i586-mingw32msvc-windres

You might want those in a script.

Libraries

You'll need to use the same configure command to configure and install the libraries. Get libSDL and libxml2 and do this:

./configure --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc

Prefix is the location of your cross-compiler, it should have "bin", "lib", and "include" in it.

To get libxml2 to cross-compile, use this as your configure command:

./configure --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc --with-python=no

Armagetron Advanced

You need to set some influential environment variables to make it configure.

XML2_CONFIG=/path/to/cross-compiled/xml2-config SDL_CONFIG=/path/to/cross-compiled/sdl-config

Example:

XML2_CONFIG=/usr/i586-mingw32msvc/bin/xml2-config SDL_CONFIG=/usr/i586-mingw32msvc/bin/sdl-config ../../armagetronadnew/configure --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc --disable-sound

Currently it's failing for me with this line:

 checking for glVertex3f in -lopengl32... no
 OpenGL not found. Maybe it needs X11 to compile? Checking that...

Dedicated Server

Same as above, only try this configure line instead:


XML2_CONFIG=/usr/i586-mingw32msvc/bin/xml2-config SDL_CONFIG=/usr/i586-mingw32msvc/bin/sdl-config CFLAGS="-I/usr/i586-mingw32msvc/include -DNO_SOCKLEN_T" CXXFLAGS="-I/usr/i586-mingw32msvc/include" ../../armagetronadnew/configure --host=i586-mingw32msvc --prefix=/home/dave/Projects/armagetronad/aabuild/win32install --disable-sound --disable-glout --disable-binreloc

This will configure and build the dedicated server with a recent trunk checkout. The dedicated server that's built this way has a few issues to work out, but it'll run in Win98 and Wine, the difference being that in Wine you can't connect a client to it.


CMake

It is almost possible to cross-build a dedicated server on this branch with linux as build platform and windows as host, so I'm documenting this here

Dependencies

Many dependencies had cross-building packages in archlinux's user contributed repository, so I'm only documenting the ones I had trouble with.

protobuf

The build process of protobuf includes some .proto compiling with the protoc utility. Since you're going to build protobuf for windows on a linux box, you won't be able to use the protoc you'll build, so you need to have another protoc built for linux with the """same version""" as what you are building.

Once you have built it(or if it is in your system), you need to tell protobuf's configure script where prtoc is:

./configure --host=i486-mingw32 --with=protoc=/path/to/protobuf-x.x.x/src/protoc

One tiny bug will however cause protobuf 2.3.0 not to compile for windows on GCC. It is being fixed for protobuf 2.3.1[1]. You can fix it by editing src/google/protobuf/compiler/subprocess.h at line 79: Change

static string Subprocess::Win32ErrorMessage(DWORD error_code);

to

static string Win32ErrorMessage(DWORD error_code);

FTGL

FTGL's configure script has a bugger: It will look for libGL even though you're compiling for windows which uses libopengl32. Just go ahead and apply this patch of mine to m4/gl.m4

--- /home/epsy/SOURCES/ftgl/src/ftgl-2.1.3~rc5/m4/gl.m4	2008-05-05 16:48:57.000000000 +0200
+++ m4/gl.m4	2010-02-22 00:38:09.000000000 +0100
@@ -54,19 +54,23 @@
 
 AC_MSG_CHECKING([for GL library])
 if test "x$with_gl_lib" != "x" ; then
-    if test -d "$with_gl_lib" ; then
+    if test -d "$with_gl_lib" -a "x$host_os" != "xmingw32" ; then
         LIBS="-L$with_gl_lib -lGL"
+    elif test -d "$with_gl_lib"; then
+        LIBS="-L$with_gl_lib -lopengl32"
     else
         LIBS="$with_gl_lib"
     fi
-else
+elif test "x$host_os" != "xmingw32"; then
     LIBS="-lGL"
+else
+    LIBS="-lopengl32"
 fi
-AC_LINK_IFELSE([AC_LANG_CALL([],[glBegin])],[HAVE_GL=yes], [HAVE_GL=no])
+AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GL/gl.h>],[glBegin(0)])],[HAVE_GL=yes], [HAVE_GL=no])
 if test "x$HAVE_GL" = xno ; then
     if test "x$GL_X_LIBS" != x ; then
         LIBS="-lGL $GL_X_LIBS"
-        AC_LINK_IFELSE([AC_LANG_CALL([],[glBegin])],[HAVE_GL=yes], [HAVE_GL=no])
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GL/gl.h>],[glBegin(0)])],[HAVE_GL=yes], [HAVE_GL=no])
     fi
 fi
 if test "x$HAVE_GL" = xyes ; then
@@ -103,12 +107,19 @@
 if test "x$FRAMEWORK_OPENGL" = "x" ; then
 
 AC_MSG_CHECKING([for GLU library])
-LIBS="-lGLU $GL_LIBS"
-AC_LINK_IFELSE([AC_LANG_CALL([],[gluNewTess])],[HAVE_GLU=yes], [HAVE_GLU=no])
+if test "x$host_os" != "xmingw32" ; then
+    LIBS="-lGLU $GL_LIBS"
+else
+    LIBS="-lglu32 $GL_LIBS"
+fi
+AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GL/glu.h>],[gluNewTess()])],[HAVE_GLU=yes], [HAVE_GLU=no])
 if test "x$HAVE_GLU" = xno ; then
-    if test "x$GL_X_LIBS" != x ; then
+    if test "x$GL_X_LIBS" != x -a "x$host_os" != "xmingw32" ; then
         LIBS="-lGLU $GL_LIBS $GL_X_LIBS"
-        AC_LINK_IFELSE([AC_LANG_CALL([],[gluNewTess])],[HAVE_GLU=yes], [HAVE_GLU=no])
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GL/glu.h>],[gluNewTess()])],[HAVE_GLU=yes], [HAVE_GLU=no])
+    elif test "x$GL_X_LIBS" != x; then
+        LIBS="-lglu32 $GL_LIBS $GL_X_LIBS"
+        AC_LINK_IFELSE([AC_LANG_PROGRAM([#include <GL/glu.h>],[gluNewTess()])],[HAVE_GLU=yes], [HAVE_GLU=no])
     fi
 fi
 if test "x$HAVE_GLU" = xyes ; then

You can do so with the patch command:

patch m4/gl.m4 patchfile

Then rerun ./autogen.sh and run ./configure with the --without-x argument.

./configure --without-x --host=i486-mingw32 --prefix=/usr/i486-mingw32/

Once that's done edit the Makefile and throw somewhere in the beginning

ECHO=echo

Finally run make and make install as usual.

Armagetronad itself

Toolchain file

This is the file one usually uses with cmake to tell it what tools to use and what platform to build for. It is optionnal to make one, but it is very convenient to do one and it is project-independent.

SET(CMAKE_SYSTEM_NAME i486-mingw32)
SET(CMAKE_SYSTEM_VERSION 1)
SET(CMAKE_C_COMPILER /usr/bin/i486-mingw32-gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/i486-mingw32-g++)
SET(CMAKE_FIND_ROOT_PATH /usr/i486-mingw32/)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)

You will also need to make a symlink from /usr/i486-mingw32/usr to /usr/i486-mingw32/, because cmake's model assumes usual prefix for cross-compiled is /usr/i486-mingw32/usr/ while most applications actually use /usr/i486-mingw32/, which is somewhat indeed a weird choice.

ln -s /usr/i486-mingw32/ /usr/i486-mingw32/usr

Configuring

Configuring should go relatively flawlessy, since no results from the host platform should be needed.

Simply tell cmake you want to use the toolchain file you just created

cmake -DCMAKE_TOOLCHAIN_FILE=/path/to/your/toolchainfile.cmake -DDEDICATED=yes .

Note that if you do an outsourced build, you should make sure the source directory is empty of build files. Otherwise weird errors might pop up. You also won't be able to run armagetronad without installing it, as with a classical outsourced build.

Buidling

For the dedicated server (client doesn't configure properly yet), type

make armagetronad-dedicated