Recent

Author Topic: Build 64bit in IDE  (Read 3241 times)

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Build 64bit in IDE
« on: May 12, 2018, 11:12:57 am »
Mac specific !
I have been happily testing  Cocoa in a Lazarus IDE built from the trunk. I use a carbon based IDE and select (in Project Options) -
Target CPU Family = x86_64
LCLWidgetType:= cocoa

However, I have just realised, despite that setting, and talk in the Messages Window about targeting x86_64 that I am, in fact, still building a 32bit app.

Code: [Select]
admins-MBP:Defines dbannon$ file project1
project1: Mach-O executable i386

So, I tried a lazbuild (show with lots of lines removed) -
Code: [Select]
../../laz-svn/lazbuild --pcp=~/.laz-svn -B --cpu="x86_64" --ws=cocoa --os="darwin" project1.lpi
Info: (lazarus) Execute Title="Compile Project, CPU: x86_64, Target: project1"
Info: (lazarus) Working Directory="/Users/dbannon/Desktop/Projects/Proj_SVN/Defines/"
Info: (lazarus) Executable="/usr/local/bin/ppc386"
Info: (lazarus) Param[0]="-B"
Info: (lazarus) Param[1]="-Tdarwin"
Info: (lazarus) Param[2]="-Px86_64"
......
Several promising 64bit lines but we are using the 32bit compiler.
Same thing with a switch to request the 64bit compiler and all good. I get a 64bit app and it does have some 64bit defines set in there.

And, surprised that I am requesting 64bit but only using (default) 32bit compiler ?   No auto selection of the 32bit compiler when targeting 64bit ?

I was definitely building 32bit Cocoa apps and, interestingly, I have no 32bit Cocoa units (and obviously, no 64 Carbon units) -

Code: [Select]
admins-MBP:Defines dbannon$ ls -l ../../laz-svn/units/i386-darwin/
total 0
drwxr-xr-x  880 dbannon  staff  29920  9 May 10:38 carbon
drwxr-xr-x  115 dbannon  staff   3910  8 May 21:27 nogui
admins-MBP:Defines dbannon$ ls -l ../../laz-svn/units/x86_64-darwin/
total 0
drwxr-xr-x  879 dbannon  staff  29886 16 Sep  2017 cocoa
drwxr-xr-x    4 dbannon  staff    136 23 Apr 20:46 nogui

Davo
« Last Edit: May 12, 2018, 11:17:54 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: Build 64bit in IDE
« Reply #1 on: May 12, 2018, 11:31:43 am »
Set the compiler executable name to "fpc" instead of to "ppc386" in Tools -> Options -> Files. The "fpc" binary is the compiler driver and will select the appropriate compiler binary (ppc386, ppcx64, ppcarm, ...) depending on the cpu target specified in your project.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Build 64bit in IDE
« Reply #2 on: May 12, 2018, 11:42:03 am »
Said a very knowledgeable Jonas -
"Set the compiler executable name to "fpc" instead of to "ppc386" in Tools -> Options -> Files."

Ah, thats a good idea. I have (now) been setting it to ppx64. But just tested and, as you say, fpc auto works. I wonder why we even have ppc386 and ppcx64 ?

Thanks Jonas !
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Hansaplast

  • Hero Member
  • *****
  • Posts: 674
  • Tweaking4All.com
    • Tweaking4All
Re: Build 64bit in IDE
« Reply #3 on: May 12, 2018, 11:42:32 am »
That's what I do as well.


Keep in mind; when rebuilding the IDE (Carbon) you'll need to set it back to "ppc386" otherwise it will fail rebuilding.
In that case I get errors when it tries to compile CarbonProc.
The errors start with:


Code: Pascal  [Select][+][-]
  1. carbonproc.pp(563,13) Error: Identifier not found "ATSUFindFontFromName"


Switching temporary to ppc386 will fix this and allow you to rebuild the IDE (for example when installing packages).
After rebuilding, go back to using fpc as the compiler.
Could of course be that my setup is not working properly ... (tips are appreciated)

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1058
Re: Build 64bit in IDE
« Reply #4 on: May 12, 2018, 11:49:00 am »
Said a very knowledgeable Jonas -
"Set the compiler executable name to "fpc" instead of to "ppc386" in Tools -> Options -> Files."

Ah, thats a good idea. I have (now) been setting it to ppx64. But just tested and, as you say, fpc auto works. I wonder why we even have ppc386 and ppcx64 ?

"fpc" is a so-called compiler driver, while ppc386 and ppcx64 are compilers. "fpc" calls ppc386 resp. ppcx64 when you set the target of your project to i386 resp. x86_64.

 

TinyPortal © 2005-2018