Recent

Author Topic: Running Lazarus Trunk on M1  (Read 1817 times)

Okoba

  • Sr. Member
  • ****
  • Posts: 312
Running Lazarus Trunk on M1
« on: March 20, 2022, 09:35:37 pm »
Hello,

I am trying to get Lazarus to work on M1 Mac. Got fpcupdeluxe-x86_64-darwin-cocoa and installed Trunk FPC and Lazarus, it seems fine, but when I run any empty application or program, it will freeze on the debugging mode. Meaning, an empty console will open, stop button enabled, and nothing else. I can not stop Lazarus, I can not close it, but it is not frozen. Only way I found is to log out.
Installed version: Lazarus 2.3.0 (rev main-2_3-1477-ga94312373c) FPC 3.3.1 x86_64-darwin-cocoa

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1988
  • Former Delphi 1-7, 10.2 user
Re: Running Lazarus Trunk on M1
« Reply #1 on: March 20, 2022, 11:36:59 pm »
It might be a fpcupdeluxe-x86_64-darwin-cocoa problem.

The Wiki has instructions for installing a non-release version of Lazarus and a non-release version  of FPC.

Alternatively, you can download my daily native aarch64 snapshots of Lazarus 2.3 and FPC 3.3.1 for the M1 Apple processor from my Sourceforge repo - instructions for installation are on that page. I have just tested the last builds of Lazarus 2.3 and FPC 3.3.1 and they work without issues on my M1 Mac mini.
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 x86_64 Xcode 13.4
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 aarch64 Xcode 13.4

Okoba

  • Sr. Member
  • ****
  • Posts: 312
Re: Running Lazarus Trunk on M1
« Reply #2 on: March 21, 2022, 10:58:35 am »
Thank you very much.
Unfortunately I do not know very much, how to config the Lazarus with fpc.cfg and debugger and the rest, and at all in mac.
That was the reason I was using fpcupdelux.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1988
  • Former Delphi 1-7, 10.2 user
Re: Running Lazarus Trunk on M1
« Reply #3 on: March 21, 2022, 11:19:01 am »
The Wiki tells you how to configure the debugger - see [
Step 5: How to configure the Debugger in my Installing Lazarus on macOS Wiki article. Maybe that's your issue?
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 x86_64 Xcode 13.4
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 aarch64 Xcode 13.4

Josh

  • Hero Member
  • *****
  • Posts: 998
Re: Running Lazarus Trunk on M1
« Reply #4 on: March 21, 2022, 11:32:56 am »
I moved it from fpcupdeluxe thread...

hi

i dont think it is the same..

on that thread, if using m1 i use the fpcupdeluxe for m1

https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/v2.2.0h/fpcupdeluxe-aarch64-darwin-cocoa.zip

i use the fpcupdeluxe-x86_64-darwin-cocoa for intel macs

install into seperate folder or completely empty your othe folder.
I personally have SIP turned off

Shutdown your Mac, and then press and hold power button until you see Continue holding for startup options.
Click Options.
Select your administrator account, and enter password.
Click Utilities and start Terminal
In Terminal type
csrutil disable and hit enter.
Confirm with Y and hit enter. Enter password.
When you get confirmation type Reboot and hit enter.

To Enable change
csrutil disable to csrutil enable

Also make sure xcode is fully installed and commandlines tools is fully installed, lazarus should be using lldb and not gdb.
you must run xcode at least once to accept the license agreement. (very important after an upgrade of os/xcode)

Remember that a gui app; must really be run from an app Bundle; on mac save your project; go to project option and create DarwinApplication Bundle..
« Last Edit: March 21, 2022, 11:35:54 am by josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Okoba

  • Sr. Member
  • ****
  • Posts: 312
Re: Running Lazarus Trunk on M1
« Reply #5 on: March 21, 2022, 11:49:06 am »
I went with the "Step 5: How to configure the Debugger", there was not any "LLDB debugger (with fpdebug) (Beta)" so I installed, and now it does not freeze while debugging.
Next step I tried to write a simple program, with a WriteLn and ReadLn. It seems it opens and closes, I checked LaunchNewTerminal option in debugger and it opens an empty terminal and nothing else, and it makes the Lazarus frozen on the debugging and no solution unless logging out.

So it seems these are the problems:
- fpcupdelux aarch64 does not open in M1 Mac.
- fpcupdelux does not install fpdebug for Mac version of Lazarus as it seems the right debugger.
- No output in terminal for simple programs.
- When Lazarus froze on Mac while debugging, it does not let go and keeps Lazarus open. (Even if I force close the zombie, another instance can not open with error of there is another Lazarus running)

And for me specifically, I do not know how to config a Lazarus on Mac, even with the snapshots of trev, it bugs about config files, compiler and other things.

Josh

  • Hero Member
  • *****
  • Posts: 998
Re: Running Lazarus Trunk on M1
« Reply #6 on: March 21, 2022, 12:08:44 pm »
Any help.

note folder x86_64 can be different if different architecture ie Arch64 etc
name of fpc compiler can be different if different architecture ie fpca??
« Last Edit: March 21, 2022, 12:12:08 pm by josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Josh

  • Hero Member
  • *****
  • Posts: 998
Re: Running Lazarus Trunk on M1
« Reply #7 on: March 21, 2022, 12:20:03 pm »
Important note.

The folder you have installed lazarus fpc should not have any spaces in it, lots of the utilities will have issues.

Best to install in The root of a Hard Disk/Volume in a Folder with no spaces like MacHd://lazarus_trunk.

This is true for all Os's
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Okoba

  • Sr. Member
  • ****
  • Posts: 312
Re: Running Lazarus Trunk on M1
« Reply #8 on: March 21, 2022, 12:20:38 pm »
Thank you Josh but theres are addresses for Windows and I did not use space. I am familiar with that, but for Mac and for example for Trev snapshots, I do not know where are the fpc binary and fpppkg.cfg are.
@Trev, can you please share an screenshot of your config address?

Josh

  • Hero Member
  • *****
  • Posts: 998
Re: Running Lazarus Trunk on M1
« Reply #9 on: March 21, 2022, 12:43:19 pm »
in fpcupdeluxe
in the extra tab
Basic->Cross->Modules->Tags->History->Extras
you have a few check routines and create config routines.
have you tried any of those.

The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Okoba

  • Sr. Member
  • ****
  • Posts: 312
Re: Running Lazarus Trunk on M1
« Reply #10 on: March 21, 2022, 05:15:44 pm »
No. I have problems with the basic install and these does not change related things I think. And now I can not too. Now fpcupdelux is crashing, even the X64 version opens but raises and exception and does not load any server!
It seems it is reading some config from my computer that does not work.
Path of x64 file: /Users/u/Downloads/fpcupdeluxe-x86_64-darwin-cocoa/fpcupdeluxe-x86_64-darwin-cocoa.app
Path of aarch64 file:/Users/u/Downloads/fpcupdeluxe-aarch64-darwin-cocoa/fpcupdeluxe-aarch64-darwin-cocoa.app
I am not very familiar with macOS but it seems way harder than Linux and Windows version to even start with Lazarus.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1988
  • Former Delphi 1-7, 10.2 user
Re: Running Lazarus Trunk on M1
« Reply #11 on: March 22, 2022, 01:33:57 am »
Okoba - let's forget installing development versions of FPC and Lazarus for the moment.

* Please delete everything and start again.
* Install the official Lazarus release packages which will install FPC 3.2.2 and Lazarus 2.2.0
* Comprehensive instructions for doing this are in the Installing Lazarus on macOS Wiki article.

This is guaranteed to give you success. Once that is working, and if you really need the "in development" versions of Lazarus and FPC, we can tackle that situation again.
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 x86_64 Xcode 13.4
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 aarch64 Xcode 13.4

Okoba

  • Sr. Member
  • ****
  • Posts: 312
Re: Running Lazarus Trunk on M1
« Reply #12 on: March 22, 2022, 12:19:14 pm »
I deleted everything I could find.
Install again as you suggested, and I am happy to say that it works just fine, application and simple program with debugging.
Thank you.

Now I like to ask how you see console output? Should I run the program from console every time? Or is there an option to auto open the console like Windows? As I can not find console output window like Lazarus for Linux.

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 1988
  • Former Delphi 1-7, 10.2 user
Re: Running Lazarus Trunk on M1
« Reply #13 on: March 22, 2022, 11:21:42 pm »
I deleted everything I could find.
Install again as you suggested, and I am happy to say that it works just fine, application and simple program with debugging.
Thank you.

Glad to have helped.

Quote
Now I like to ask how you see console output? Should I run the program from console every time? Or is there an option to auto open the console like Windows? As I can not find console output window like Lazarus for Linux.

I run the executable from the Terminal (open ./project1.app/Contents/MacOS/project1) or add NSLog() output which also appears in the Console log (/Applications/Utilities/Console).
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 x86_64 Xcode 13.4
Lazarus 2.3, FPC 3.3.1 macOS 12.3.1 aarch64 Xcode 13.4

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1563
Re: Running Lazarus Trunk on M1
« Reply #14 on: March 23, 2022, 09:23:27 am »
@okoba
The problems you encounter with fpcupdeluxe are due to the fact that you run it from the download folder. And that is a privileged folder. This issue has been reported by other Mac-users too.
You might (try to) create a new folder on your desktop and copy up into this folder and run up from this new folder.

 

TinyPortal © 2005-2018