Recent

Author Topic: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?  (Read 6938 times)

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2497
    • havefunsoft.com
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #45 on: June 28, 2020, 07:14:47 am »
skalogryz, does that sound like you ?
Jonas is the man you're looking for to do work for FPC.
I don't think LCL will need much attention from my side.

I suggest funding this "one off" hardware is not the same as a monthly Patreon, need to hit that US$500 quite quickly, my guess is the programme will be over subscribed so we need to get in quickly. 
Apple requires to return the hardware once the "preview program" is over. And I feel too lazy to return the stuff back.
So I'd rather just wait for the official release of the hardware to the public, and then I can purchase it.
I don't feel a rush for myself to get ARM Mac at this moment.

Jonas is the one you might asking about funding ARM Mac.
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

AlanTheBeast

  • Jr. Member
  • **
  • Posts: 73
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #46 on: June 28, 2020, 08:21:33 pm »

Apple requires to return the hardware once the "preview program" is over. And I feel too lazy to return the stuff back.
So I'd rather just wait for the official release of the hardware to the public, and then I can purchase it.
I don't feel a rush for myself to get ARM Mac at this moment.

I seem to recall reading that after developers returned the dev kit hardware, Apple then sent them brand new Mac's gratis in exchange.

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 751
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #47 on: July 11, 2020, 11:54:34 am »
Since yesterday FPC supports targetting macOS-AArch64. Almost no changes were required: the code generation is identical to iOS-AArch64 and the macOS/Darwin-related stuff is identical to macOS/Darwin-x86-64. Most work was adding an iOS target to the compiler and make/fpmake machinery to be able to distinguish between the two AArch64 platforms.

ChrisR

  • Full Member
  • ***
  • Posts: 158
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #48 on: July 11, 2020, 12:43:09 pm »
Jonas, This is terrific news. Is support only in the development branch (3.3.1)? I wonder if we could have a 3.2.0a for Mac users, like the old 3.0.4. Alternatively, do you recommend Dmitry (and subsequent Mac developers) build Lazarus for Apple Silicon using the 3.3.1 branch?

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 751
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #49 on: July 11, 2020, 01:01:03 pm »
Jonas, This is terrific news. Is support only in the development branch (3.3.1)?
Yes.
Quote
I wonder if we could have a 3.2.0a for Mac users, like the old 3.0.4.
Not planned at this time. I do plan on looking into the feasibility of merging the support to the fixes_3_2 branch though.
Quote
Alternatively, do you recommend Dmitry (and subsequent Mac developers) build Lazarus for Apple Silicon using the 3.3.1 branch?
That's up to everyone to decide for themselves. I only use Lazarus as an IDE to edit the compiler. I have very little experience with developing Lazarus applications, and none at all with how well Lazarus works with FPC 3.3.1.

PascalDragon

  • Hero Member
  • *****
  • Posts: 1958
  • Compiler Developer
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #50 on: July 11, 2020, 02:45:51 pm »
Quote
I wonder if we could have a 3.2.0a for Mac users, like the old 3.0.4.
Not planned at this time. I do plan on looking into the feasibility of merging the support to the fixes_3_2 branch though.

The final ARM Macs are still some months away. Until then we might have a 3.2.2 and if Jonas considers it feasible to merge into 3.2.x then I'd say that support would be added there. For now interested developers that have access to the Transition Kits can simply use Trunk.

Igor Kokarev

  • Full Member
  • ***
  • Posts: 198
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #51 on: July 13, 2020, 11:38:02 am »
Jonas, thanks for the great news!

davidfjenkins

  • Newbie
  • Posts: 3
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #52 on: July 17, 2020, 08:23:19 pm »
Jonas,

I have a DTK / Apple Silicon mac mini.  I have built fpc & lazarus for x86_64 on it just fine.  I updated to fpc trunk and am now trying to build aarch64-darwin.  I am using the following command line:

make clean all CPU_TARGET=aarch64 OS_TARGET=darwin PP=/usr/local/bin/ppcx64-3.2.0 OPT="-Fl/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib"

I get a ppcrossa64 and rtl/units/aarch64-darwin/ directory with several .o files that lipo identifies as arm64.

However I don't get a full compile.  I get the following errors:

unxdeclh.inc(29,91) Error: Incompatible types: got "AnsiString" expected "Int64"
unxdeclh.inc(29,91) Error: Compile time expression: Wanted Boolean but got <erroneous type> at AND
unxdeclh.inc(29,91) Error: Compile time expression: Wanted Boolean but got <erroneous type> at IF or ELSEIF
unxdeclh.inc(37,91) Error: Incompatible types: got "AnsiString" expected "Int64"
unxdeclh.inc(37,91) Error: Compile time expression: Wanted Boolean but got <erroneous type> at AND
unxdeclh.inc(37,91) Error: Compile time expression: Wanted Boolean but got <erroneous type> at IF or ELSEIF

I am happy to work out some compiler bugs but I want to make sure that I am doing it right and the error isn't just user error.

Thanks
David


Jonas Maebe

  • Hero Member
  • *****
  • Posts: 751
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #53 on: July 17, 2020, 08:25:39 pm »
I just posted build instructions at https://wiki.freepascal.org/macOS_Big_Sur_changes_for_developers#ARM64.2FAArch64.2FAppleSilicon_Support

Barring any typos or copy/paste errors, that should work.

davidfjenkins

  • Newbie
  • Posts: 3
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #54 on: July 17, 2020, 09:00:24 pm »
Great write up.  Got it to build.  Thank you very much.

ChrisR

  • Full Member
  • ***
  • Posts: 158
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #55 on: July 19, 2020, 12:59:09 pm »
Jonas- Thanks not only for all your code, but also the clear documentation.

davidfjenkins

  • Newbie
  • Posts: 3
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #56 on: July 21, 2020, 02:16:25 am »
Many thanks from Scooter Software as well - both to Jonas and to all the folks that already had fpc arm64 in place. 

I ran the first iteration of our Cocoa based app natively on the DTK this afternoon: just a couple of days after starting work on it.   I had to comment out some code that had intel assembly asm sections but should be able to have the complete app running in just a few more days.

Much easier than we had expected. 

Cheers
David Jenkins

 

skalogryz

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2497
    • havefunsoft.com
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #57 on: July 21, 2020, 05:41:48 am »
I had to comment out some code that had intel assembly asm sections
What's the use of those i wonder! 
Patron Cocoa Widgetset development https://www.patreon.com/skalogryz

ChrisR

  • Full Member
  • ***
  • Posts: 158
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #58 on: July 21, 2020, 03:28:39 pm »
I also found porting code very easy. The known issues were all about disabling Intel-specific assembly (e.g. SSE2) which I had written myself. The unexpected issues were all related to compiler optimization. For other users, I would suggest making sure to develop your AArm64 projects with no optimization (Project/ProjectOptions menu, CompilerOptions/Compilation&Linking tab, "no optimization" checkbox selected). Once your project runs correctly, you can try turning on the optimization level and reporting the bugs to the compiler team. Florian has already fixed one of the bugs I detected. Similarly, while the IDE compiles, you can not yet compile the IDE with optimizations on - so I suggest going to Tools/ConfigureBuildLazarus menu item and making sure you do not have the "optimized IDE" selected (which will fail to compile as it uses optimization -O3). This is important if your project uses any packages that require the IDE to be recompiled. Beyond this tiny edge issue, things feel remarkably mature.
« Last Edit: July 21, 2020, 05:35:10 pm by ChrisR »

Igor Kokarev

  • Full Member
  • ***
  • Posts: 198
Re: Apple leaving Intel for ARM - how will it affect Lazarus/FPC/Cocoa?
« Reply #59 on: July 21, 2020, 04:30:32 pm »
Chris,

Great advice regarding optimizations option! I'll remember.

Do you know a way to check an executable file (my or others) for a target version? x86 or ARM?

 

TinyPortal © 2005-2018