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

From Armagetron
m (fixed code sections for easier copy and paste)
Line 9: Line 9:
 
Export some environment variable:
 
Export some environment variable:
  
  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
  export AS=i586-mingw32msvc-as
+
export AS=i586-mingw32msvc-as
  export NM=i586-mingw32msvc-nm
+
export NM=i586-mingw32msvc-nm
  export STRIP=i586-mingw32msvc-strip
+
export STRIP=i586-mingw32msvc-strip
  export RANLIB=i586-mingw32msvc-ranlib
+
export RANLIB=i586-mingw32msvc-ranlib
  export DLLTOOL=i586-mingw32msvc-dlltool
+
export DLLTOOL=i586-mingw32msvc-dlltool
  export OBJDUMP=i586-mingw32msvc-objdump
+
export OBJDUMP=i586-mingw32msvc-objdump
  export RESCOMP=i586-mingw32msvc-windres
+
export RESCOMP=i586-mingw32msvc-windres
  
 
You might want those in a script.
 
You might want those in a script.
Line 27: Line 27:
 
You'll need to use the same configure command to configure and install the libraries.  Get libSDL and libxml2 and do this:
 
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
+
./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.
 
Prefix is the location of your cross-compiler, it should have "bin", "lib", and "include" in it.
Line 33: Line 33:
 
To get libxml2 to cross-compile, use this as your configure command:
 
To get libxml2 to cross-compile, use this as your configure command:
  
  ./configure --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc --with-python=no
+
./configure --host=i586-mingw32msvc --prefix=/usr/i586-mingw32msvc --with-python=no
  
 
== Armagetron Advanced ==
 
== Armagetron Advanced ==
Line 44: Line 44:
 
Example:
 
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
+
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:
 
Currently it's failing for me with this line:
Line 56: Line 56:
  
  
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=/usr/i586-mingw32msvc --disable-sound --disable-glout --disable-binreloc
+
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=/usr/i586-mingw32msvc --disable-sound --disable-glout --disable-binreloc
  
 
This will configure, but it fails in nSocket.cpp with the version of MingW that I have on my Kubuntu system.  I'd appreciate if someone can try it with a different version, maybe it's just the version I've got.
 
This will configure, but it fails in nSocket.cpp with the version of MingW that I have on my Kubuntu system.  I'd appreciate if someone can try it with a different version, maybe it's just the version I've got.

Revision as of 11:15, 10 June 2006

Just collecting cross-compilation notes.

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=/usr/i586-mingw32msvc --disable-sound --disable-glout --disable-binreloc

This will configure, but it fails in nSocket.cpp with the version of MingW that I have on my Kubuntu system. I'd appreciate if someone can try it with a different version, maybe it's just the version I've got.