From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1CvLlk-0000cm-K1 for qemu-devel@nongnu.org; Sun, 30 Jan 2005 15:34:04 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1CvLlh-0000b9-SR for qemu-devel@nongnu.org; Sun, 30 Jan 2005 15:34:02 -0500 Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1CvLlh-0000ap-Qm for qemu-devel@nongnu.org; Sun, 30 Jan 2005 15:34:01 -0500 Received: from [213.165.64.20] (helo=mail.gmx.net) by monty-python.gnu.org with smtp (Exim 4.34) id 1CvLZ4-0005Mm-R7 for qemu-devel@nongnu.org; Sun, 30 Jan 2005 15:21:00 -0500 Received: from be by colin.test with local (masqmail 0.2.20) id 1CvLZj-1ff-00 for ; Sun, 30 Jan 2005 21:21:39 +0100 Date: Sun, 30 Jan 2005 21:21:39 +0100 Subject: Re: [Qemu-devel] [PATCH] Fix OS X SDL breakage Message-ID: <20050130202139.GA6410@colin.test> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline From: Bernhard Ehlers Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org 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: 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 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 +#include #endif #endif /* CONFIG_SDL */