Sunday, April 15, 2012

Delphi Developer Days and Free Evening Events this week

I'm headed to Delphi Developer Days to do the Embarcadero keynote as well as a free evening event in each city - Washington DC (BWI area) and Chiacgo. Don't miss free food, drink and potentially valuable discounts at these events!

See you there!

Friday, April 13, 2012

Math parsing function/component anyone?

I'm looking for a reasonably light-weight, simple and fast math function parser. It should not be a DLL. I need it to work on Windows, MacOSX and iOS. I would use it in a demo I want to build.

It must be able to parse and evaluate functions of (at least) two variables, for instance f(x,y) = sin(x^2+y^2)/(x^2+y^2).

I would use it like this (pseudo code):
FuncTree := BuildEvalTree('f(x,y) = sin(x^2+y^2)/(x^2+y^2)'); // Or whatever it needs
for x := x_min to x_max do
for y := y_min to y_max do
z[x,y] := Evaluate(FuncTree,[x,y]); // Or whatever it needs...


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 -

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:

./ 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 -

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!