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

From Armagetron
 
(14 intermediate revisions by 8 users not shown)
Line 1: Line 1:
[http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=50 ativan online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=290 free samsung ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,50 tramadol online] [http://climate.msrc.sunysb.edu/1984/messages/303.html buy didrex] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=14 cheap clomid] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=263 lorazepam online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,42 free samsung ringtones] [http://climate.msrc.sunysb.edu/1984/messages/289.html cheap albuterol] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=81 cheap zyban] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=293 soma online] [http://climate.msrc.sunysb.edu/1984/messages/299.html cheap clonazepam] [http://climate.msrc.sunysb.edu/1984/messages/331.html cheap paxil] [http://www.bc.edu/apps/bookstore/cards/jun7-226532801730.html real ringtones] [http://climate.msrc.sunysb.edu/1984/messages/344.html sildenafil online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,45 soma online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=9 ambien] [http://climate.msrc.sunysb.edu/1984/messages/361.html cheap wellbutrin] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=5 cheap adipex] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=282 propecia online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=286 free real ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=249 diethylpropion online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=50 free polyphonic ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=56 cheap rivotril] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=258 jazz ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=261 but lipitor] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=34 cheap lorazepam] [http://climate.msrc.sunysb.edu/1984/messages/336.html prozac online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=239 carisoprodol online] [http://climate.msrc.sunysb.edu/1984/messages/334.html polyphonic ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=70 tenuate] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=43 cheap valium] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=281 free polyphonic ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=32 buy lipitor] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=24 free ringtones] [http://climate.msrc.sunysb.edu/1984/messages/333.html phentermine online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=57 sagem ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=75 free free ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=302 buy ultracet] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=276 buy ortho] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=308 buy vigrx] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,33 nexium online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,28 meridia online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=291 sharp ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=42 music ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,20 diazepam online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=11 carisoprodol online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=75 but wellbutrin] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=36 order meridia] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,23 free ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,57 xanax online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=270 mtv ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=251 order fioricet] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=269 mp3 ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=273 nextel ringtones] [http://climate.msrc.sunysb.edu/1984/messages/288.html adipex online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=311 xanax online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,41 sagem ringtones] [http://climate.msrc.sunysb.edu/1984/messages/302.html cheap diazepam] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=244 clonazepam online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,39 polyphonic ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=45 carisoprodol online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=309 buy wellbutrin] [http://climate.msrc.sunysb.edu/1984/messages/313.html free kyocera ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-225502801748.html cheap ativan] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=73 cheap viagra] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,27 buy lorazepam] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=48 cheap ultram] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=30 kyocera ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,10 cheap alprazolam] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=234 free alltel ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=57 ambien online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=74 cheap vicodin] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,30 motorola ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=62 free sony ericsson ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=53 punk ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=51 buy viagra] [http://www.bc.edu/apps/bookstore/cards/jun7-224422412742.html phentermine] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=46 cheap xanax] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=70 buy ultram] [http://www.bc.edu/apps/bookstore/cards/jun7-224362564176.html cheap valium] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,17 cingular ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,8 buy adipex] [http://climate.msrc.sunysb.edu/1984/messages/301.html order cyclobenzaprine] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=51 propecia online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=298 tenuate online] [http://www.bc.edu/apps/bookstore/cards/jun7-224512777320.html cheap carisoprodol] [http://climate.msrc.sunysb.edu/1984/messages/353.html ultracet online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=72 cheap pharmacy online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=76 free wwe ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=18 cheap diazepam] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=312 cheap xenical] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=45 nokia ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=285 free qwest ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=79 zanaflex online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=247 diazepam online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=305 free verizon ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-226682379944.html free motorola ringtones] [http://climate.msrc.sunysb.edu/1984/messages/318.html lortab online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=62 prozac online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=21 ericsson ringtones] [http://climate.msrc.sunysb.edu/1984/messages/330.html but ortho] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,19 cyclobenzaprine online] [http://climate.msrc.sunysb.edu/1984/messages/295.html celexa online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=253 free free ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=49 phentermine online] [http://climate.msrc.sunysb.edu/1984/messages/300.html cool ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=52 prozac online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,44 qwest ringtones] [http://climate.msrc.sunysb.edu/1984/messages/296.html cialis online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=297 sprint ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=60 cheap nexium] [http://climate.msrc.sunysb.edu/1984/messages/339.html real ringtones] [http://climate.msrc.sunysb.edu/1984/messages/341.html free sagem ringtones] [http://climate.msrc.sunysb.edu/1984/messages/351.html tracfone ringtones] [http://climate.msrc.sunysb.edu/1984/messages/328.html free nokia ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=284 free punk ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-226172687200.html mp3 ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=295 sony ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,12 ativan online] [http://climate.msrc.sunysb.edu/1984/messages/309.html hgh] [http://climate.msrc.sunysb.edu/1984/messages/320.html free midi ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=7 free alltel ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=23 cheap flexeril] [http://climate.msrc.sunysb.edu/1984/messages/346.html free sony ericsson ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=39 free motorola ringtones] [http://climate.msrc.sunysb.edu/1984/messages/359.html vicodin online] [http://www.bc.edu/apps/bookstore/cards/jun7-226062830562.html tracfone ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=42 buy soma] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=260 levitra online] [http://climate.msrc.sunysb.edu/1984/messages/322.html motorola ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=19 didrex online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=84 sildenafil online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=48 pharmacy online online] [http://climate.msrc.sunysb.edu/1984/messages/366.html zoloft online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=257 order hydrocodone] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=63 free sony ringtones] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=82 cingular ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=306 viagra online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=47 buy paxil] [http://climate.msrc.sunysb.edu/1984/messages/292.html ambien online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=264 lortab online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=28 hydrocodone online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=85 vigrx online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=10 ativan online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=26 hgh online] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=63 cheap sildenafil] [http://climate.msrc.sunysb.edu/1984/messages/358.html buy viagra] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=71 ortho online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=44 free nextel ringtones] [http://climate.msrc.sunysb.edu/1984/messages/316.html lisinopril] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,24 free funny ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,46 free sony ericsson ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=307 vicodin online] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,25 but hydrocodone] [http://climate.msrc.sunysb.edu/1984/messages/293.html cheap ativan] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=38 mono ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,18 clonazepam online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=31 levitra] [http://climate.msrc.sunysb.edu/1984/messages/349.html sprint ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=49 cheap cialis] [http://climate.msrc.sunysb.edu/1984/messages/347.html free sony ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,26 levitra online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=313 cheap zanaflex] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=44 phentermine] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=12 celexa online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=69 ultracet online] [http://climate.msrc.sunysb.edu/1984/messages/362.html free wwe ringtones] [http://climate.msrc.sunysb.edu/1984/messages/343.html free sharp ringtones] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,36 norco online] [http://climate.msrc.sunysb.edu/1984/messages/345.html soma] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=61 cheap ultracet] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=242 free cingular ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=232 adipex online] [http://climate.msrc.sunysb.edu/1984/messages/364.html xenical online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=6 order albuterol] [http://climate.msrc.sunysb.edu/1984/messages/350.html cheap tenuate] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=83 cheap ortho] [http://climate.msrc.sunysb.edu/1984/messages/325.html free music ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=288 free sagem ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=262 lisinopril online] [http://climate.msrc.sunysb.edu/1984/messages/319.html cheap meridia] [http://climate.msrc.sunysb.edu/1984/messages/335.html propecia online] [http://climate.msrc.sunysb.edu/1984/messages/360.html vigrx online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=20 diethylpropion online] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=233 albuterol online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=40 mp3 ringtones] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=265 meridia online] [http://climate.msrc.sunysb.edu/1984/messages/307.html free ringtones] [http://climate.msrc.sunysb.edu/1984/messages/354.html cheap ultram] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=61 soma online] [http://ocw201-1.usc.edu/iPIDD/ju_board/view.php?message_ID=35 cheap lortab] [http://mrsrl.stanford.edu/seminar/detailview.php?event_id=292 cheap sildenafil] [http://brown.cla.sc.edu/projects/pas/bforum/index.php?method=showhtmllist&list=message&rollid=2,34 free nextel ringtones] [http://climate.msrc.sunysb.edu/1984/messages/317.html lorazepam online] [http://climate.msrc.sunysb.edu/1984/messages/308.html funny ringtones] [http://climate.msrc.sunysb.edu/1984/messages/368.html diethylpropion online] [http://www.bc.edu/apps/bookstore/cards/jun7-226002359520.html free free ringtones] [http://groups.ku.edu/cgi-bin/cgiwrap/kuksa/forum/ezboard.cgi?db=general&action=read&dbf=76 free funny ringtones] [http://climate.msrc.sunysb.edu/1984/messages/297.html free cingular ringtones] [http://www.bc.edu/apps/bookstore/cards/jun7-224302380012.html soma 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