Recent

Author Topic: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro  (Read 1216 times)

Jon Trepte

  • New Member
  • *
  • Posts: 19
lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« on: March 07, 2025, 06:46:03 am »
I have installed lazarus-darwin-aarch64-3.8 on my Mac mini M4 Pro and while the IDE runs correctly and I can compile and run projects.
However if I try to rebuild the IDE I get the following right at the end (see attachment).
I have tried lazarus-darwin-aarch64-4.0RC2 but that crashes as soon as I press Start IDE button on the welcome page (all options are OK).
The only version I have working is a copy from my old Mac mini x86 (V3.7) however this only runs without the debugger.
I would like to run a native version of Lazarus.
Any Ideas.


dbannon

  • Hero Member
  • *****
  • Posts: 3311
    • tomboy-ng, a rewrite of the classic Tomboy
Re: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« Reply #1 on: March 07, 2025, 07:20:43 am »
Two seperate but well know problems here I am afraid Jon.

Firstly, using any tool that makes software on a Mac, Apple very kindly render that application unusable and hide what they did. Easy fixed, not a FPC/Lazarus issue

https://wiki.freepascal.org/Installing_Lazarus_on_macOS#Building_source

Secondly, its been discovered that there is a Mac specific problem in Lazarus 4RC2, its fixed in trunk and will almost certainly be fixed in 4.0 when its released.

https://forum.lazarus.freepascal.org/index.php/topic,70164.msg549151/topicseen.html

For now, use 4.0RC1 and remember, when making a new app file (ie the directory apple wraps everything up in, you must remove the hidden "do not run" attribute.

Hope this helps.

(I'll see if I can add something to the installing from source wiki about that RC2 bug)

Davo
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

Jon Trepte

  • New Member
  • *
  • Posts: 19
Re: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« Reply #2 on: March 07, 2025, 07:25:26 am »
Thanks Davo, I'll try you suggestion and revert.
Jon

dbannon

  • Hero Member
  • *****
  • Posts: 3311
    • tomboy-ng, a rewrite of the classic Tomboy
Re: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« Reply #3 on: March 07, 2025, 07:28:51 am »
For the record, I quoted the wrong forum like to the 4RC2 problem, its should be -
https://forum.lazarus.freepascal.org/index.php/topic,70214.msg548936.html#msg548936

Davo
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

Jon Trepte

  • New Member
  • *
  • Posts: 19
Re: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« Reply #4 on: March 12, 2025, 09:08:09 am »
Ok Davo,

I installed RC1 into the applications folder.
I then ran xattr -rc lazarus.
lazarus started the IDE and I then chose tools/Build Lazarus with profile : Normal IDE
Everything seems to compile but I still get the error dialog right at the end as if it was trying to restart the IDE (see previous attachment)
 
file not found
Can't find the lazarus executable /Applications/lazarus/lazarus.app/Contents/Resources/startlazarus.app/Contents/MacOS/lazarus.

Looking into that folder I find the only file called startlazarus

Is there something amiss here?
should it be running startlazarus instead?
Happy to wait for V4 release candidate. Just hope it doesn't have the same problem.

Any Ideas?
Jon


dbannon

  • Hero Member
  • *****
  • Posts: 3311
    • tomboy-ng, a rewrite of the classic Tomboy
Re: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« Reply #5 on: March 12, 2025, 10:56:17 am »
Jon, you should, I think, have both lazarus.app and startlazarus.app in that directory. As such, they should both need the xattr treatment.

Code: Bash  [Select][+][-]
  1. $> attr -rc lazarus.app startlazarus.app

(don't know if the shell allows that, maybe run them separate commands)

But I am not quite sure whats happening there to be honest. I always put my lazarus installs down in my home directory, Linux, Unix or MacOS.  Thats because, as you note, Lazarus needs to be able to rebuild itself from time to time. But to cater for situations where pre-packaged Lazarus is installed in read only root space, the designers gave us startlazarus. It, quietly, in the background makes out its rebuilding the original Lazarus but actually builds a new copy hidden down in the config dir, in the user home space.

By building my Lazarus (and not 'installing' it) in my home direction, I avoid that extra complexity and doubling up of disk usage. But, honestly, I don't know if that system cuts in if you build in [MacOS]Applications.

Please check that xattr business first....

Davo
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

TRon

  • Hero Member
  • *****
  • Posts: 4309
Re: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« Reply #6 on: March 12, 2025, 05:34:55 pm »
You nailed it dbannon  :)

But to cater for situations where pre-packaged Lazarus is installed in read only root space, the designers gave us startlazarus. It, quietly, in the background makes out its rebuilding the original Lazarus but actually builds a new copy hidden down in the config dir, in the user home space.
With the additional note that afaik this process does not always end up successful and which seem to cause issues on certain setups. Also afaik reason (still) unknown.

Therefore installing in user-space is by far the easiest solution atm.
Today is tomorrow's yesterday.

Jon Trepte

  • New Member
  • *
  • Posts: 19
Re: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« Reply #7 on: March 13, 2025, 02:48:49 pm »
Hi Davo,
You suggested:
<Jon, you should, I think, have both lazarus.app and startlazarus.app in that directory. As such, they should both need the xattr treatment>
both files are in the main lazarus folder and have the xattr -rc lazarus.app startlazarus.app applied.

I've copied the files to my root folder with no difference.

What I don't understand is it seems to be looking for the lazarus.app inside the lazarus.app itself !!
This is the message I get.

file not found
Can't find the lazarus executable /Applications/lazarus/lazarus.app/Contents/Resources/startlazarus.app/Contents/MacOS/lazarus.

can you not check your path and see what files you have in that location.
See attachment for my contents.

Kind regards
Jon




dbannon

  • Hero Member
  • *****
  • Posts: 3311
    • tomboy-ng, a rewrite of the classic Tomboy
Re: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« Reply #8 on: March 15, 2025, 12:50:21 am »
I've copied the files to my root folder with no difference.
I really would not suggest that I am afraid. Just adds further confusion, how do you know which one is being used ?

Quote
What I don't understand is it seems to be looking for the lazarus.app inside the lazarus.app itself !!
Interesting. The lazarus.app is actually a directory. Inside that directory, there are some config files AND the actual binary, 'lazarus'.  So, when you ask the OS to "run" lazarus.app it looks inside the directory and looks for the binary of the same name but without the ".app" (note, its possible for that binary to be a symlink to a binary elsewhere, thats how lazarus makes (eg) project1.app, maybe lazarus.app ??).
Quote
Can't find the lazarus executable /Applications/lazarus/lazarus.app/Contents/Resources/startlazarus.app/Contents/MacOS/lazarus.
But that is definitely wrong.  From memory, it should be something like
   Applications/lazarus/lazarus.app/Contents/MacOS/lazarus

But what I don't know is who actually goes looking for that, I think its the OS rather than Lazarus. Lazarus just says "run Applications/lazarus/lazarus.app" and then the OS looks for Applications/lazarus/lazarus.app/Contents/MacOS/lazarus

Why the OS has the wrong term ?  Pretty unlikely its an OS problem. Some options I think -
  • The file Applications/lazarus/lazarus.app/Contents/MacOS/lazarus is a symlink pointing to an invalid binary, maybe pointing to a *.app dir ?  Please have a look at the contents of your lazarus.app dir, it 'might' have Contents/MacOS/lazarus as a symlink, if so, does it point to  real binary ?  Or, is it, itself, a binary ?
  • Again, guessing, also in that dir are various config files, perhaps Apple has some way of redefining the location of the binary ? And, somehow, thats wrong. I am sorry, this is bordering on the line between where my knowledge is sketchy and where its non-existent !
  • Another, really remote possibility, Apple has changed its rules about running a symlink-ed binary in a .app dir ?  They do things like that from time to time but I think we'd hear other people complaining.


Jon, I am leaving on an overseas trip latter today, I might have time to fire my MacMini up but we know it does not replicate your problem, its Intel running Monteray. Further, I build my Lazarus down in user space, never in /Applications (ie, Lazarus does not have to do that shuffling of files to user space). So, of limited help I suspect. If I can, I will find time to boot it and clarify exactly how my lazarus.app is constructed.

Davo
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

dbannon

  • Hero Member
  • *****
  • Posts: 3311
    • tomboy-ng, a rewrite of the classic Tomboy
Re: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« Reply #9 on: March 15, 2025, 09:37:52 am »
OK Jon, I have had a quick play and really cannot put more time in right now. More info here than you requested and more than is even vaguely helpful but I am pressed for time.

And its not good news.

Downloaded ,  unzipped  and  built  Lazarus-fixes_4.  Created  a  config  dir.  Start  it  up,  get  carefully  discuised  error  message

Code: Bash  [Select][+][-]
  1. $>  cd  bin/Lazarus
  2. $>  unzip /Users/dbannon/Downloads/lazarus-lazarus-fixes_4.zip
  3. $>  cd lazarus-fixes_4
  4. $>  make clean bigide
  5. ....
  6. $>   ls -la lazarus.app/Contents/MacOS/
  7. total 0
  8. drwxr-xr-x@ 3 dbannon  staff   96  4 Jan 20:03 .
  9. drwxr-xr-x@ 6 dbannon  staff  192  4 Jan 20:03 ..
  10. lrwxrwxrwx  1 dbannon  staff   16 15 Mar 17:25 lazarus -> ../../../lazarus

So,  in  this  case,  the  lazarus.app  points  to  a  binary,  "lazarus"  that  is  in the  same  directory  as  the  lazarus.app  dir.  And  that is because  thats  where  Lazarus  wants  to  make  its  binary.

Code: Bash  [Select][+][-]
  1. $>  mkdir  ../LazConfigs
  2. $>  cat > lazarus.cfg
  3. --pcp=/Users/dbannon/bin/Lazarus/LazConfigs/lazarus-fixes_4    {  Ctrl-D  }
  4.  
  5. $>  run ./lazarus.app
  6. $>  open ./lazarus.app
  7. The application cannot be opened for an unexpected reason, error=Error Domain=NSOSStatusErrorDomain Code=-10827 "kLSNoExecutableErr: The executable is missing" UserInfo={_LSLine=3863, _LSFunction=_LSOpenStuffCallLocal

We  all  know  Apple  lies  here,  the  OS  knows  very  well  whats  wrong  with  the  app,  it  set  a  quarantine  flag  on  the  app  dir.

Remove  quarantine  attribute.  Start  again.
Code: Bash  [Select][+][-]
  1. $>  xattr -drv com.apple.quarantine *
  2. $>  open ./lazarus.app lazarus.app

Open  up  lazarus,  necessary  to  set  the  debugger.  Must  select  just  lldb  rather  than  /usr/bin/lldb  but  otherwise  OK.  So  I  add  a  package,  in  my  case,  KControls,  it  builds  and  attempts  to  restart,  nothing  happens.

So,  as  an  experiment,  I  rebuilt  Lazarus  telling  it  to  use  its  existing  config  (wondering  if  all  that  config  for  KControls  was  correctly  written).

Code: Bash  [Select][+][-]
  1. $>  make  clean  useride
  2. $>  open ./lazarus.app lazarus.app

And  it  all  opened  up  nicely  with  KControls  installed. That definitely proves its not a package issue, its something to do with the way that Lazarus is rebuilding itself.

So, the relevant files and directories do not seem to have any unexpected attributes. I have to conclude that Lazarus, new in -fixes_4, does something funny with the open command, as you error message suggests. I have no idea what and honestly, don't have time to expirment any more.

I note someone else has posted a message about what might be the same issue (with Lazarus 3.8) but I suspect its just the quarantine issue. Pity he did not look around first.

I thought this problem was isolated to your M* and newest OS, seems I was wrong seeing on my older system. I have, recently, been using 4.0rc1 for my apps release. Its been working OK.  Are you using fixes_4 or 4.0rc1  ?  If what was working OK is now no longer working, are we looking at an Apple Update ?

Sorry Jon, I must stop here. Will be away from home with only my Linux Laptop. Away for nearly a month with quite patchy net access if any I am afraid.

Davo
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

Jon Trepte

  • New Member
  • *
  • Posts: 19
Re: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« Reply #10 on: March 24, 2025, 03:27:39 pm »
HI Davo,
Many many thanks for trying. The only version I got to work was 3.7 copied from my x86 based Mac. However the debugger won't work with this version.
Enjoy your trip.
Jon

sbulazel

  • Newbie
  • Posts: 5
Re: lazarus-darwin-aarch64-3.8 on Mac mini M4 Pro
« Reply #11 on: April 11, 2025, 11:25:54 pm »
Has someone had any luck with that problem? Meanwhile i tried *everything* i could think of, but no way to get it working. I don't even have a clue what that problem is about ...  :(

 

TinyPortal © 2005-2018