Saturday, January 24, 2015

[AIR] How to build ANE 64-bit

How to build ANE 64-bit


Or try doing thing backward here ;)

  1. Open your Mac.
  2. Open Facebook check it fast and close it!
  3. Make sure Adobe AIR SDK is update to most recent by brew it. (or install if you don't have one)
  4. $ brew upgrade adobe-air-sdk
  5. Make sure AIR SDK path is set.
    $ export AIR_HOME=/usr/local/Cellar/adobe-air-sdk/
  6. Clone my working ANE 64-bit ready
  7. Go to /ane-device-file-util/as3/bin
    $ cd /ane-device-file-util/as3/bin
    $ bash
  8. Open your Twitter, tweet something and close it!
  9. Smile!
  10. That's it! 
You just build ANE from working static library "libDeviceFileUtil.a", now let's try make one your own! Follow this step below...
  1. open my /ane-device-file-util/xcode/DeviceFileUtil.xcodeproj
  2. Target iOS Device just in case
  3. Product -> Archive
  4. You should see "libDeviceFileUtil.a" as link to library in /ane-device-file-util/as3/bin
  5. Right click on it and select "Show Original"
  6. copy real "libDeviceFileUtil.a" which landing somewhere like this
    to (Yes replace it)
  7. Make sure our .a is 64-bit
    $ xcrun -sdk iphoneos lipo -info libPhotosAlbum.a
    you should see some clang warning and finally at last line...
    Architectures in the fat file: libPhotosAlbum.a are: armv7 arm64 
  8. Now run again everything should be fine.
  9. Open your Twitter, tweet for your success and close it!
  10. Click ads on this page.
  11. Gotcha! Thanks.
You just build static library and ANE! great job!, now let's check it working!
  1. Use ANE like usual
  2. Build your ipa e.g. Main.ipa
  3. Unzip to somewhere e.g. "/Main"
  4. Now run this in terminal
    $ lipo Main/Payload/ -info
    You should see
    Architectures in the fat file: Main/Payload/ are: armv7 arm64 
  5. Or try this for fun
    $ file Main/Payload/
    Will get
    Main/Payload/ Mach-O universal binary with 2 architectures
    Main/Payload/ (for architecture armv7):    Mach-O executable arm
    Main/Payload/ (for architecture arm64):    Mach-O 64-bit executable
  6. That's it!
This backward technique is usually use by me! LOL, I love to hack from working one when learning something and tear them apart more than build from scratch. ;)

Troubleshooting, If you see this
Error: Apple App Store allows only universal applications. "libDeviceFileUtil.a" is not a universal binary. Please change build settings in Xcode project to "Standard Architecture" to create universal library/framework.

It's mean "your-cool-lib.a" is not 64-bit yet, try setup Architecture like picture above.

Happy 64-bit! :D

No comments: