Building FPC 3.3.1 on maOS 12.3 on a Mac Mini M1 lazarus / 33-macOS - Mac OS X ---------------------------------------------------------------------- carl_caulkett 路 2022-03-17 20:36 I'm using the page at https://wiki.freepascal.org/Installing_Lazarus_o n_macOS#Installing_from_source, in particular the section headed `FPC development version` to install FPC 3.3.1. The thing that concerns me is that the instructions to actually perform the make, `make distclean all FPC=/usr/local/lib/fpc/3.2.2/ppcx64 OS_TARGET=darwin CPU_TARGET=x86_64 OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/"` seems to refer to the old Intel architecture. Is there a change I can make to CPU_TARGET to make it target the ARM chip? ---------------------------------------------------------------------- Josh 路 2022-03-17 20:50 have you read this? it may help. https://wiki.freepascal.org/macOS_Big_Sur_changes_for_developers#ARM64 .2FAArch64.2FApple_Silicon_Support ---------------------------------------------------------------------- carl_caulkett 路 2022-03-17 20:50 Sorted, I think. I ran `fpcmake` which automatically generated the appropriate make file. I then issued the command `make distclean all FPC=/usr/local/lib/fpc/3.2.2/ppcx64 OS_TARGET=darwin CPU_TARGET=aarch64 OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/" Note the `CPU_TARGET=aarch64`. Seems to have done the trick. I've still to build and install Lazarus, but what can possibly go wrong now? 馃槈 ---------------------------------------------------------------------- carl_caulkett 路 2022-03-17 20:53 Quote from: josh on March 17, 2022, 09:50:08 pmhave you read this? it may help. https://wiki.freepascal.org/macOS_Big_Sur_changes_for_developers#ARM64 .2FAArch64.2FApple_Silicon_Support Thanks for that josh. It looks like my solution was partly right but maybe missed off some details. I'll retrace my steps and follow your link to the letter. Thanks, again! ---------------------------------------------------------------------- trev 路 2022-03-17 22:18 Quote from: carl_caulkett on March 17, 2022, 09:36:54 pmI'm using the page at https://wiki.freepascal.org/Installing_Lazarus_on_macOS#Instal ling_from_source, in particular the section headed `FPC development version` to install FPC 3.3.1. The thing that concerns me is that the instructions to actually perform the make, `make distclean all FPC=/usr/local/lib/fpc/3.2.2/ppcx64 OS_TARGET=darwin CPU_TARGET=x86_64 OPT="-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/"` seems to refer to the old Intel architecture. Is there a change I can make to CPU_TARGET to make it target the ARM chip? You missed the Note at the start of that section: QuoteNote: When building a native aarch64 Free Pascal Compiler (ppca64) for an Apple Silicon M1 processor Mac, change the CPU_TARGET in the instructions below from x86_64 (Intel 64 bit) to aarch64 (ARM 64 bit - Apple Silicon M1) and change any reference to ppcx64 to ppca64 ---------------------------------------------------------------------- carl_caulkett 路 2022-03-17 22:22 Quote from: trev on March 17, 2022, 11:18:07 pmYou missed the Note at the start of that section: QuoteNote: When building a native aarch64 Free Pascal Compiler (ppca64) for an Apple Silicon M1 processor Mac, change the CPU_TARGET in the instructions below from x86_64 (Intel 64 bit) to aarch64 (ARM 64 bit - Apple Silicon M1) and change any reference to ppcx64 to ppca64 Doh! In any case progress has ground to a halt because of ongoing problems at SourceForge 馃檨 ---------------------------------------------------------------------- carl_caulkett 路 2022-03-17 23:25 Quote from: carl_caulkett on March 17, 2022, 11:22:14 pmDoh! In any case progress has ground to a halt because of ongoing problems at SourceForge 馃檨 The SourceForge problem seems to have passed for now. The one remaining problem I have is that although I have the FPC 3.3.1 source downloaded in `~/fpc_main`, I still need to generate an RTL that is suitable for debugging Lazarus apps. I'm guessing that I need to find a way to combine the `.inc` files in `./rtl/aarch64` and the `.pp` files in`./rtl/macos`. I could try and do this manually, but I would much rather find an automatic process or some instructions for this, at least. Any clues? ---------------------------------------------------------------------- trev 路 2022-03-18 00:55 I believe that if you add OPT="-dDEBUG -glh -gw -godwarfsets -O-" to your FPC build command you will achieve your goal. You may be able to just rebuild the RTL but I've never tried. Let us know what happens :-) ---------------------------------------------------------------------- carl_caulkett 路 2022-03-18 13:36 Trying to follow your instructions, I changed the FPC build command from: Code: [Select]sudo make FPC=$PWD/ppca64 OPT="-ap -FD/Applications/Xcod e.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin - XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform /Developer/SDKs/MacOSX.sdk" install` to: Code: [Select]`sudo make FPC=$PWD/ppca64 OPT="-dDEBUG -glh -gw -godwarfsets -O-" Given that the command finished almost instantly and returned this... Code: [Select]Targets all Build a new compiler and all packages install Install newly build files zipinstall Create zip/tar of installed files singlezipinstall Alias for zipinstall ...I'm not convinced it worked! This really is the most frustrating thing, where you have to pick snippets of instructions from various places and just hope against hope that you have pieced it all together in the right order... 馃槨 ---------------------------------------------------------------------- carl_caulkett 路 2022-03-18 14:19 I tweaked things again and tried to combine the original instruction: Code: [Select]sudo make FPC=$PWD/ppca64 OPT="-ap -FD/Applications/Xcod e.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin - XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform /Developer/SDKs/MacOSX.sdk" install` with your modification of Code: [Select]OPT="-dDEBUG -glh -gw -godwarfsets -O-" resulting in... Code: [Select]make FPC=ppcx64 OPT="-ap -FD/Applications/Xcode.app/Cont ents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin -XR/Applica tions/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer /SDKs/MacOSX.sdk -dDEBUG -glh -gw -godwarfsets -O-" CPU_TARGET=aarch64 -j 4 FPMAKEOPT="-T 4" all The net result of all of this, along with a couple of other, entirely non-intuitive tweaks, appears to have resulted in a fully working setup. Thanks for your help, Josh and Trev! ---------------------------------------------------------------------- trev 路 2022-03-18 22:03 Quote from: carl_caulkett on March 18, 2022, 03:19:59 pmThe net result of all of this, along with a couple of other, entirely non-intuitive tweaks, appears to have resulted in a fully working setup. What were the other "non-intuitive tweaks"? It may help someone in future to know this. ---------------------------------------------------------------------- carl_caulkett 路 2022-03-19 00:30 When Lazarus started, it had these two errors highlighted. The FPC Sources one was fixed by my browsing to `~/fpc_main` where I had initially cloned the 3.3.1 source, while the one about the `fppkg.cfg` was fixed by my browsing to where the file had newly been created, in my case at `/Users/carlcaulkett/fpc_main/utils/fpcmkcfg/fppkg.cfg` ---------------------------------------------------------------------- trev 路 2022-03-19 05:15 Oh, those tweaks. Or, you can simply change the compiler and source code directories in the Lazarus Preferences> Environment - Files dialog. It's a bit easier when using multiple versions, but don't forget which version you've setup (says the voice of experience) !