Recent

Author Topic: [SOLVED] Config and target setting for MacOS 64 bit App  (Read 4107 times)

wittbo

  • Full Member
  • ***
  • Posts: 150
[SOLVED] Config and target setting for MacOS 64 bit App
« 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)?
« Last Edit: May 15, 2019, 02:57:56 pm by wittbo »
-wittbo-
MBAir with MacOS 10.14.6 / Lazarus 2.2.4
MacStudio with MacOS 13.0.1 / Lazarus 2.2.4

Trenatos

  • Hero Member
  • *****
  • Posts: 535
    • MarcusFernstrom.com
Re: Config and target setting for MacOS 64 bit App
« Reply #1 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)

lucamar

  • Hero Member
  • *****
  • Posts: 4219
Re: Config and target setting for MacOS 64 bit App
« Reply #2 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.
Turbo Pascal 3 CP/M - Amstrad PCW 8256 (512 KB !!!) :P
Lazarus/FPC 2.0.8/3.0.4 & 2.0.12/3.2.0 - 32/64 bits on:
(K|L|X)Ubuntu 12..18, Windows XP, 7, 10 and various DOSes.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8746
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Config and target setting for MacOS 64 bit App
« Reply #3 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.

han

  • Jr. Member
  • **
  • Posts: 96
Re: Config and target setting for MacOS 64 bit App
« Reply #4 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

wittbo

  • Full Member
  • ***
  • Posts: 150
Re: Config and target setting for MacOS 64 bit App
« Reply #5 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.
-wittbo-
MBAir with MacOS 10.14.6 / Lazarus 2.2.4
MacStudio with MacOS 13.0.1 / Lazarus 2.2.4

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: Config and target setting for MacOS 64 bit App
« Reply #6 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.

MobileDevGuy

  • Newbie
  • Posts: 5
Re: Config and target setting for MacOS 64 bit App
« Reply #7 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

Gizmo

  • Hero Member
  • *****
  • Posts: 831
Re: [SOLVED] Config and target setting for MacOS 64 bit App
« Reply #8 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. 
« Last Edit: July 28, 2019, 09:22:12 am by Gizmo »

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2020
  • Former Delphi 1-7, 10.2 user
Re: [SOLVED] Config and target setting for MacOS 64 bit App
« Reply #9 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

d-_-b

  • New Member
  • *
  • Posts: 43
Re: Config and target setting for MacOS 64 bit App
« Reply #10 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.
Code: Pascal  [Select][+][-]
  1. mov     ax,0013h
  2. int     10h
Denthor thanks for the vga programming tutorials | Download all tutorials

 

TinyPortal © 2005-2018