• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Sik_the_hedgehog

Crosscompiling from Linux to Windows

4 posts in this topic

OK, so I want to make Windows builds of my game but I'm running Ubuntu. I was expecting to get a Windows computer this month (which I was planning to use to make Windows builds) but that seems like it isn't going to happen so I'm probably stuck trying to crosscompile from Ubuntu instead. Already installed MinGW-w64 (through Software Center, so assume default everything), but I have no idea how to use it.

 

Basically I need to build these libraries:

  • SDL 2
  • PhysicsFS
  • libpng
  • zlib
  • libogg
  • libvorbis
  • vorbisfile

PhysicsFS uses CMake so that's probably easy (just tell CMake to use MinGW-w64 to build). SDL2 includes a CMake script too so I could attempt to use that (not sure how well it works though). The rest of the libraries I have absolutely no idea how, though.

 

Then after that I need to get the game build for Windows. Again, no idea. Currently using Code::Blocks. I noticed MinGW-w64 isn't detected, but I wonder if I could just clone the GCC settings and change the directories (since otherwise it seems to be identical). If somebody else has a better solution tell me. Otherwise I may need to make a makefile and I have no idea how to make it to work properly with the crosscompiler.

 

Any help is appreciated! (this is also to learn how to use a crosscompiler!)

0

Share this post


Link to post
Share on other sites

In the configuration script that mostly come with the source packages use the --host --target parameters

But better have a look in the lists of parameters with ./configure --help

 

It may work.

0

Share this post


Link to post
Share on other sites

Yeah, but I have no idea what to fill in those parameters (since I never used configure before except as "./configure"). Also, zlib isn't being very helpful:

 

sik@host221:~/Descargas/zlib-1.2.8$ ./configure --help
usage:
  configure [--const] [--zprefix] [--prefix=PREFIX]  [--eprefix=EXPREFIX]
    [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]
    [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]

 

Either it's not listing all possible parameters, or it's not making it easy to crosscompile. Odd, considering what kind of library it is.

0

Share this post


Link to post
Share on other sites

Currently using Code::Blocks. I noticed MinGW-w64 isn't detected, but I wonder if I could just clone the GCC settings and change the directories (since otherwise it seems to be identical).

That works, but you must change the executable prefix, not the path (they're normally all in the same location).
 
Your /usr/bin folder looks something like this (that's mine, actually):

me@ubuntu:/usr$ ls -l bin | grep gcc
-rwxr-xr-x 1 root root         428 Mai  7  2006 c89-gcc
-rwxr-xr-x 1 root root         454 Apr 11  2011 c99-gcc
lrwxrwxrwx 1 root root           7 Okt 12  2013 gcc -> gcc-4.8
-rwxr-xr-x 1 root root      357344 Jun 19  2013 gcc-4.6
-rwxr-xr-x 1 root root      775888 Nov 15  2013 gcc-4.8
-rwxr-xr-x 1 root root       26968 Nov 15  2013 gcc-ar-4.8
-rwxr-xr-x 1 root root       26968 Nov 15  2013 gcc-nm-4.8
-rwxr-xr-x 1 root root       26968 Nov 15  2013 gcc-ranlib-4.8
-rwxr-xr-x 1 root root      349248 Dez 13  2012 i686-w64-mingw32-gcc
-rwxr-xr-x 1 root root      349256 Dez 13  2012 i686-w64-mingw32-gcc-4.6
lrwxrwxrwx 1 root root           7 Okt 12  2013 x86_64-linux-gnu-gcc -> gcc-4.8
lrwxrwxrwx 1 root root           7 Jun 19  2013 x86_64-linux-gnu-gcc-4.6 -> gcc-4.6
lrwxrwxrwx 1 root root           7 Nov 15  2013 x86_64-linux-gnu-gcc-4.8 -> gcc-4.8
lrwxrwxrwx 1 root root          10 Nov 15  2013 x86_64-linux-gnu-gcc-ar-4.8 -> gcc-ar-4.8
lrwxrwxrwx 1 root root          10 Nov 15  2013 x86_64-linux-gnu-gcc-nm-4.8 -> gcc-nm-4.8
lrwxrwxrwx 1 root root          14 Nov 15  2013 x86_64-linux-gnu-gcc-ranlib-4.8 -> gcc-ranlib-4.8
-rwxr-xr-x 1 root root      349248 Dez 13  2012 x86_64-w64-mingw32-gcc
-rwxr-xr-x 1 root root      349256 Dez 13  2012 x86_64-w64-mingw32-gcc-4.6

Note how all the cross compilers (including the x64 Linux "cross" compiler, which is really just a symlink to the native compiler that doesn't have a prefix) have a different name prefix.
 
 Of course that's only for making Code::Blocks work, for cmake or configure you need to do the obscure build/host/target triplet dance.

 

Unluckily, the GNU build system is where it gets nasty, even after years, I still need several attempts to get it right every single time I try. From the official docs:
 

The relationship between build, host, and target have been cleaned up: the chain of default is now simply: target defaults to host, host to build, and build to the result of config.guess. [...]

configure enters cross-compilation mode if and only if --host is passed. That's the short documentation.

 
Now of course, it also tells you further down that you are not to provide host without build, since that is "fragile" (whatever that means). Great, huh. So, in short, you need to provide these:
 
--build=... The system on which the package is built. That is, x86_64-linux-gnu-gcc or whatever it is on your box (probably exactly that!).
--host=...  The system where built programs and libraries will run. That's x86_64-w64-mingw32-gcc or whatever you choose it to be.
 

me@ubuntu:/usr$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/4.6/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr --includedir='/usr/include'
--mandir='/usr/share/man' --infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var
--libexecdir='/usr/lib/gcc-mingw-w64' --disable-maintainer-mode --disable-dependency-tracking
--prefix=/usr --enable-shared --enable-static --disable-multilib --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib
--enable-libstdcxx-time=yes --with-tune=generic --enable-version-specific-runtime-libs
--enable-threads=win32 --enable-fully-dynamic-string --enable-sjlj-exceptions
--enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto --with-plugin-ld --target=x86_64-w64-mingw32
--with-gxx-include-dir=/usr/include/c++/4.6 --with-as=/usr/bin/x86_64-w64-mingw32-as --with-ld=/usr/bin/x86_64-w64-mingw32-ld
Thread model: win32
gcc version 4.6.3 (GCC)

As you can see, this compiler was built with --build=x86_64-linux-gnu and --target=x86_64-w64-mingw32. The "target" is what the compiler builds executables for, so that's what you want to use as "host".

 

For cmake, it's described here.

2

Share this post


Link to post
Share on other sites

EDIT: forget everything I wrote before (check the edit history if you're curious), turns out it wasn't doing what I thought it was. When I figure out it all I'll post the details of what to do. At least it does seem like I could build the libraries (but installing them is a whole different issue).

Edited by Sik_the_hedgehog
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0