Compiling SDL 1.3 for iPhone iOS 4.2

I may have missed a response to my post a couple of days ago, but here it is
again:

Does SDL 1.3 compile with the SDK for iOS 4.2? Originally I had the SDK for
iOS 3.2 and when I tried to compile the xcode project for iPhone it
generated a lot of errors, so I updated to the latest (stable) iOS SDK and
now it won’t compile at all.

Perhaps there is a .sh file I need to run or some other step to configure
it?

Ken

Ken, I plan on looking into this as soon as I have the documentation
feedback form wrapped up, hopefully later today or tomorrow.On Mon, Jan 17, 2011 at 11:51 AM, Ken Rogoway wrote:

I may have missed a response to my post a couple of days ago, but here it
is again:

Does SDL 1.3 compile with the SDK for iOS 4.2? Originally I had the SDK
for iOS 3.2 and when I tried to compile the xcode project for iPhone it
generated a lot of errors, so I updated to the latest (stable) iOS SDK and
now it won?t compile at all.

Perhaps there is a .sh file I need to run or some other step to configure
it?

Ken


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


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Thanks!From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Sam Lantinga
Sent: Monday, January 17, 2011 2:42 PM
To: SDL Development List
Subject: Re: [SDL] Compiling SDL 1.3 for iPhone iOS 4.2

Ken, I plan on looking into this as soon as I have the documentation
feedback form wrapped up, hopefully later today or tomorrow.

On Mon, Jan 17, 2011 at 11:51 AM, Ken Rogoway <@Ken_Rogoway> wrote:

I may have missed a response to my post a couple of days ago, but here it is
again:

Does SDL 1.3 compile with the SDK for iOS 4.2? Originally I had the SDK for
iOS 3.2 and when I tried to compile the xcode project for iPhone it
generated a lot of errors, so I updated to the latest (stable) iOS SDK and
now it won’t compile at all.

Perhaps there is a .sh file I need to run or some other step to configure
it?

Ken


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


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Okay, I fixed some things and everything seems to be working on the latest
snapshot:
http://www.libsdl.org/tmp/SDL-1.3.zip

Please let me know if you have any more problems! :)On Mon, Jan 17, 2011 at 11:51 AM, Ken Rogoway wrote:

I may have missed a response to my post a couple of days ago, but here it
is again:

Does SDL 1.3 compile with the SDK for iOS 4.2? Originally I had the SDK
for iOS 3.2 and when I tried to compile the xcode project for iPhone it
generated a lot of errors, so I updated to the latest (stable) iOS SDK and
now it won?t compile at all.

Perhaps there is a .sh file I need to run or some other step to configure
it?

Ken


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


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Thanks! I’ll give it a try when I get home tonight.From: sdl-bounces@lists.libsdl.org [mailto:sdl-bounces at lists.libsdl.org] On
Behalf Of Sam Lantinga
Sent: Tuesday, January 18, 2011 6:53 PM
To: SDL Development List
Subject: Re: [SDL] Compiling SDL 1.3 for iPhone iOS 4.2

Okay, I fixed some things and everything seems to be working on the latest
snapshot:
http://www.libsdl.org/tmp/SDL-1.3.zip

Please let me know if you have any more problems! :slight_smile:

On Mon, Jan 17, 2011 at 11:51 AM, Ken Rogoway <@Ken_Rogoway> wrote:

I may have missed a response to my post a couple of days ago, but here it is
again:

Does SDL 1.3 compile with the SDK for iOS 4.2? Originally I had the SDK for
iOS 3.2 and when I tried to compile the xcode project for iPhone it
generated a lot of errors, so I updated to the latest (stable) iOS SDK and
now it won’t compile at all.

Perhaps there is a .sh file I need to run or some other step to configure
it?

Ken


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


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC

Good to see this fixes the compilation issues with device.

A few days ago I fixed some issues and got device mode to compile but as soon as I’d go to run any example on my actual device GDB would throw EXC_BAD_ACCESS. The simulator build seems to work so far. This newest revision of 1.3 posted here does the same thing. It seems that somewhere there’s a message being sent to an object that is not valid. I have not yet figured out where.

I think I have tracked down where the EXC_BAD_ACCESS is being triggered, although It’s not obvious to me yet why since I’m not very familiar with Obj-C yet.

It happens in UIKit_GL_CreateContext at view = [[SDL_uikitopenglview alloc] initWithFrame: [uiwindow bounds] \ …

I used NSZombieEnabled in my test app to find this out. I hope this is somewhat useful to someone with greater Obj-C memory management knowledge than me.

Like I said, in the simulator it seems fine, only shows a problem with device.

SirKnight…

is your app doing any multithreading?
i have an app i’m trying to port to an iPad and all the SDL related stuff is being done in a thread (not in main) and i am seeing a HALT down in initWithFrame after many “autoreleased with no pool in place - just leaking” errors shooting out. i see a lot of talk about SDL not working well in multithreaded situations with iOS… anyone else care to comment?

-pete

I’m running into this as well. Has anyone figured out what’s going on?On Thu, Jan 20, 2011 at 7:34 PM, SirKnightTG wrote:

I think I have tracked down where the EXC_BAD_ACCESS is being triggered,
although It’s not obvious to me yet why since I’m not very familiar with
Obj-C yet.

It happens in UIKit_GL_CreateContext at view = [[SDL_uikitopenglview alloc]
initWithFrame: [uiwindow bounds] \ …

I used NSZombieEnabled in my test app to find this out. I hope this is
somewhat useful to someone with greater Obj-C memory management knowledge
than me.

Like I said, in the simulator it seems fine, only shows a problem with
device.


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


-Sam Lantinga, Founder and CEO, Galaxy Gameworks

I’m learning a bunch trying to track this down, so I thought I’d document it
on my blog:

If anyone has any suggestions, I’d love to hear them! :)On Wed, Feb 16, 2011 at 8:23 PM, Sam Lantinga <@slouken> wrote:

I’m running into this as well. Has anyone figured out what’s going on?

On Thu, Jan 20, 2011 at 7:34 PM, SirKnightTG wrote:

I think I have tracked down where the EXC_BAD_ACCESS is being triggered,
although It’s not obvious to me yet why since I’m not very familiar with
Obj-C yet.

It happens in UIKit_GL_CreateContext at view = [[SDL_uikitopenglview
alloc] initWithFrame: [uiwindow bounds] \ …

I used NSZombieEnabled in my test app to find this out. I hope this is
somewhat useful to someone with greater Obj-C memory management knowledge
than me.

Like I said, in the simulator it seems fine, only shows a problem with
device.


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


-Sam Lantinga, Founder and CEO, Galaxy Gameworks


-Sam Lantinga, Founder and CEO, Galaxy Gameworks

I just sent my response to you and your blog. I think long term, we
need to fix that keyboard thing and remove that #define completely.

-EricOn 2/17/11, Sam Lantinga wrote:

I’m learning a bunch trying to track this down, so I thought I’d document it
on my blog:
http://slouken.blogspot.com/2011/02/ninja-hacking-on-iphone-part-1.html

If anyone has any suggestions, I’d love to hear them! :slight_smile:


Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/

FYI, Eric Wing helped me track this down.

The solution is adding -ObjC to the “Other Linker Flags” setting for your
application.

We’re looking into a better solution for the long term.

Cheers!On Thu, Feb 17, 2011 at 1:08 AM, Sam Lantinga <@slouken> wrote:

I’m learning a bunch trying to track this down, so I thought I’d document
it on my blog:
http://slouken.blogspot.com/2011/02/ninja-hacking-on-iphone-part-1.html

If anyone has any suggestions, I’d love to hear them! :slight_smile:

On Wed, Feb 16, 2011 at 8:23 PM, Sam Lantinga <@slouken> wrote:

I’m running into this as well. Has anyone figured out what’s going on?

On Thu, Jan 20, 2011 at 7:34 PM, SirKnightTG wrote:

I think I have tracked down where the EXC_BAD_ACCESS is being
triggered, although It’s not obvious to me yet why since I’m not very
familiar with Obj-C yet.

It happens in UIKit_GL_CreateContext at view = [[SDL_uikitopenglview
alloc] initWithFrame: [uiwindow bounds] \ …

I used NSZombieEnabled in my test app to find this out. I hope this is
somewhat useful to someone with greater Obj-C memory management knowledge
than me.

Like I said, in the simulator it seems fine, only shows a problem with
device.


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


-Sam Lantinga, Founder and CEO, Galaxy Gameworks


-Sam Lantinga, Founder and CEO, Galaxy Gameworks


-Sam Lantinga, Founder and CEO, Galaxy Gameworks

Last night I had this very same experience. In my case I’m
pretty sure it was because I mixed the old libSDL with the new
include files. So I cleaned and corrected the xcode config.
After that the program ran fine on my iPad through the debugger.

But it wouldn’t surprise me if that was just luck. Perhaps
in my case xcode decided to magically change the linker flags.

But I must say, Xcode is a totally new experience for me. Not necessary a pleasant one. And MacOS isn't as reliable as you may expect. It managed to delete AppleMobileDevice.kext and then my MacPro didn't connect to the iPad anymore. It was just by luck that I found http://support.apple.com/kb/HT1747 which explains how to reinstall iTunes. WTF?

And I wish you all the luck in the world if you run into the
"Failed to launch simulated application: Unknown error" problem.
</rant macos_and_xcode>

– KeesOn Thursday 17 February 2011, Sam Lantinga wrote:

I’m running into this as well. Has anyone figured out what’s going on?

On Thu, Jan 20, 2011 at 7:34 PM, SirKnightTG wrote:

I think I have tracked down where the EXC_BAD_ACCESS is being triggered,
although It’s not obvious to me yet why since I’m not very familiar with
Obj-C yet.

It happens in UIKit_GL_CreateContext at view = [[SDL_uikitopenglview alloc]
initWithFrame: [uiwindow bounds] \ …

I used NSZombieEnabled in my test app to find this out. I hope this is
somewhat useful to someone with greater Obj-C memory management knowledge
than me.

Like I said, in the simulator it seems fine, only shows a problem with
device.


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


-Sam Lantinga, Founder and CEO, Galaxy Gameworks

Last night I had this very same experience. In my case I’m
pretty sure it was because I mixed the old libSDL with the new
include files. So I cleaned and corrected the xcode config.
After that the program ran fine on my iPad through the debugger.

Damn, a Schr?dinbug. Argh.

Program received signal: ?EXC_BAD_ACCESS?.
(gdb) where
#0 0x34a80124 in _class_getMeta ()
#1 0x34a8078c in _class_isInitialized ()
#2 0x34a807d0 in _class_initialize ()
#3 0x34a8652c in prepareForMethodLookup ()
#4 0x34a82f38 in lookUpMethod ()
#5 0x34a80780 in _class_lookupMethodAndLoadCache ()
#6 0x34a804b6 in objc_msgSend_uncached ()
#7 0x0004d02a in UIKit_GL_CreateContext (_this=0xae0c00, window=0x131410) at /Users/kees/src/SDL/Xcode-iPhoneOS/SDL/…/…/src/video/uikit/SDL_uikitopengles.m:110

And maybe a HeisenBug too, because adding -ObjC to the linker flags didn’t help. And
now I have a “Failed to upload test2.app” …

After restarting Xcode it is back to live. I’m not happy.

Indeed -ObjC seems to be needed, but you also have to restart
Xcode to recover from an error situation.

– KeesOn 17 Feb, 2011, at 15:57 , Kees Bakker wrote: