SDL2 cygwin users, any luck compiling?

I’m fairly new to cygwin, and was getting quite frustrated trying to build
anything. My configure output essentially tells me it cannot find any math
functions/librarys, no stdio, and “***Your compiler (Gcc) does not produce
Windows executables!” - the strange thing is, doing the exact same steps
(./configure; make; make install) worked for me building gcc 4.7.2 (because
I originally assumed this was a compiler issue).

So, now I’ve concluded that it must be an issue with the configure script,
but I’m not sure where to start, in regards to cygwin specific stuff. Any
patches available for the latest repo version?

-Alex

Alex Barry <alex.barry at gmail.com>:

I’m fairly new to cygwin, and was getting quite frustrated trying to build
anything. My configure output essentially tells me it cannot find any math
functions/librarys, no stdio, and “***Your compiler (Gcc) does not produce
Windows executables!” - the strange thing is, doing the exact same steps
(./configure; make; make install) worked for me building gcc 4.7.2 (because
I originally assumed this was a compiler issue).

So, now I’ve concluded that it must be an issue with the configure script,
but I’m not sure where to start, in regards to cygwin specific stuff. Any
patches available for the latest repo version?

You might want to give the cmake-based build system a try:

http://bugzilla.libsdl.org/show_bug.cgi?id=1597

I did not test it with Cygwin, but chances are good that the generated
Makefiles
will allow you to build SDL2 cleanly.
Let me know, if you run into any issues, so I can fix them.

Cheers
Marcus

Silly question, when you installed cygwin, did you also install the
development tools? I don’t think they’re selected in the default install…On Tue, Oct 23, 2012 at 6:08 AM, Alex Barry <alex.barry at gmail.com> wrote:

I’m fairly new to cygwin, and was getting quite frustrated trying to build
anything. My configure output essentially tells me it cannot find any math
functions/librarys, no stdio, and “***Your compiler (Gcc) does not produce
Windows executables!” - the strange thing is, doing the exact same steps
(./configure; make; make install) worked for me building gcc 4.7.2 (because
I originally assumed this was a compiler issue).

So, now I’ve concluded that it must be an issue with the configure script,
but I’m not sure where to start, in regards to cygwin specific stuff. Any
patches available for the latest repo version?

-Alex


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Yeah, that’s all installed. The CMake solution worked, but configure did
not. I was previously able to build by using autotools (autoconf), but
read some things that suggested autoconf in cygwin is slightly broken in
some capacity.

One thing I did have to do is comment out lines 147-153, as gcc 4.x no
longer supports -mno-cygwin, however, iirc, -mwindow should work like it
does using the mingw toolchain, but I’m alright having SDL depend on cygwin
inside my cygwin environment. When I deploy my app, i’ll have cygwin,
msvc, linux/gcc, and mac/xcode/gcc support, and I think it’s valid that
cygwin has it’s own target.On Tue, Oct 23, 2012 at 11:49 AM, Sam Lantinga wrote:

Silly question, when you installed cygwin, did you also install the
development tools? I don’t think they’re selected in the default install…

On Tue, Oct 23, 2012 at 6:08 AM, Alex Barry <@Alex_Barry> wrote:

I’m fairly new to cygwin, and was getting quite frustrated trying to
build anything. My configure output essentially tells me it cannot find
any math functions/librarys, no stdio, and “***Your compiler (Gcc) does not
produce Windows executables!” - the strange thing is, doing the exact same
steps (./configure; make; make install) worked for me building gcc 4.7.2
(because I originally assumed this was a compiler issue).

So, now I’ve concluded that it must be an issue with the configure
script, but I’m not sure where to start, in regards to cygwin specific
stuff. Any patches available for the latest repo version?

-Alex


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Rather than commenting that block out, one could also wrap it in

if(CYGWIN)
if(CMAKE_C_COMPILER_VERSION MATCHES “.3\.[0-9].”)
include_directories("-I/usr/include/mingw")
list(APPEND EXTRA_LDFLAGS “-mno-cygwin”)
set(SDL_CFLAGS “${SDL_CFLAGS} -I/usr/include/mingw”)
list(APPEND SDL_LIBS “-mno-cygwin”)
endif(CMAKE_C_COMPILER_VERSION MATCHES “.3\.[0-9].”)
endif(CYGWIN)

Which would work, and would keep anyone happy who doesn’t want mingw inside
their cygwin install (like me).

-AlexOn Tue, Oct 23, 2012 at 11:55 AM, Alex Barry <@Alex_Barry> wrote:

Yeah, that’s all installed. The CMake solution worked, but configure did
not. I was previously able to build by using autotools (autoconf), but
read some things that suggested autoconf in cygwin is slightly broken in
some capacity.

One thing I did have to do is comment out lines 147-153, as gcc 4.x no
longer supports -mno-cygwin, however, iirc, -mwindow should work like it
does using the mingw toolchain, but I’m alright having SDL depend on cygwin
inside my cygwin environment. When I deploy my app, i’ll have cygwin,
msvc, linux/gcc, and mac/xcode/gcc support, and I think it’s valid that
cygwin has it’s own target.

On Tue, Oct 23, 2012 at 11:49 AM, Sam Lantinga wrote:

Silly question, when you installed cygwin, did you also install the
development tools? I don’t think they’re selected in the default install…

On Tue, Oct 23, 2012 at 6:08 AM, Alex Barry <@Alex_Barry> wrote:

I’m fairly new to cygwin, and was getting quite frustrated trying to
build anything. My configure output essentially tells me it cannot find
any math functions/librarys, no stdio, and “***Your compiler (Gcc) does not
produce Windows executables!” - the strange thing is, doing the exact same
steps (./configure; make; make install) worked for me building gcc 4.7.2
(because I originally assumed this was a compiler issue).

So, now I’ve concluded that it must be an issue with the configure
script, but I’m not sure where to start, in regards to cygwin specific
stuff. Any patches available for the latest repo version?

-Alex


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

Works for me - installed are: autoconf, automake, libtool, make, gcc,
gcc-mingw, mingw-runtime, w32api, mercurial, plus a few development
packages. I am starting with a “Bash prompt here” in the SDL folder and
then the usual sequence:
./autogen.sh
cd build
…/configure
make
make install

Note that cygwin uses a libtool version with a bug that prevents it to
compile/install from a path with a space in it. So check out the sources
to a short non-space path.

Hope that helps,
–AndreasOn 10/23/2012 6:08 AM, Alex Barry wrote:

I’m fairly new to cygwin, and was getting quite frustrated trying to
build anything. My configure output essentially tells me it cannot
find any math functions/librarys, no stdio, and “***Your compiler
(Gcc) does not produce Windows executables!” - the strange thing is,
doing the exact same steps (./configure; make; make install) worked
for me building gcc 4.7.2 (because I originally assumed this was a
compiler issue).

So, now I’ve concluded that it must be an issue with the configure
script, but I’m not sure where to start, in regards to cygwin specific
stuff. Any patches available for the latest repo version?

-Alex


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org

I haven’t tried SDL2 on Cygwin yet, but there were quite a few patches
including several to the configure script for SDL-1.2.15, so I
wouldn’t be surprised if some are needed for SDL2. I got most of the
patches I’m using for 1.2.15 from the Cygwin site. Had to make a few
changes to those because they were building 1.2.14 at the time.On Tue, Oct 23, 2012 at 6:08 AM, Alex Barry <alex.barry at gmail.com> wrote:

So, now I’ve concluded that it must be an issue with the configure
script, but I’m not sure where to start, in regards to cygwin specific
stuff. Any patches available for the latest repo version?

I haven’t tried SDL2 on Cygwin yet, but there were quite a few patches
including several to the configure script for SDL-1.2.15, so I
wouldn’t be surprised if some are needed for SDL2. I got most of the
patches I’m using for 1.2.15 from the Cygwin site. Had to make a few
changes to those because they were building 1.2.14 at the time.

Our buildbot compiles SDL2 and SDL-1.2 with Cygwin, MingW32 and MingW64
on every commit.

 http://buildbot.libsdl.org/builders/sdl-cygwin-x86
 http://buildbot.libsdl.org/builders/sdl-mingw-x86
 http://buildbot.libsdl.org/builders/sdl-mingw-amd64

The only thing to note is that we force the “CC” environment variable to
"gcc-3" for the Cygwin builds… there’s probably a reason for that, but
I don’t remember what. Send patches if it doesn’t work with newer GCCs
and I’ll incorporate them.

–ryan.

The only thing to note is that we force the “CC” environment variable to

“gcc-3” for the Cygwin builds… there’s probably a reason for that, but I
don’t remember what. Send patches if it doesn’t work with newer GCCs and
I’ll incorporate them.

It’s because GCC 4.x ditched the -mno-cygwin flag :)On Tue, Oct 23, 2012 at 3:15 PM, Ryan C. Gordon wrote:

On, Tue Oct 23, 2012, Alex Barry wrote:

Rather than commenting that block out, one could also wrap it in

if(CYGWIN)
if(CMAKE_C_COMPILER_VERSION MATCHES “.3\.[0-9].”)
include_directories("-I/usr/include/mingw")
list(APPEND EXTRA_LDFLAGS “-mno-cygwin”)
set(SDL_CFLAGS “${SDL_CFLAGS} -I/usr/include/mingw”)
list(APPEND SDL_LIBS “-mno-cygwin”)
endif(CMAKE_C_COMPILER_VERSION MATCHES “.3\.[0-9].”)
endif(CYGWIN)

Which would work, and would keep anyone happy who doesn’t want mingw inside
their cygwin install (like me).

I would rather want to change this to:

if(CYGWIN)

We build SDL on cygwin without the UNIX emulation layer

include_directories("-I/usr/include/mingw")
set(CMAKE_REQUIRED_FLAGS “-mno-cygwin”)
check_c_source_compiles("int main(int argc, char **argv) {}"
HAVE_GCC_NO_CYGWIN)
set(CMAKE_REQUIRED_FLAGS)
if(HAVE_GCC_NO_CYGWIN)
list(APPEND EXTRA_LDFLAGS “-mno-cygwin”)
list(APPEND SDL_LIBS “-mno-cygwin”)
endif(HAVE_GCC_NO_CYGWIN)
set(SDL_CFLAGS “${SDL_CFLAGS} -I/usr/include/mingw”)
endif(CYGWIN)

This checks for the -mno-cygwin compiler flag and should detect it
properly. Do you mind to give the snippet above a try?

The includes are due to the fact that the cmake-based build and
installation should be as close to the autotools version as
possible. Hence it is hardcoded. Ideally, those includes are removed
from both and the user passes them using the appropriate CFLAGS
environment variable. As long as they are found in configure.in, I would
recommend to keep them in CMakeLists.txt to make the transition from the
one build system to the other as smooth as possible.

Cheers
Marcus
-------------- next part --------------
A non-text attachment was scrubbed…
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20121024/aaabec51/attachment.pgp