iOS example crashes in setup

edited April 2021 in Help request

I'm trying to build a cross platform game, Windows/Mac/Linux/iOS/Android, using version 1.11. I developed the basic game mechanics on Mac. Now I am trying to port to the other platforms. The Windows and Linux builds were easy.

I am trying to use the example iOS project, but the example doesn't seem to work. It builds just fine but crashes with a stack overflow error when run in the simulator. Near the top of the console log I see this error message

[36m[21:53:03][0m [31m[ASSERT][0m [35m[orxConfig.c:orxConfig_PushSection(5347)][0m [41m[37m[5mFAILED ASSERTION [orxFLAG_TEST(sstConfig.u32Flags, orxCONFIG_KU32_STATIC_FLAG_READY)][0m

When I update to the latest build it crashes with the same console log message and this stack trace

`0 0x0000000101057ff4 in _orxDebug_Break at /Users/orsonbushnell/Development/orx/code/src/debug/orxDebug.c:452

1 0x0000000101041556 in orxConfig_PushSection at /Users/orsonbushnell/Development/orx/code/src/core/orxConfig.c:5455

2 0x0000000100fe607a in -[orxView CreateBuffers] at /Users/orsonbushnell/Development/orx/code/plugins/Display/iOS/orxDisplay.m:817

3 0x0000000100fe47be in -[orxView initWithFrame:] at /Users/orsonbushnell/Development/orx/code/plugins/Display/iOS/orxDisplay.m:633

4 0x0000000100fe323c in -[orxViewController loadView] at /Users/orsonbushnell/Development/orx/code/plugins/Display/iOS/orxDisplay.m:435`

Can anyone tell me how to build for iOS?

Comments

  • According to this message, it looks like the config module hasn't been initialized (that would be the assertion you mentioned at the top).

    Does it happen with the simulator version as well or only with the device?

    I can test the simulator on my side but unfortunately I do not own any iOS device at the moment.

    As a side note, I'd recommend using the latest version from the git repository as 1.11 is 1 year old by now (release versions are only yearly snapshot of the master branch, one isn't more stable than the other).

  • I tried both the 1.11 version that I started with and the latest master branch. The crash log is from the master branch in the simulator.

  • Ah good to know, I'll have a look in the coming days then and will let you know what I find.
  • edited April 2021

    I made a fix attempt. It seems this iOS-only issue was introduced 1.5 years ago.

    Please sync the latest from the git repo and lemme know if it works for you.

  • It works when I build with Xcode 11, but not Xcode 12.4. Since Apple only accepts Xcode 12 builds, this is still a problem.

    The build fails with "Library not found for -lstdc++" and the warning "libstdc++ is deprecated; move to libc++ with a minimum deployment target of iOS 7"

    Changing the minimum deployment target to iOS 9, the minimum allowed by Xcode 12, and trying to change to libc++ I get an error linking libwebp "liborxd.a(libwebpdecode_la-webp.o), building for iOS Simulator, but linking in object file built for iOS, for architecture arm64".

    I tried to rebuild libwebp but couldn't figure out the settings for iOS builds.

  • edited April 2021

    I stumbled upon this issue last week as well an a M1 Mac.

    Until now, we've been using (like many people out there), fat binaries that would support both simulator and device libraries inside a single file.
    That was easy as arm7/arm8 were the device architectures and x86/x86_64 were the simulator ones.
    That is not the case anymore with the new generation of Mac computers: arm is now used for both the iOS device and the simulator.

    Apparently they've introduced a new framework structure called XCFramework to work around this limitation.

    I haven't looked too much into it yet, but I guess we'll have to bite the bullet at some point and migrate all the external dependencies to this format as well as orx itself.

    I gathered a couple of links on the subject that I need to read in details:

    Until then, regarding libwebpdecoder, you have a few options:

    • upgrade the iosbuild.sh script manually to use the correct combination of architectures/parameters
    • get a newer version of the library, which hopefully will come with an upgraded build script as well (we're using a vanilla version of libwebpdecoder in orx)
    • temporarily remove libwebpdecoder from orx (there's a single include line in orxDisplay.m + the link reference to the library itself in the XCode project)

    However I'm afraid you'll likely face the same issue with other external dependencies, as none of them have been compiled with the combination of arm/simulator.

    I can look into that soon-ish, but it's probably going to take a couple of weeks at the very least.

    Please note that I might be missing some obvious details as I'm not very familiar with the Mac development environment. (and the less time I spend with XCode the better I feel! ;) )

  • edited May 2021

    Hey @orsonb, I prepared a pre-release branch on git, named b-release, for the annual orx release, including the latest optimizations and fixes.

    Do you think you could give it a try on iOS, by any chance? Still only with XCode 11, I'll work on the XCode 12/XCFramework post-release.

    Thanks in advance!

  • I just saw your comment this weekend. I tested it again. It still fails in the simulator.
    I started a pull request with some minor config changes needed to run the test app. https://github.com/orx/orx/pull/64

Sign In or Register to comment.