Cygwin & SDL

According to the libsdl website, the latest version of SDL works well with Cygwin. How exactly does one get it to do so?

I’ve been struggling with it for a couple of days now… I’ve tried various installs of different development binaries, I’ve tried building it from source under Cygwin, and I haven’t had any success - the shell scripts and make files all complain about missing directories. I want to do native compiling, not cross development, and I can’t find any instructions anywhere on how to do that; the only docs on using gcc under Win32 are for cross compiling under mingw32.

Previously under Win32 I’ve only used SDL with Visual C++, and I don’t recall having any problems, got my first program with it running within maybe ten minutes of downloading the zip files… That was at work, though, and here at home I don’t have VC++ and would much rather use gcc if I can anyway.

How have other people gotten SDL to work under Cygwin? Any advice or experience would be much appreciated.

Chuck Gaulke

How have other people gotten SDL to work under Cygwin? Any advice or experience would be much appreciated.

I just did this yesterday. I had to remove my cygwin directory and then do
a fresh install from www.cygwin.com to get it to work. I’m attaching the
list of packages that I added to the install.

Once I had cygwin installed, I grabbed the latest CVS snapshot from
http://www.libsdl.org/cvs.html
and then unpacked it, did ./configure; make; make install
and then when I copied SDL.dll into the test directory, I was able to
build and run the test programs. Everything worked perfectly.

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment
-------------- next part --------------
Admin
NOCHANGE
Archive
zip
unzip
Base
NOCHANGE
Database
NOCHANGE
Devel
autoconf
automake
binutils
bison
ctags
cvs
flex
gcc
gdb
gettext
libtool
make
mingw-runtime
Doc
man
newlib-man
Editors
vim
Games
NOCHANGE
Graphics:
jpeg
libpng
opengl
tiff
Interpreters
NOCHANGE
Libs
NOCHANGE
Mail
NOCHANGE
Math
bc
Net
ncftp
openssh
Shells
rxvt
Text
NOCHANGE
Utils
bzip2
clear
file
patch
Web
links
wget

compiling, not cross development, and I can’t find any instructions anywhere on how to do that;
the only docs on using gcc under Win32 are for cross compiling under mingw32.

Setting up native mingw32 is very simple, much simpler than cygwin it seems. I
can not help you with cygwin…

How have other people gotten SDL to work under Cygwin? Any advice or experience would be much

… so I suggest going for mingw32 instead, unless you’re really set on cygwin. I explained
how I did it in an earlier post (were I confused cygwin for being mingw32), reproduced below
(a naive approach, but it works for me):

Extract the ‘i386-mingw32msvc’ directory from the ‘i386-mingw32msvc.tar.gz’ from the
zip into your gcc directory, (so that it’s bin / include / etc… directories overlap).

Now, copy the SDL.dll file from the ‘lib’ directory to the directory where you will
keep your source.

Build like so:

all:
gcc -c sdltest.cpp
gcc sdltest.o -o sdltest -lmingw32 -lSDLmain -mwindows -lSDL

[…]–
"That which does not kill me, simply postpones the inevitable."
Eddy L O Jansson | http://gazonk.org/~eloj

Charles Gaulke said:

According to the libsdl website, the latest version of SDL works well with Cygwin. How exactly does one get it to do so?

I’ve been struggling with it for a couple of days now… I’ve tried various installs of different development binaries, I’ve tried building it from source under Cygwin, and I haven’t had any success - the shell scripts and make files all complain about missing directories. I want to do native compiling, not cross development, and I can’t find any instructions anywhere on how to do that; the only docs on using gcc under Win32 are for cross compiling under mingw32.

Previously under Win32 I’ve only used SDL with Visual C++, and I don’t recall having any problems, got my first program with it running within maybe ten minutes of downloading the zip files… That was at work, though, and here at home I don’t have VC++ and would much rather use gcc if I can anyway.

How have other people gotten SDL to work under Cygwin? Any advice or experience would be much appreciated.

hrm, I do my primary development on freebsd, second stage is linux, then I go
to cygwin and it picks it right up (forcing me down to ogl 1.1, ugh)

I’m using the automake stuff, but if you don’t want to use those, you can do
something along the lines of

gcc -c main.c sdl-config --cflags
gcc -c other.c sdl-config --cflags

gcc -o myprog *.o sdl-config --libs

that should give ya the right result…

Chuck Gaulke

    -Erik <@Erik_Greenwald> [http://math.smsu.edu/~erik]

The opinions expressed by me are not necessarily opinions. In all probability,
they are random rambling, and to be ignored. Failure to ignore may result in
severe boredom or confusion. Shake well before opening. Keep Refrigerated.

First, install SDL:

  1. Run cygwin’s BASH shell
  2. Type mkdir -p /usr/local/cross-tools
  3. Type cd /usr/local/cross-tools
  4. Type start . A window should open.
  5. Drag-move the SDL-devel-1.2.3-mingw32.tar.gz file from the website
    to the window opened from step #4.
  6. Type tar xvzf SDL-devel-1.2.3-mingw32.tar.gz
  7. Type cd /usr/bin
  8. Type
    ln -s /usr/local/cross-tools/i386-mingw32msvc/bin/sdl-config .
  9. Type hash -r

To compile a program, use the “-mno-cygwin” option. So your Makefile
should look something like:

CC=gcc
CFLAGS=$(shell sdl-config --cflags)
LDLIBS=$(shell sdl-config --libs) -mno-cygwin
^^^^^^^^^^^
all: myprog

myprog: myprog.o

myprog.o: myprog.c

as opposed to a version without the “-mno-cygwin”. The "-mno-cygwin"
option forces compilation in mingw32 mode; this means you can’t use the
UNIX-ish commands, like the POSIX stuff.

It appears we get this question every now and then… it should be in the
FAQ somewhere.

-Mark–
Mark K. Kim
http://www.cbreak.org/
PGP key available upon request.

At 12:06 03/03/2002 -0800, you wrote:

How have other people gotten SDL to work under Cygwin? Any advice or experience would be much appreciated.

I just did this yesterday. I had to remove my cygwin directory and then do
a fresh install from www.cygwin.com to get it to work. I’m attaching the
list of packages that I added to the install.

Which mirror did you actually download the Cygwin packages from? Most of them just report that I can’t download the latest versions of the packages you say I need to add, and the one that didn’t give me any errors just dropped off to 0k/s partway through and never went back up.

Thanks,
Chuck

At 12:06 03/03/2002 -0800, you wrote:

How have other people gotten SDL to work under Cygwin? Any advice or experience would be much appreciated.

I just did this yesterday. I had to remove my cygwin directory and then do
a fresh install from www.cygwin.com to get it to work. I’m attaching the
list of packages that I added to the install.

Which mirror did you actually download the Cygwin packages from? Most of them just report that I can’t download the latest versions of the packages you say I need to add, and the one that didn’t give me any errors just dropped off to 0k/s partway through and never went back up.

http://planetmirror.com/

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment

At 12:06 03/03/2002 -0800, Sam Lantinga wrote:

Charles Gaulke wrote:

How have other people gotten SDL to work under Cygwin? Any advice or experience would be much appreciated.

I just did this yesterday. I had to remove my cygwin directory and then do
a fresh install from www.cygwin.com to get it to work. I’m attaching the
list of packages that I added to the install.

Once I had cygwin installed, I grabbed the latest CVS snapshot from
http://www.libsdl.org/cvs.html
and then unpacked it, did ./configure; make; make install
and then when I copied SDL.dll into the test directory, I was able to
build and run the test programs. Everything worked perfectly.

I got and installed the latest version of Cygwin with all the packages you specified in addition to the default stuff, and unpacked the latest CVS snapshot of SDL. When I did ‘./configure’, everything seemed fine, but ‘make’ and ‘make install’ both generate errors during the linking phase (undefined references to ‘GUID_POV’).

I’m pretty baffled as to what I could possibly have done differently from you at this point.

At this point I’m tempted to just give up on Cygwin, as much as I like it, and try using SDL with C++Builder instead.

Thanks for all the help and advice from all, though.

Charles Gaulke