Cross-compiling for Win32 gives broken libraries


I’m compiling an SDL demo for a friend on Win32.
I am using the stable SDL 1.2.3 release, but the binary release didn’t
contain the libSDL.a and libSDLmain.a import libraries (why not?).

So I figured I’d build them myself. I downloaded the SDL 1.2.3 source
package. Native compiling on Win32 didn’t work, too much errors and fuss

This compiler seems to work fine with simple test programs, I can make
Win32 hello world EXE’s with it. Then I tried to build SDL with it. I
had to install OpenGL first, because SDL seemed to need <GL/gl.h>. I
installed Microsofts version that’s available on the net.
Then the compiling went fine (using configure --host=i386-mingw32 and
then make - make install). But then when I try to use the import library
it says:

/usr/local/lib/libSDL.a: could not read symbols: Archive has no index;
run ranli
b to add one

… and the same for libSDLmain.a
not very surprisingly, when i use ranlib it still does not work.

I looked this up in the mailing list archives and found a similar case,
there it was said: this is not your fault, but it’s an error in the
building procedure - we’ll fix it soon. This was in 1999, and the guy
was using the latest CVS snapshots. But I’m using the stable ones. So…
who’s fault is this one? Is it

  • the SDL source
  • my cross-compiler
  • the fact that i use the microsoft GL libraries
  • my mistake

I hope someone can help me on this. Also in the meantime, could someone
please send me a working libSDL.a / libSDLmain.a for mingw32 if you have
one. This would be the quickest solution for me!

Tom Blauwendraat