Thursday, April 12, 2012

Solution: armv7 validation errors when submitting FireMonkey iOS apps to the AppStore

EDIT: This post is now outdated. HotFix 1 addresses this issue, and these steps are no longer needed!

I was trying to record the process of submitting an app last Friday. My EDN app was ready for the AppStore. I ran into this:

iPhone/iPod Touch: application executable is missing a required architecture.
At least one of the following architecture(s) must be present: armv7

This happens on the validation step of submitting an app to the AppStore. The reason is that the validation step for AppStore submissions has changed. Support for *only* armv6 is no longer allowed. You have to support armv7, either by itself or have dual support (armv6 and armv7). This is a recent change, since I was able to submit my previous Analog Clock app in late October last year.

I've spent much of the last week trying to solve this problem. I did a bunch of research, but there was no single magic bullet anywhere. I finally cracked it. And here is the solution. I apologize in advance if some steps are missing. I tried to capture every single step I had to take.

STEP 1: Rebuilding iPhoneAll for armv7


Phil Hess has an excellent page that explains this process - http://web.me.com/macpgmr/ObjP/Xcode4/iOS_5_Parsing_Status.html

You don't actually need to parse anything for this purpose. You can jump directly to Phil's Step 4 and build iPhoneAll for armv6/armv7 as follows:

./compile-arm.sh iPhoneAll.pas

Then Phil's Step 5 from the link above (this moves the compiled targets in place):
mv iPhoneAll.o /usr/local/lib/fpc/2.6.0/units/arm-darwin/cocoaint/
mv iPhoneAll.ppu /usr/local/lib/fpc/2.6.0/units/arm-darwin/cocoaint/
mv AnonClassDefinitionsUikit.o /usr/local/lib/fpc/2.6.0/units/arm-darwin/cocoaint/
mv AnonClassDefinitionsUikit.ppu /usr/local/lib/fpc/2.6.0/units/arm-darwin/cocoaint/

STEP 2: Rebuilding the FPC RTL for armv7

We'll use the following link as a base line - http://wiki.freepascal.org/iPhone/iPod_development#Building_an_ARM_Cross-compiler

We need to modify the steps for iOS5.0 as follows:

Jump into Super User mode:

sudo bash

export IPHONEPLATFORMBASEDIR=/Developer/Platforms/iPhoneOS.platform/Developer

make clean

make FPC=/usr/local/lib/fpc/2.6.0/ppc386 CPU_TARGET=arm CROSSOPT="-FD${IPHONEPLATFORMBASEDIR}/usr/bin -XR${IPHONEPLATFORMBASEDIR}/SDKs/iPhoneOS5.0.sdk/ -ap -Cparmv7 -Cfvfpv3" all

sudo make FPC=`pwd`/compiler/ppcrossarm OPT="-ap" CPU_TARGET=arm CROSSOPT="-FD${IPHONEPLATFORMBASEDIR}/usr/bin -XR${IPHONEPLATFORMBASEDIR}/SDKs/iPhoneOS5.0.sdk/ -ap" install CROSSINSTALL=1

sudo ln -sf ../lib/fpc/2.5.1/ppcrossarm /usr/local/bin/ppcarm

STEP 3. Modify the Run Script for project under Build Phases for your Target in Xcode

Replace the -Cfvfpv2 flag with both of these flags -Cparmv7 -Cfvfpv3. A typical excerpt from the Run Script will now say:

/usr/local/lib/fpc/2.6.0/ppcrossarm -gw -g -godwarfsets -Xg -O1 -Cparmv7 -Cfvfpv3 -MDelphi -B -o$BUILT_PRODUCTS_DIR/$EXECUTABLE_PATH -Fu/usr/local/lib/fpc/2.6.0/units/arm-darwin/fmi -Fu/Developer/Embarcadero/fmi -Fu/Developer/Embarcadero/fmi/coretext -Fu/Developer/Embarcadero/fmi/fpclib -XR$SDKROOT -FD$PLATFORM_DEVELOPER_BIN_DIR "$PROJECT_DIR/../$PROJECT.pas"

Drop armv6 from Architectures under Build Settings for your Project if it's set.

Good luck!

58 comments:

  1. Ouch, these instructions start to look like the kind of hackery that you needed to do certain delphi.net things.

    What i mean is that i get the feeling that if i want to do ios development, that even for an experienced Delphi guy, using Delphi has a steeper learning curve and a lower chance of success than by just using the tools that are supplied by the creator of the platform.

    As a Delphi developer it was faster to get going with visual studio if youmwanted to do dotnet. Right now i think it's faster to get into xcode and objective-c if you want to do ios stuff.

    ReplyDelete
  2. @Wouter: It wasn't this hard until the AppStore submission requirements changed. Remember, I submitted my previous app with no problems whatsoever. Anyone who wants a solution this instant can use my steps in this post. For the experienced developer it takes about 15-30 minutes to run through my solution. I will work with R&D and QA to make sure that this becomes a lot easier in the future.

    ReplyDelete
  3. Sorry, i forgot to add that i am thankful that you've posted this solution.

    The average delphi developer wouldn't be able to figure this out, so until there is an updated delphi that deals with this, this page is a valuable resource.

    ReplyDelete
  4. @Wouter: No worries. Thank you!

    ReplyDelete
  5. To avoid this from being like Delphi.NET it needs to be in the next minor update. We buy products to have platforms supported well, not always breaking otherwise it make more sense to stay with the native tools for the platform.

    ReplyDelete
  6. @Robert: You're right, and it will be ASAP. Again, we didn't break it. The rules changed mid-stream. We're addressing it.

    ReplyDelete
  7. "The rules changed mid-stream." This change occurred months ago, long before your Update 4. And it was reported on the Delphi forum this winter at least a couple times.

    ReplyDelete
  8. @Phil: "mid-stream" in this case means between major versions. The change happened after XE2 was released. Do you have links to the issues reported on our forums this winter? When I ran into the issue this last Friday, I couldn't find any reports going back earlier than late February. I think that's about Update 4 time frame, but I could be wrong. I didn't double check any dates. I know of zero bug reports filed on this issue other than mine. Personally, I'm just happy that I ran into the problem, found a fix, and that I'm working with QA and R&D to get a rapid fix out ASAP.

    ReplyDelete
  9. @Phil: BTW, If I haven't already stated so, I'm very grateful for all your awesome work, web pages and support. Without your pages and posts I would still be looking for a solution.

    ReplyDelete
  10. Here's a report from Nov., although I think back then simply setting the iOS deployment target to less than 5.0 allowed an armv6-only app to validate okay.

    https://forums.embarcadero.com/thread.jspa?threadID=63444

    It's not difficult to create a universal app so you can still target armv6 devices. Here's the settings and script that the Pascal templates for Xcode 4.2 have used since armv7 support was added to FPC 2.6RC1 last fall. The lines at the top are User-Defined settings from the bottom of Xcode's Build Settings tab, where they can easily be modified by the user. The script then draws on these settings.

    http://web.me.com/macpgmr/ObjP/Xcode4/ios_xcode_settings.txt

    Of course, all units an app uses would need to have universal object files (.o) as well, but that's not hard to do - and FPC 2.6.0 already installs universal .o files for all RTL units.

    ReplyDelete
  11. @Phil: Yes, that issue was solved by simply including armv6, and since we never built armv7 it was probably not looked at until it became an issue (when the AppStore requirements changed). Part of the issue of course is that we don't do armv7 (yet). Our installer only does armv6 right now. That of course will change very shortly. What I can't tell you right now is if we will do armv7 only, or both. As you say, it's not difficult, and I will forward all your comments to the R&D team. Until a fix is released, people can use my blog post and get it done - it's not a pretty or easy-to-understand work-around for most, but it does work.

    As always, very much appreciated Phil!

    ReplyDelete
  12. Hello Anders! I ran into the same error some time ago. Solved it by changing deployment target (on Xcode) to 4.0 instead of 5.0. It works like a charm.

    ReplyDelete
  13. I tried that. It may not have worked since I only have iOS5.x installed.

    ReplyDelete
  14. Hello,
    I run into the same problem when I wanted to upload my first application - and luckily found this description. Thanks.

    However: When trying to call the "make" command in step 2 after "make clean", I only get the result:
    *** No rule to make target `all'. Stop.
    Seems, I am in the wrong directory - but which is the correct one?
    Which makefile to I have to call?

    ReplyDelete
  15. me too.
    result:No rule to make target 'clean'

    ReplyDelete
  16. Did you guys follow the steps on the pages I linked to? You need to make sure you read and follow the steps (as modified) on http://wiki.freepascal.org/iPhone/iPod_development#Building_an_ARM_Cross-compiler - specifically sub-step 2 on this page.

    ReplyDelete
  17. @Markus: I didn't modify the FPC installation in any way. I used it as is from the XE2 Update 4 install. Are you sure you're going to the right directories and firing off the make commands? Be sure to follow all instructions in all linked pages.

    Note: An update that addresses this is coming soon, so if you don't want to deal with this issue for right now, just hold on a bit for the update, and all will be well again.

    ReplyDelete
  18. Hi to all,

    I'm creating DLL in XE2, and use it in DELPHI 2007, i pass some parameter.
    (e.g,., passing the string 'Hello DLL' in 2007, and displays that message using showmessage(str) in XE2 ).
    But it doesn't work, it displays some text in some other language. My doubt is, it is possible to use XE2 's DLL in Delphi 2007??

    ReplyDelete
  19. @Raj: Delphi 2007 is non-Unicode, and XE2 is Unicode. Delphi 2007 uses AnsiString, and XE2 uses UnicodeString. If you're going to use a DLL with another product you have to watch your data types. In this case it's probably as simple as declaring the strings you pass in/out of the DLL as AnsiString in XE2.

    ReplyDelete
  20. @Anders: Thanks for the information. I will wait for the update. Is there an estimated release date?
    I will use the time for some more FM hacking (multi touch, sound, IOs events, memory leaks, etc. ;)

    ReplyDelete
  21. "An update that addresses this is coming soon, so if you don’t want to deal with this issue for right now, just hold on a bit for the update, and all will be well again"

    how long is a "bit" ? I am waiting

    ReplyDelete
  22. @Anders: I have fallen into the same problem when I validate my firemonkey IOS app. I follewed your introduction. but when I met the step2 for made command, there was a wrong : result:No rule to make target ‘clean’, please detailed the step 2 for poor free pascal men. In addition, I installed xcode4.3.2 after xcode4.2.1, so there is no directory of /developer/. I'm in trouble, please help me ! thanks a lots.

    ReplyDelete
  23. @jiang: The Xcode 4.3.2 installer is bad in that it *DELETES* the entire /Developer directory including whatever you put in there. Not like a Windows uninstaller. You will at the very least have to install the command line tools for Xcode. You can do that from the Xcode menus and go to the Downloads section. You will then have to install FPC 2.6.0 and FMI again. If that still fails for whatever reason you probably have to download and reinstall Xcode 4.2.1 (followed by FPC 2.6.0 and FMI again).

    ReplyDelete
  24. Anders@: I have several questions while following,
    first, in step 1, should I have to parse the iphoneall, or I can't compile the iphoneall. I do something above with some warning, is it right?

    second, in step 2, when I change to \application\embarcadero\fpc\, then, the "make clean" command works with many messages in terminal. am I correct?

    after I've done all of thing, I go to Xcode for Archiving , but failed there is "ld, no symbol can be found : Armv7", It mad me. who can save me? hope for helps. thanks!!!

    ReplyDelete
  25. @Anders: in recent days, I have tried my best to solve the problem by following your instruction again and again, but failed, then I checked the results of build for archiving in xcode. I found the fatal errors show that "the anonclassdefinitionsUikits is only for Armv6 not support for Armv7". It means I got a wrong in my following the step1. but I have done this work very carefully, I don't know where the mistakes happened. I need your great help. please share the four file (AnonClassDefinitionsUikit.o,AnonClassDefinitionsUikit.ppu, iphoneall.o, iphoneall.ppu) or mail them to me (email: mprjcf@acca.com.cn). thank you very much much much!!!!

    ReplyDelete
  26. @Anders: I'am still failed, the problem is still there . I have indeed followed your guides for tens of time. but I got nothing, very,very, very disappointed!!! God did not help me!!!

    ReplyDelete
  27. @jiang: As my latest email said, this article is now obsolete. Install HotFix 1 and you'll be all good.

    ReplyDelete
  28. Hi to all,
    It is possible to pass method pointers (Procedural Types) from exe to dll???

    ReplyDelete
  29. Thanks for the good writeup. It if truth be told used to be a leisure account it. Glance complex to more added agreeable from you! However, how could we keep up a correspondence?

    ReplyDelete
  30. I find myself it is one of several a lot substantial data for me. Exactly what pleased learning a person's content. Nonetheless wanna discourse for very few staple items, The web page fashion is ideal, a articles really is wonderful : Debbie. Exceptional process, all the best

    ReplyDelete
  31. I will immediately seize your rss feed as I can not to find your e-mail subscription link or newsletter service. Do you have any? Kindly permit me recognize in order that I could subscribe. Thanks.

    ReplyDelete
  32. An individual necessarily lend a hand to make critically posts I would declare. That's the very first time I personally frequented your site site as well as here? My spouse and i impressed with all the study you made to build this unique post incredible. Superb pastime!

    ReplyDelete
  33. 9eo0MI This is one awesome blog article.Much thanks again. Want more.

    ReplyDelete
  34. Great elements here. Now i'm pretty content to search a person's article. Thanks a lot exactly what looking ahead to contact people. Might you please decrease me a e-mail?

    ReplyDelete
  35. Thanks for the good writeup. It actually was a enjoyment account it. Glance complicated to more introduced agreeable from you! By the way, how could we be in contact?

    ReplyDelete
  36. I really don't possibly know the way I ended up the following, however i considered this kind of submit once was excellent. I can't identify exactly who you are on the other hand absolutely you are likely to a well-known doodlekit should you are not by now.. Rival Knights Cheat Best wishes!

    ReplyDelete
  37. When you depress the button located at the two 'clock position, the full face of the watch is flooded with light and for three seconds.
    usb cable wholesale http://mymarriagestore.com/wp-content/publish/cheap-usb-cable-usb-cable-wholesale.html

    ReplyDelete
  38. I had been indicated your blog by way of my step-brother. I'm do not specific whether or not this upload is actually written by technique for him because nobody recognize such specified about my own problems.. business rules management indonesia You will be remarkable! Thank you!

    ReplyDelete
  39. Admin: If you sell advertising on your website don't use Adsense. They take 32% commission. Use www.adsales.ninja they have much lower commission and doubled my website revenue. Much, much better than Adsense.

    ReplyDelete
  40. What happens to files when my wordpress space upgrade expires?

    ReplyDelete
  41. How can I install WordPress without losing all the indexed html pages?

    ReplyDelete
  42. I'm in high school and starting next year I will have to start looking at colleges. I know I want to find a college just for creative writing. I love writing stories of all sorts, and I know of a couple colleges that specialize in creative writing. But where would you recommend? Remember, I'm talking about creative writing, not journalism. Any suggestions?.

    ReplyDelete
  43. I don't really like livejournal or xanga. I already have both of those. I was going to try deadjournal because I read on here that it was really good, but I don't want to have to pay for it and you have to have an invite code to get in free. Does anybody have an invite code they could give me, or a suggestion on another free blogging website I could try? Any information would be helpful..

    ReplyDelete
  44. The Hacker’s Corner » Blog Archive » Solution: armv7 validation errors when submitting FireMonkey iOS apps to the AppStore
    andvehjmb
    ndvehjmb http://www.g02x3731f22xp1f7oiq0oz5k5r985sxds.org/
    [url=http://www.g02x3731f22xp1f7oiq0oz5k5r985sxds.org/]undvehjmb[/url]

    ReplyDelete
  45. The Hacker’s Corner » Blog Archive » Solution: armv7 validation errors when submitting FireMonkey iOS apps to the AppStore
    [url=http://www.g3618afmgy16ouv409avz19ys85330pqs.org/]uhyzixildm[/url]
    hyzixildm http://www.g3618afmgy16ouv409avz19ys85330pqs.org/
    ahyzixildm

    ReplyDelete
  46. The Hacker’s Corner » Blog Archive » Solution: armv7 validation errors when submitting FireMonkey iOS apps to the AppStore
    [url=http://www.gqf6542sv459arb4n43m6h7ip62n46mxs.org/]uvjhtpjzznw[/url]
    vjhtpjzznw http://www.gqf6542sv459arb4n43m6h7ip62n46mxs.org/
    avjhtpjzznw

    ReplyDelete
  47. どんなに場合、事したがっていくつかのいずれかが彼の不可欠を検索し、彼/彼女が詳細にその利用できるようにするために、したがってそのことは、こちらに維持されています。
    一部予約販売 楽ギフ_包装 http://theukapwa.co.uk

    ReplyDelete
  48. Free Piano...

    I was very pleased to find this website.I wanted to thank you for this great read!! I definitely enjoying every little bit of it and I have you super bookmarked to check out new stuff you post. Just found an super site Free Laptops HOT Links!...

    ReplyDelete
  49. Good day! I know this is kinda off topic but I was wondering if you knew where I could get a captcha plugin for my comment form? I'm using the same blog platform as yours and I'm having problems finding one? Thanks a lot!|

    ReplyDelete
  50. My relatives always say that I am killing my time here at net, but I know I am getting familiarity daily by reading such fastidious articles or reviews.|

    ReplyDelete
  51. Hi colleagues, its enormous article regarding educationand completely defined, keep it up all the time.|

    ReplyDelete
  52. I was suggested this blog via my cousin. I
    am now not sute whether this put upp is weitten by means of him
    aas nobody else recognize such distinct approximateky my
    trouble. You are wonderful! Thank you!

    ReplyDelete
  53. My brother suggested I might like this website. He was totally right.
    This post actually made my day. You can not imagine simply how
    much time I hhad spent for this info! Thanks!

    ReplyDelete
  54. I was wonering iff you ever thought of changing the structure of your blog?

    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of content so prople could connect with it better.
    Youve got aan awful lot of text for only having 1 orr twwo images.
    Maybe yoou could space it out better?

    my blog; marketing

    ReplyDelete

Note: Only a member of this blog may post a comment.