FMX/OS X tip: enabling compiler optimisations to avoid weird startup crashes

I wasn’t able to trace the precise change that did it, but at a certain point I had the peculiar problem of an OS X debug build crashing at startup, and hanging the IDE if I attempted to run it in the debugger. Switching to the ‘release’ build configuration allowed it to run, but when you’re working with a framework that is so, er, work-in-progress as FireMonkey, not being able to run an application in the debugger for a certain target platform is rather debilitating.

Seeking to investigate the problem, I created a copy of the project and progressively removed units until it ran properly again. This led to things getting even weirder though, since use of generic types in unit initialization clauses or class constructors was seemingly the straw that broke the camel’s back! However, I finally hit upon a solution, which was to enable compiler optimisations (the default is ‘off’ in the stock debug configurations). To do this, I went to Project|Options, chose the second node down (Delphi Compiler -> Compiling), ensured ‘Debug configuration – OS X platform’ was selected in the combo box at the top, then ticked the ‘Optimization’ box and finally clicked OK.

Notwithstanding this issue, overall I’d say remote debugging in XE2 and XE3 from a Windows guest to an OS X host is pretty smooth (if a bit bumpy once exceptions get raised), so don’t let this put you off…

Advertisements

5 thoughts on “FMX/OS X tip: enabling compiler optimisations to avoid weird startup crashes

  1. Let me get this straight… you’re saying “Don’t be put off by the fact that this shipping compiler includes a supported option which, if enabled, results in code that fails to run on a claimed, supported platform” (in a way that you were unable to identify and so cannot offer a way to avoid other than “don’t enable this option under these circumstances”).

    That’s what you’re saying ?

    Right about now, Embarcadero’s lawyers are thanking their lucky stars that software continues to evade the “Fitness for purpose” and “Merchantable quality” test applied to almost every other consumer product.

    And Embarcadero will no doubt continue to trumpet the commitment to and the achievement of improved “quality” in their products.

    • Well if this were the only issue with FMX, EMBT would be doing pretty well I’d say! Also, keep in mind I never tracked down the real cause, so maybe it was a configuration issue on the Mac side…

  2. Incrementing the build number helped instantly when I had this Problem. I never found when/why this happens.

    BTW Debugging from a Windows host to OSX guest with VMware is smooth too and feels much better for me 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s