Lazarus

Programming => Operating Systems => macOS / Mac OS X => Topic started by: wittbo on March 06, 2019, 07:56:14 pm

Title: [SOLVED] Config and target setting for MacOS 64 bit App
Post by: wittbo on March 06, 2019, 07:56:14 pm
I'm just working with Lazarus on MacOS 10.14.3 Mojave and want to ensure, that I create a real 64 bit application. I found the necessary settings in project/settings/compiler/config and target. Actually all three fields contain <default>. As one can see, there is also possible:
OS            Darwin
CPU           X86_64
Processor   ATHLON64

What are really the correct settings?
And which settings are needed when compiling a 64bit application with Lazarus on MacOS 10.13 or earlier?

BTW:  What does it mean, when the option "Win32 GUI application is checked (default setting)?
Title: Re: Config and target setting for MacOS 64 bit App
Post by: Trenatos on March 11, 2019, 02:32:50 pm
Those are the right settings to create x64 applications.

You probably also want to make sure it's set to Cocoa or Carbon (Depend on your target. I do everything against Cocoa)
Title: Re: Config and target setting for MacOS 64 bit App
Post by: lucamar on March 11, 2019, 02:39:38 pm
BTW:  What does it mean, when the option "Win32 GUI application is checked (default setting)?

It is intended to compile an application as a GUI program vs. a console one and is only relevant when compiling a Windows application. In all other platforms it's ignored.
Title: Re: Config and target setting for MacOS 64 bit App
Post by: Leledumbo on March 12, 2019, 02:54:44 pm
It is intended to compile an application as a GUI program vs. a console one and is only relevant when compiling a Windows application. In all other platforms it's ignored.
But will still trigger compiler warning. In case you don't like, protect it between {$ifdef windows} ... {$endif} block. Well, that is if you use {$apptype gui} instead of -WG.
Title: Re: Config and target setting for MacOS 64 bit App
Post by: han on May 11, 2019, 05:08:26 pm
To create MacOS 64 executables, I also had to do the following:

Go to
TOOLS, OPTIONS, Compiler executable (eg FPC):

old
/usr/bin/ppc386

and change that to:
/usr/bin/fpc
Title: Re: Config and target setting for MacOS 64 bit App
Post by: wittbo on May 15, 2019, 02:57:28 pm
Thank you, han, for this important hint.
I myself found it some days ago. If you don't change the compiler executable, the application remains 32bit, whatever you may have set in the project settings.

I switched from 
old:   /usr/bin/ppc386   to
new: /usr/bin/ppcx64

and the application is really 64bit, checked by the MacOS process Manager.
Title: Re: Config and target setting for MacOS 64 bit App
Post by: trev on June 12, 2019, 03:43:25 am
To create MacOS 64 executables, I also had to do the following:

Go to
TOOLS, OPTIONS, Compiler executable (eg FPC):

old
/usr/bin/ppc386

and change that to:
/usr/bin/fpc

Thanks! I had same problem.
Title: Re: Config and target setting for MacOS 64 bit App
Post by: MobileDevGuy on July 27, 2019, 12:58:28 am
To create MacOS 64 executables, I also had to do the following:

Go to
TOOLS, OPTIONS, Compiler executable (eg FPC):

old
/usr/bin/ppc386

and change that to:
/usr/bin/fpc

Thank you! I could not figure out why i couldn't compile to 64 bit on macos.  this was it
Title: Re: [SOLVED] Config and target setting for MacOS 64 bit App
Post by: Gizmo on July 28, 2019, 09:08:44 am
I too have struggled over the months with OSX compiling. I found the compiler path hint above via a discreet line in one of the wiki pages (the page I now cannot find again...I can't remember how I found it in the first place but this is my point : it is not mentioned sufficiently enough, though I see it mentioned more in this forum now so word is spreading) some months ago but its such a subtle mention for something so significant. With OSX Catalina now in beta and out soon, all applications have to be 64-bit yet Lazarus is still configured for default 32-bit use on OSX.

I've spent a while with trying the Cocoa widget set, as Carbon is still the default which is a 32-bit widgetset. I found that building an application for Cocoa via the Project Options on my 64-bit Mac often caused conflicts with some of the packages, displaying compiler errors relating to 32-bit. So until recently I could only make a 32-bit version for my users, for OSX. Eventually, only by rebuilding the entire Lazarus IDE to use Cocoa (via the Configure Lazarus settings), setting the compiler path /usr/bin/fpc etc could I get these packages, and therefore my application, to cleanly compile as a 64-bit application which I am delighted about, but it hasn't been straight forward like it is on Windows.

It's wonderful that Lazarus allows such cross-platform development. For OSX systems, it would be great if we could get it a bit more stable out of the box, so to speak. Maybe its time to make the OSX version of Lazarus Cocoa by default, and the default compiler path in global settings set to /usr/bin/fpc? This would surely help of people new to Lazarus who want to try it out for OSX development. 
Title: Re: [SOLVED] Config and target setting for MacOS 64 bit App
Post by: trev on August 02, 2019, 08:18:49 am
Now that I'm using Lazarus "trunk", the compiler defaults to /usr/local/bin/fpc which appears to be a wrapper that calls the correct compiler version for 32 bit or 64 bit which is set in the Project > Project Options > Config and Target menu item.

I also compiled Lazarus (make clean LCL_PLATFORM=cocoa CPU_TARGET=x86_64 bigide) for Cocoa and not Carbon so it too is 64 bit.

I'm not sure about the upcoming Lazarus 2.04 version but you might want to reference this topic in the topic for it at https://forum.lazarus.freepascal.org/index.php/topic,46196.0.html
Title: Re: Config and target setting for MacOS 64 bit App
Post by: d-_-b on August 09, 2019, 04:35:51 pm
To create MacOS 64 executables, I also had to do the following:

Go to
TOOLS, OPTIONS, Compiler executable (eg FPC):

old
/usr/bin/ppc386

and change that to:
/usr/bin/fpc

 :D Thanks, was driving me crazy why laz-ide was using the i386 linker when I did set my Target CPU Family to x86_64!  I just installed fpc from the sf.net dmg packages so my fpc was located in /usr/local/bin/fpc.
TinyPortal © 2005-2018