Hi.
Apologies if this is in the wrong sub-forum.
I have installed Lazarus and FPC on a 2021 M1 MacBook Pro following a variety of recipes.
I downloaded the 3 files from here:
https://sourceforge.net/projects/lazarus/files/Lazarus%20macOS%20x86-64/Lazarus%202.2.0/I used this to compile for ARM:
https://wiki.freepascal.org/macOS_Big_Sur_changes_for_developers#ARM64.2FAArch64.2FApple_Silicon_SupportWith the following notes:
1) Before following the instructions I had to cd to /usr/local/share/fpcsrc
2) I did not install Xcode but instead followed these instructions when issuing make commands:
Note: If you have only installed the standalone Command Line Tools and not the full Xcode package, you will need to replace /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin with /Library/Developer/CommandLineTools/usr/bin and /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk with /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
3) I needed to sudo every make command to ensure the necessary permissions were there create files/directories etc.
4) This command didn't create a viable link - I had to change the FPC version number to 3.2.2
sudo ln -sf /usr/local/lib/fpc/3.3.1/ppca64 /usr/local/bin
5) my .fpc.cfg file contained the references to the Command Line Tools (See 2 above) instead of the ones listed:
#include /etc/fpc.cfg
-FD/Library/Developer/CommandLineTools/usr/bin
-XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk
6) I started the Lazarus IDE and changed the compiler executable to the /usr/local/bin/ppca64 (although after doing so the stored path in the IDE was automatically changed to /usr/local/lib/fpc/3.3.1/ppca64
7) I changed the debugger in the IDE to the LLDB Debugger
I started the Lazarus IDE and created a new Console Application Project and modified it (just the main application loop is shown for brevity):
procedure TMyApplication.DoRun;
var
ErrorMsg: String;
begin
// quick check parameters
ErrorMsg:=CheckOptions('h', 'help');
if ErrorMsg<>'' then begin
ShowException(Exception.Create(ErrorMsg));
Terminate;
Exit;
end;
// parse parameters
if HasOption('h', 'help') then begin
WriteHelp;
Terminate;
Exit;
end;
{ add your program here }
writeln ('Hello World');
// stop program loop
Terminate;
Upon selecting Command R the application compiles but the IDE Reports an error: Oooops, the debugger entered the error state. Save your work now ! Hit Stop and hope the best, we're pulling the plug.
However, running the created executable, it does exactly what it says on the tine
steve:~/Lazarus/Hello World $ ./Hello_World
Hello World
I have selected both the Dwarf 2 with sets and the Dwarf 3 debugger options.
In order to see if this was something I had inadvertently done I created a new Form Module and tried to run it. The compiler generated this error:
Compile Project, CPU: aarch64, Target: /Users/steve/tmp/project1: Exit code 1, Errors: 1
Error: resource compiler "fpcres" not found, switching to external mode
If I now close all files and re-load my Hello World application, it will no longer compile with the same error. If I close Lazarus, re-open and try and compile the Hello World Application, again I get a the fpcres error. The only way to eliminate it is to delete the Hello World files and create a new Console Application - whereupon I revert back to the debugger error.
If you could give a newbie who's fumbling around in the dark a pointer it would be much appreciated.
Let me know if you need the contents of any config or other files.
Regards,
Stephen