Sign in to follow this  
RazZziel

Cross-compiling with SDL, SDL_gfx and xmingw

Recommended Posts

Hi. I'm trying to cross-compile a little game made in SDL in linux to windows with xmingw. I use Gentoo Linux, so I've installed theese packages: - dev-util/xmingw-binutils - dev-util/xmingw-gcc - dev-util/xmingw-runtime - dev-util/xmingw-w32api [MESS] After that, I installed SDL libs for win32 with this script: - http://www.icculus.org/~dolson/sdl/sdl-cross-install.sh.txt Which I run as root, so it installed SDL, SDL_image, SDL_mixer, SDL_net and SDL_ttf in /opt/SDL-1.2.9 In my app, I also use SDL_gfx, so I downloaded source code (SDL_gfx-2.0.13.tar.gz), and compiled it as I _think_ it must be compiled: cross-configure.sh:
#!/bin/sh

CONFIG_SHELL=/bin/sh
export CONFIG_SHELL

PREFIX=/opt/SDL-1.2.9
TARGET=i386-mingw32msvc
PATH="$PREFIX/bin:/opt/xmingw/bin:$PATH"
export PATH

SDL_CONFIG="$PREFIX/bin/$TARGET-sdl-config"
export SDL_CONFIG

cache=cross-config.cache

sh configure --cache-file="$cache"    --target=$TARGET --host=$TARGET --build=i386-linux --prefix=/opt/SDL-1.2.9   $*

status=$?
rm -f "$cache"

exit $status
cross-make.sh:
#!/bin/sh

PREFIX=/opt/SDL-1.2.9
TARGET=i386-mingw32msvc
PATH="$PREFIX/bin:/opt/xmingw/bin:$PATH"
export PATH
exec make $*
And with "make install", I installed it in /opt/SDL-1.2.9 (this copied come .h files to include, and libSDL_gfx.la and libSDL_gfx.a to libs) *sigh* So I tried to cross-compile my game, which I develop in kdevelop. So, the problems: Any try co compile it under kdevelop fails with a
configure: error: C++ compiler cannot create executables"
In fact, I'm not very sure how to set up kdevelop for cross-compiling (even for simple compiling! it just works, but I don't know if in the best way :p) If I `cd` to the root of the project and run the before mentioned scripts (cross-configure and cross-make), configure finishes without error, but make sais:
/opt/xmingw/lib/gcc/i386-mingw32msvc/3.4.4/../../../../i386-mingw32msvc/bin/ld: cannot find -lSDL
And if I try to cd to the source dir and try a simple
i386-mingw32msvc-g++ *.cpp *.h `/opt/SDL-1.2.9/bin/i386-mingw32msvc-sdl-config --libs --cflags` -lSDL_mixer -lSDL_image -lSDL_ttf -lSDL_gfx
[/MESS] Compilation works well but linking sais:
collect2: ld terminated with signal 11 [Segmentation fault]
/tmp/cclrKPyx.o:CFramerate.cpp:(.text+0x21): undefined reference to `__imp__SDL_initFramerate'
/tmp/cclrKPyx.o:CFramerate.cpp:(.text+0xd3): undefined reference to `__imp__SDL_initFramerate'
/tmp/ccaZGCut.o:CGame.cpp:(.text$_ZN9Framerate6setFPSEi[Framerate::setFPS(int)]+0x16): undefined reference to `__imp__SDL_setFramerate'
/tmp/ccaZGCut.o:CGame.cpp:(.text$_ZN9Framerate5delayEv[Framerate::delay()]+0xf): undefined reference to `__imp__SDL_framerateDelay'
So I think SDL_gfx isn't well installed. *sigh* it's driving me nuts (I'm kinda noob) does anybody have experience doing this kind of things and can tell me what may fail?

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