qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Fix OS X SDL breakage
@ 2005-01-23 22:31 Daniel Egger
  2005-01-26 19:47 ` Fabrice Bellard
  0 siblings, 1 reply; 17+ messages in thread
From: Daniel Egger @ 2005-01-23 22:31 UTC (permalink / raw)
  To: qemu-devel


[-- Attachment #1.1: Type: text/plain, Size: 553 bytes --]

Hija,

On OS X vl.c explicitly includes <SDL/SDL.h> which is wrong for two
reasons:
a) the file does compile without the include
b) the path is supposedly incorrect since the include path
    is (should) be set by `sdl-config --cflags` which already
    includes the path "SDL". So this will only work in case
    someone tries to be clever by copying the SDL headers into
    a directory SDL in a standard include directory and breaks
    e.g. on fink where this is not the case.

Attached patch fixes this by removing the seemingly unneeded
include.


[-- Attachment #1.2: diff --]
[-- Type: application/octet-stream, Size: 453 bytes --]

Index: vl.c
===================================================================
RCS file: /cvsroot/qemu/qemu/vl.c,v
retrieving revision 1.117
diff -u -r1.117 vl.c
--- vl.c	15 Jan 2005 21:50:11 -0000	1.117
+++ vl.c	23 Jan 2005 22:26:05 -0000
@@ -66,12 +66,6 @@
 #define memalign(align, size) malloc(size)
 #endif
 
-#ifdef CONFIG_SDL
-#ifdef __APPLE__
-#include <SDL/SDL.h>
-#endif
-#endif /* CONFIG_SDL */
-
 #include "disas.h"
 
 #include "exec-all.h"

[-- Attachment #1.3: Type: text/plain, Size: 23 bytes --]



Servus,
       Daniel

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 478 bytes --]

^ permalink raw reply	[flat|nested] 17+ messages in thread
* Re: [Qemu-devel] [PATCH] Fix OS X SDL breakage
@ 2005-01-30 20:21 Bernhard Ehlers
  0 siblings, 0 replies; 17+ messages in thread
From: Bernhard Ehlers @ 2005-01-30 20:21 UTC (permalink / raw)
  To: qemu-devel

Fabrice Bellard wrote:

> Can you confirm that QEMU for OS X works with this include ? IMHO it was
> added to add the '#define main SDL_main' define.
> 
> Fabrice.

Hi,

Here my test results on my Mac OS X 10.3.7.

I use the qemu-snapshot-2004-12-28_23.tar.bz2 from http://people.fruitsalad.org/nox/ , but the results should be the same on CVS.

1)  self compiled SDL V1.2.8

# sdl-config --version --cflags --libs
1.2.8
-I/usr/local/include/SDL -D_THREAD_SAFE
-L/usr/local/lib -lSDLmain -lSDL -framework Cocoa -framework OpenGL

a) no change to vl.c
compiles OK, links OK, runs OK

b) remove the #include SDL/SDL.h in vl.c
compiles OK, links OK, crashes during execution

2005-01-29 11:31:55.502 qemu[1222] *** _NSAutoreleaseNoPool(): Object 0x1b01550 of class NSCFArray autoreleased with no pool in place - just leaking
.
.
.
2005-01-29 11:31:55.533 qemu[1222] *** _NSAutoreleaseNoPool(): Object 0x1b39850 of class NSException autoreleased with no pool in place - just leaking
2005-01-29 11:31:55.533 qemu[1222] *** Uncaught exception: <NSInternalInconsistencyException> Error (1002) creating CGSWindow

2)  Fink sdl v1.2.7-1

# sdl-config --version --cflags --libs
1.2.7
-I/sw/include/SDL -D_THREAD_SAFE
-L/sw/lib -lSDLmain -lSDL -framework Cocoa -framework OpenGL

a) no change to vl.c
compile error in vl.c, include file SDL/SDL.h not found

b) remove the #include SDL/SDL.h in vl.c
compiles OK, links OK, crashes during execution (see 1b)


So the removal of the #include <SDL/SDL.h> crashes the executable on MAC OSX. That means it has to stay.

On the other side it compiles only for the default SDL installation because /usr/local/include is in the default include search path. The problem is, that for the compilation of vl.c the SDL include path (sdl-config --cflags) is not used.

My proposal is to modify the Makefiles, so that for the compilation of vl.c the SDL_CFLAGS are used.

Here my patches. Now it compiles, links and runs with both SDL libraries.

Best regards

Bernhard Ehlers

diff -ru qemu.orig/Makefile.target qemu/Makefile.target
--- qemu.orig/Makefile.target	Mon Dec 20 00:33:47 2004
+++ qemu/Makefile.target	Sat Jan 29 12:16:04 2005
@@ -348,6 +348,9 @@
 sdlaudio.o: sdlaudio.c
 	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
 
+vl.o: vl.c vl.h
+	$(CC) $(CFLAGS) $(DEFINES) $(SDL_CFLAGS) -c -o $@ $<
+
 depend: $(SRCS)
 	$(CC) -MM $(CFLAGS) $(DEFINES) $^ 1>.depend
 
diff -ru qemu.orig/vl.c qemu/vl.c
--- qemu.orig/vl.c	Mon Dec 20 00:18:01 2004
+++ qemu/vl.c	Sat Jan 29 12:16:34 2005
@@ -68,7 +68,7 @@
 
 #ifdef CONFIG_SDL
 #ifdef __APPLE__
-#include <SDL/SDL.h>
+#include <SDL.h>
 #endif
 #endif /* CONFIG_SDL */
 

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2005-01-30 20:34 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-23 22:31 [Qemu-devel] [PATCH] Fix OS X SDL breakage Daniel Egger
2005-01-26 19:47 ` Fabrice Bellard
2005-01-26 20:47   ` Daniel Egger
2005-01-26 20:58   ` Laurent Amon
2005-01-27  7:53     ` Daniel Egger
2005-01-27 10:51       ` Laurent Amon
2005-01-27 11:40         ` Johannes Schindelin
2005-01-27 12:08           ` René Korthaus
2005-01-27 17:07             ` Daniel Egger
2005-01-27 22:39             ` Daniel Egger
2005-01-27 23:01             ` Laurent Amon
2005-01-27 13:27         ` [Qemu-devel] " Anand Kumria
2005-01-27 17:10           ` Daniel Egger
2005-01-27 19:34             ` Laurent Amon
2005-01-27 21:39               ` Daniel Egger
2005-01-27 21:33         ` [Qemu-devel] " Daniel Egger
  -- strict thread matches above, loose matches on Subject: below --
2005-01-30 20:21 Bernhard Ehlers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).