Compiling programs for iOS

I got SDL compiled for iOS and the template, I copied the template and all my project files to the same directory, added my source files to the template(fixed all the errors from using fpermissive) and now when I get it to compiling it breaks when it tries to link. Every SDL function I use is listed(I also use SDL_image and SDL_ttf) as being unresolved. I checked and they are all listed as trying to link. I’ve tried compiling with only certain target architectures and that doesn’t seem to help anything. Any ideas on what I’ve done wrong to get it to fail?

Here is the warning I’m getting from it

ld: warning: ld: warning: ignoring file /Users/devon/Downloads/SDL iOS Application/SDL/lib/libSDL.a, missing required architecture i386 in file /Users/devon/Downloads/SDL iOS Application/SDL/lib/libSDL.a (2 slices)ignoring file /Users/devon/Downloads/SDL iOS Application/SDL/lib/libSDL_image.a, missing required architecture i386 in file /Users/devon/Downloads/SDL iOS Application/SDL/lib/libSDL_image.a (2 slices)

I checked and added the i386 target to each of them and recompiled and it still isn’t changed

Hi,

What’s the output of running ‘file’ on the static libraries? This’ll confirm what architecture the libraries are compiled for…

Are you trying to build the app for iPhone Simulator or the actual hardware? For iPhone Simulator, you need i386 architecture libs, or for the actual hardware, either armv7 or armv7s. (Also, make sure that the SDK is set correctly – either iphoneos or iphonesimulator depending).

Cheers,
Jeffrey Carpenter
<@Jeffrey_Carpenter>On 2014/09/ 21, at 11:34, ruler501 <d.ruler501 at gmail.com> wrote:

I got SDL compiled for iOS and the template, I copied the template and all my project files to the same directory, added my source files to the template(fixed all the errors from using fpermissive) and now when I get it to compiling it breaks when it tries to link. Every SDL function I use is listed(I also use SDL_image and SDL_ttf) as being unresolved. I checked and they are all listed as trying to link. I’ve tried compiling with only certain target architectures and that doesn’t seem to help anything. Any ideas on what I’ve done wrong to get it to fail?

Here is the warning I’m getting from it

ld: warning: ld: warning: ignoring file /Users/devon/Downloads/SDL iOS Application/SDL/lib/libSDL.a, missing required architecture i386 in file /Users/devon/Downloads/SDL iOS Application/SDL/lib/libSDL.a (2 slices)ignoring file /Users/devon/Downloads/SDL iOS Application/SDL/lib/libSDL_image.a, missing required architecture i386 in file /Users/devon/Downloads/SDL iOS Application/SDL/lib/libSDL_image.a (2 slices)

I checked and added the i386 target to each of them and recompiled and it still isn’t changed


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

I want to build for the actual hardware, lipo -info on the files gives me arvm7, arm64 and armv7s.

My Architectures in my Xcode project are armv7 arm64 armv7s
The Valid Architectures are the same. I’m not sure why it is trying to build for i386

Hmm, that is strange, your info appears to me to be correct! Xcode can seem to have a mind of its own … you are sure you have ‘iOS Device’ selected as the target? Although it’s been an awful while since I’ve played around with it, forgetting about the build target seems to be what gets me most of the time …

Cheers,
Jeffrey Carpenter
<@Jeffrey_Carpenter>On 2014/09/ 21, at 12:01, ruler501 <d.ruler501 at gmail.com> wrote:

I want to build for the actual hardware, lipo -info on the files gives me arvm7, arm64 and armv7s.

My Architectures in my Xcode project are armv7 arm64 armv7s
The Valid Architectures are the same. I’m not sure why it is trying to build for i386


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

Actually looking closer it is only all 3 for SDL_Image
for SDL_ttf it is x86_64 though I checked and it is supposed to be compiling for armv7 armv7s and arm64
for SDL itself it is all excect armv7s though that is enabled in the project file

How did you build the libraries? I had no luck with the official build script for SDL2 (build-scripts/iosbuild.sh), so I improvised and eventually got things working using my own build script [1]. Perhaps it’ll help you figure out your problem!

I never bothered with trying it through Xcode directly, as I was more comfortable with the command line … nor have I tried the template (I use a CMake build script, but hopefully that’s beside the point).

  1. SDL2 & Friends Build for iOS 7.1 · GitHub

I had

Cheers,
Jeffrey Carpenter
<@Jeffrey_Carpenter>On 2014/09/ 21, at 12:15, ruler501 <d.ruler501 at gmail.com> wrote:

Actually looking closer it is only all 3 for SDL_Image
for SDL_ttf it is x86_64 though I checked and it is supposed to be compiling for armv7 armv7s and arm64
for SDL itself it is all excect armv7s though that is enabled in the project file


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

That seems to have been the problem, and I can’t compile my actual app with that setting because I don’t have an iOS device to hook up yet. I’ll have to see if I can borrow someones iphone to test on.

Ah-ha, yeah that issue confused the living hell out of me my first time through! grins You need the actual device plugged in and visible to the OS before it will succeed.

Cheers,
Jeffrey Carpenter
<@Jeffrey_Carpenter>On 2014/09/ 21, at 12:26, ruler501 <d.ruler501 at gmail.com> wrote:

That seems to have been the problem, and I can’t compile my actual app with that setting because I don’t have an iOS device to hook up yet. I’ll have to see if I can borrow someones iphone to test on.


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