SDL 1.1.6 + Win32 + CygWin GCC

Hello,

I’ve had good success with the downloadable libraries for Visual C++,
but run into problems with cgywin (gcc 2.95.2). Doing “./configure”
“make” works well, until it runs into compilation problems. It
would seem that the makefiles arn’t sure if they’re targeted for Unix
or Windows (I’m just guessing, but I’ve attached some output).

So, RFM, and I tried the scripts “cross-configure.sh
cross-make.sh”, resulting in the same problems.

I hacked away at the makefiles and source, managed
to get a SDL.DLL, but with missing symbols. (Many less
symbols than the downloadable binaries for ming).

I get the impression that cygwin and SDL should be able
to work together, but it would take a little bit of
knowledgable tweaking to make it work smoothly.

Thanks in advance for your advice.

Cygwin for me is a way of keeping portable between Win32, Linux,
Visual C++ and gcc without rebooting. http://www.cygwin.com/

Nigel Stewart---------------------------------

$ bash ./configure
creating cache ./config.cache
checking for a BSD compatible install… /usr/bin/install -c
checking whether build environment is sane… yes
checking whether make sets ${MAKE}… yes
checking for working aclocal… missing
checking for working autoconf… missing
checking for working automake… missing
checking for working autoheader… missing
checking for working makeinfo… found
checking host system type… i686-pc-cygwin
checking target system type… i686-pc-cygwin
checking build system type… i686-pc-cygwin
checking for ranlib… ranlib
checking for gcc… gcc
checking whether the C compiler (gcc ) works… yes
checking whether the C compiler (gcc ) is a cross-compiler… no
checking whether we are using GNU C… yes

etc…

$ make
Making all in src
make[1]: Entering directory /cygdrive/h/Nigels/Raypp/SDL-1.1.6/src' Making all in main make[2]: Entering directory/cygdrive/h/Nigels/Raypp/SDL-1.1.6/src/main’
gcc -DPACKAGE=“SDL” -DVERSION=“1.1.6” -DHAVE_ALLOCA=1 -I. -I. -g -O2 -Wall -I…/…/src/video/wincommon -DENABL
E_WINDIB -I…/…/include -I…/…/include/SDL -I…/…/src -I…/…/src/win32 -I…/…/src/main -I…/…/src/audio -I…/…/sr
c/video -I…/…/src/events -I…/…/src/joystick -I…/…/src/cdrom -I…/…/src/thread -I…/…/src/timer -I…/…/src/endia
n -I…/…/src/file -c SDL_main.c
SDL_main.c: In function console_main': SDL_main.c:162: warning: implicit declaration of functionatexit’
rm -f libSDLmain.a

Making all in wincommon
make[3]: Entering directory /cygdrive/h/Nigels/Raypp/SDL-1.1.6/src/video/wincommon' /bin/sh ../../../libtool --mode=compile gcc -DPACKAGE=\"SDL\" -DVERSION=\"1.1.6\" -DHAVE_ALLOCA=1 -I. -I. -g -O2 - Wall -I../../../src/video/wincommon -DENABLE_WINDIB -I../../../include -I../../../include/SDL -I../../../src -I../../../ src/win32 -I../../../src/main -I../../../src/audio -I../../../src/video -I../../../src/events -I../../../src/joystick -I ../../../src/cdrom -I../../../src/thread -I../../../src/timer -I../../../src/endian -I../../../src/file -c SDL_sysevents .c mkdir .libs gcc -DPACKAGE=\"SDL\" -DVERSION=\"1.1.6\" -DHAVE_ALLOCA=1 -I. -I. -g -O2 -Wall -I../../../src/video/wincommon -DENABLE_W INDIB -I../../../include -I../../../include/SDL -I../../../src -I../../../src/win32 -I../../../src/main -I../../../src/a udio -I../../../src/video -I../../../src/events -I../../../src/joystick -I../../../src/cdrom -I../../../src/thread -I../ ../../src/timer -I../../../src/endian -I../../../src/file -c SDL_sysevents.c -DPIC -o .libs/SDL_sysevents.lo In file included from SDL_sysevents.c:38: SDL_lowvideo.h:45: parse error beforeSDL_Instance’
SDL_lowvideo.h:45: warning: type defaults to int' in declaration ofSDL_Instance’
SDL_lowvideo.h:45: warning: data definition has no type or storage class
SDL_lowvideo.h:46: parse error before SDL_Window' SDL_lowvideo.h:46: warning: type defaults toint’ in declaration of SDL_Window' SDL_lowvideo.h:46: warning: data definition has no type or storage class SDL_lowvideo.h:56: parse error beforeHWND’
SDL_lowvideo.h:62: parse error before HDC' SDL_lowvideo.h:65: parse error before*‘
SDL_lowvideo.h:65: parse error before HWND' SDL_lowvideo.h:65: warning: type defaults toint’ in declaration of LONG' SDL_lowvideo.h:65:LONG’ declared as function returning a function
SDL_lowvideo.h:68: parse error before SDL_hcursor' SDL_lowvideo.h:68: warning: type defaults toint’ in declaration of SDL_hcursor' SDL_lowvideo.h:68: warning: data definition has no type or storage class SDL_lowvideo.h:71: parse error beforeSDL_bounds’
SDL_lowvideo.h:71: warning: type defaults to int' in declaration ofSDL_bounds’
SDL_lowvideo.h:71: warning: data definition has no type or storage class
SDL_lowvideo.h:80: parse error before window' In file included from SDL_sysevents.c:39: SDL_syswm_c.h:31: parse error beforescreen_icn’
SDL_syswm_c.h:31: warning: type defaults to int' in declaration ofscreen_icn’


Nigel Stewart (@Nigel_Stewart)
Research Student, Software Developer
Y2K is the new millenium for the mathematically challenged.

I’ve had good success with the downloadable libraries for Visual C++,
but run into problems with cgywin (gcc 2.95.2)

The problem is that cygwin is a UNIX emulation layer on Win32, while SDL
is trying to build itself as a native Win32 application. Thus the Windows
API’s that SDL is trying to use are not available in the cygwin compilation
environment.

SDL does build very well with the mingw32 environment:
http://www.libsdl.org/Xmingw32/

I need to add this to the FAQ.

See ya!
-Sam Lantinga, Lead Programmer, Loki Entertainment Software

The problem is that cygwin is a UNIX emulation layer on Win32, while SDL
is trying to build itself as a native Win32 application. Thus the Windows
API’s that SDL is trying to use are not available in the cygwin compilation
environment.

I don't believe this is correct.  The UNIX emulation layer is
optional.  Cygwin also supports Win32 API's.

From the Cygwin FAQ: http://sources.redhat.com/cygwin/faq/faq.html#SEC71

Cheers,

Nigel Stewart

How do I use Win32 API calls?-----------------------------

It’s pretty simple actually. Cygwin tools require that you explicitly link the
import libraries for whatever Win32 API functions that you are going to
use, with the exception of kernel32, which is linked automatically (because the
startup and/or built-in code uses it).

For example, to use graphics functions (GDI) you must link with gdi32 like this:

gcc -o foo.exe foo.o bar.o -lgdi32

How do I compile a Win32 executable that doesn’t use Cygwin?

The -mno-cygwin flag to gcc makes gcc link against standard Microsoft DLLs
instead of Cygwin. This is desirable for native Windows programs
that don’t need a UNIX emulation layer.

This is not to be confused with ‘MinGW’ (Minimalist GNU for Windows), which is a
completely separate effort. That project’s home page is
http://www.mingw.org/index.shtml.


Nigel Stewart (@Nigel_Stewart)
Research Student, Software Developer
Y2K is the new millenium for the mathematically challenged.

Sam Lantinga wrote:

I’ve had good success with the downloadable libraries for Visual C++,
but run into problems with cgywin (gcc 2.95.2)

The problem is that cygwin is a UNIX emulation layer on Win32, while SDL
is trying to build itself as a native Win32 application. Thus the Windows
API’s that SDL is trying to use are not available in the cygwin compilation
environment.

This can’t be correct. One of the things you can get with cygwin
is the Insight interface to GDB, which uses a native Windows port
of tcl/tk, and as is traditional, cygwin is used to build itself;
ergo, cygwin can be used to build native Win32 apps.

However, the details of building libraries and apps are different
from mingw32, and so somebody needs to do an actual port to cygwin.
A good task for someone who loves to play with configure, makefiles,
and all that - the result would be a sort of mishmash of Unix bits
and Windows bits. :slight_smile:

Stan

However, the details of building libraries and apps are different
from mingw32, and so somebody needs to do an actual port to cygwin.
A good task for someone who loves to play with configure, makefiles,
and all that - the result would be a sort of mishmash of Unix bits
and Windows bits. :slight_smile:

I did find a posting in the archives that suggested that
SDL would compile "out of the box" with cygwin.  This is
why I'm a bit confused.  I havn't actually used cygwin
for Win32 API programming - that's not really why I'd
normally use it, but it sure would be nice to have it
in combination with SDL - cross platform graphics for
Win32 and Linux, without rebooting.

Anyway, mingw32 has me totally confused and baffled,
and besides, it also choked on SDL.  So, I'm going to
press on with VC6 and defer the issue, since it's
not critically important to me (right now).

I would encourage someone with a good familiarity of
cygwin/mingw32/configure etc to have a look into it.

I apologise to Mr Lantinga for my frustrated tone -
SDL rocks!

Nigel Stewart--

Nigel Stewart (@Nigel_Stewart)
Research Student, Software Developer
Y2K is the new millenium for the mathematically challenged.