Non-PIE Binary warning

#1

Although this issue was already commented in http://forum.openframeworks.cc/t/freetype-linking-error-w-0.062,-xcode-3.2.6,-ios4.3-device/5734/15
a new topic may be opened for this issue.

I’m now about to release a new app version and I received an email form the AppStore Team that I may consider to build with Position Independent Executable enabled.

PIE in wiki http://en.wikipedia.org/wiki/Position-independent-executable

We have discovered one or more issues with your recent delivery for “TOnOa Music”. Your delivery was successful, but you may wish to correct the following issues in your next delivery:

Non-PIE Binary - The executable ‘TOnOa.app’ is not a Position Independent Executable. Please ensure that your build settings are configured to create PIE executables.

If you would like to update your binary for this app, you can reject this binary from the Binary Details page in iTunes Connect. Note that rejecting your binary will remove your app from the review queue and the review process will start over from the beginning when you resubmit your binary.

If I understood well this is only an advice and the delivery was successful. But since i didn’t receive such a notification 1 month ago when I first launched the app, I guess in the future the AppStore Team could become more strict with this issue, since it is one important feature for code security together with sandboxing and code-singning.

Although I have all ‘Don’t Create Position Independent Executable’ flags checked to NO everywhere in build settings and even forced with LD_NO_PIE = NO in the *.xcconfig file, the PIE configuration get disabled in both debugging against the device and compiling the release binary.

ld: warning: ld: warning: ignoring file …/…/…/libs/glew/lib/osx/glew.a, file was built for archive which is not the architecture being linked (armv7): …/…/…/libs/glew/lib/osx/glew.aignoring file …/…/…/libs/FreeImage/lib/osx/freeimage.a, missing required architecture armv7 in file …/…/…/libs/FreeImage/lib/osx/freeimage.a (1 slices)

ld: warning: ignoring file …/…/…/libs/glu/lib/ios/glu.a, file was built for archive which is not the architecture being linked (armv7): …/…/…/libs/glu/lib/ios/glu.a
ld: warning: PIE disabled. Absolute addressing (perhaps -mdynamic-no-pic) not allowed in code signed PIE, but used in _FreeImage_GetMetadata from …/…/…/libs/FreeImage/lib/ios/freeimage.a(BitmapAccess.o-arm). To fix this warning, don’t compile with -mdynamic-no-pic or link with -Wl,-no_pie
ld: warning: 32-bit absolute address out of range (0x10033F33C max is 4GB): from _inflate_table + 0x00000674 (0x0018866C) to 0x10033F33C
ld: warning: 32-bit absolute address out of range (0x10033F37A max is 4GB): from _inflate_table + 0x00000670 (0x0018866C) to 0x10033F37A

Debugging against the iPhoneSimulator I just get a couple of link warnings.

ld: warning: ignoring file …/…/…/libs/FreeImage/lib/ios/freeimage.a, missing required architecture i386 in file …/…/…/libs/FreeImage/lib/ios/freeimage.a (2 slices)
ld: warning: ignoring file …/…/…/libs/glu/lib/ios/glu-ios.a, missing required architecture i386 in file …/…/…/libs/glu/lib/ios/glu-ios.a (2 slices)

I tried unsuccessfully the recommendations within these warnings and suspect that such an issue has to do partially with either OF code or its project settings. A couple of times I had to modify OF code to avoid opengl2 loading since it’s not currently working and then to configure audiounits to my purpose. But definitely it is not a stable way of deal with it. Since I have no clue to track this issue further I just post it to see if someone is able to. Some of us will be glad to hear that this is fixed in a further ofxiPhone release!

#2

Hello
I m having the same warning from apple after submission.Even after following apple recommendation:

In Xcode, select your target in the “Targets” section, then click the “Build Settings” tab to view its settings.
For iOS apps, set iOS Deployment Target to iOS 4.3 or later. For Mac apps, set OS X Deployment Target to OS X 10.7 or later.
Verify that Generate Position-Dependent Code is set at its default value of NO.
Verify that Don’t Create Position Independent Executables is set at its default value of NO.

https://developer.apple.com/library/ios/#qa/qa1788/-index.html#/apple-ref/doc/uid/DTS40013354

Did you found a solution?
did apple approved your app anyway?

On this unity forum http://forum.unity3d.com/threads/181518-Non-PIE-Binary-apple-send-this-email-to-me apparently it wasnt a cause of refusal

#3

Hi paulf, my app’s update was approved with no further objections :smiley:
This PIE issue was just a warning from the applestore team… a warning for the moment.

As I said it doesn’t matter whatever you check in “build settings”, it is disregarded somewhere and PIE is not created. I didn’t tried other things apart from that I mentioned. So not fixed yet.

#4

Hi, I just got the non-PIE warning while submitting an update too.

I followed all the instructions and changed the build settings for my project and the enclosed OF lib project to make it PIE, but then running the otool check (mentioned in the Apple link above) shows that the app is still non-PIE.

So, for me it suggests that we should rebuild the libs that OF uses to be PIE, if at all possible… FreeImage?

#5

I just got the same warning. I followed the procedures listed here:

Technical Q&A QA1788 - Building a Position Independent Executable:
https://developer.apple.com/library/ios/#qa/qa1788/-index.html#/apple-ref/doc/uid/DTS40013354

on both my project and the embedded iOS+OFLib.xcodeproj but no success

I’m still using 0.7.4, (and xcode 4.6.3) I haven’t tried the new one yet. Does anyone know if it works well with the new OF? Not a critical issue now, just trying to stay prepared for the future

#6

As far as I remember, we get exactly the same non-PIE warnings in OF0.8 too.

Which isn’t surprising, as I guess someone who knows what they’re doing - i.e. not me :wink: - has to rebuild the 3rd-party libraries that OF uses and set them to PIE.

#7

Yeah, all the libraries there would need to be rebuilt. I wonder if doing so would affect older iOS devices though?

#8

Ok, so, I had a go at rebuilding the FreeImage library and got it compiling to be PIE-compliant so that the linker warnings disappear. I also then ran the otool-check on the application binary and it returns with the PIE flag. So looks ok.

I’ll document what I did and link to the built library in a separate post: link