Lazarus

Programming => Operating Systems => macOS / Mac OS X => Topic started by: Igor Kokarev on November 13, 2020, 01:01:09 pm

Title: Lazarus and FPC on macOS Big Sur 11
Post by: Igor Kokarev on November 13, 2020, 01:01:09 pm
Hi,

I just upgraded macOS Catalina to final macOS Big Sur 11.0.1
with Xcode 12.2 for Intel iMac.

Lazarus 2.0.10 (Cocoa) and FPC 3.2.0 work fine on first glance.

P.S. The only issue I found - no Subversion in Big Sur and Xcode. Brew couldn't install SVN on Big Sur.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: mischi on November 13, 2020, 01:14:33 pm
I favor fink and macports over homebrew. Have a look into them. They act on separate directories and leave /usr/local alone. I expect macports to be there with svn in short time. fink might take a bit longer.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: MiR on November 13, 2020, 08:00:25 pm
I cannot rebuild fpc stable in fpcupdeluxe:

/Users/ring/fpcupdeluxe/fpcbootstrap/ppcx64 -Ur -Xs -O2 -n -Fux86_64 -Fusystems -Fu/Users/ring/fpcupdeluxe/fpcsrc/rtl/units/x86_64-darwin -Fix86_64 -FEx86_64/bin/x86_64-darwin -FUx86_64/units/x86_64-darwin -dRELEASE -WM10.8 -Sg -vw-n-h-l-d-u-t-p-c-   -dREVINC -dx86_64 -dGDB -dBROWSERLOG -Fux86 -Fix86 pp.pas
ld: library not found for -lc

Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: trev on November 14, 2020, 06:59:52 am
I just upgraded macOS Catalina to final macOS Big Sur 11.0.1
[...]
P.S. The only issue I found - no Subversion in Big Sur and Xcode. Brew couldn't install SVN on Big Sur.

As I think Jonas pointed out to me, there is no svn in Catalina either (it may remain after an upgrade from Mojave which caught me out - svn was not included in Xcode 11.4 onwards). You can, however, use git for FPC + Lazarus repositories.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: dbannon on November 14, 2020, 11:04:51 am
..... You can, however, use git for FPC + Lazarus repositories.

That would be at https://github.com/graemeg
But they are only trunk.  I tend to develop with trunk but do my releases with the latest official release.  If Apple users (other than me, I still use Sierra) cannot get Lazarus release or fixes source, we'll need to do something .....

Davo
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: trev on November 14, 2020, 11:03:06 pm
Lazarus release installs come with source. FPC release source is a required download available as an archive. Not sure about fixes as I've never used it. I mostly use trunk for FPC + Lazarus.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: dbannon on November 14, 2020, 11:51:53 pm

> Lazarus release installs come with source.
Good, I did not know that, I just use SVN

> FPC release source is a required download available as an archive.
Maybe not an issue as FPC release cycle is a lot slower.

> Not sure about fixes as I've never used it. I mostly use trunk for FPC + Lazarus.
Well, fixes is, effectively, the on going beta of next release. So, pretty important that it be tested in real life situations.

I could get really, really controversial and raise the on going topic of moving to git .....

(he ducks his head quickly.)

Davo
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: Igor Kokarev on November 21, 2020, 12:36:10 pm
Two observations about Big Sur and Lazarus:

1. Lazarus 2.0 fixes branch can't be compiled itself on Apple Silicon (DTK or M1) for aarch64 using FPC 3.2.1 (fixes tree).

Lazarus Trunk can be successfully compiled with FPC 3.3.1 Trunk. So I think that Lazarus Trunk has some corrections for Apple Silicon.

If you plan to compile future Lazarus 2.0.11 for Apple Silicon it necessary to add some corrections.

2. On any Mac with Big Sur. I downloaded Lazarus 2.0 fixes branch from SVN on Intel Mac. Then I zipped sources folder, copy to Windows PC via Dropbox, and then copied ZIP archive to another iMac Intel by local network. Unpacked ZIP. Unpacked Lazarus sources compiled correctly with FPC 3.2.1 fixes branch, but it cannot be launched - macOS says in Terminal that I have no rights to run lazarus (a long message), startlazarus or lazbuild. Even with chmod +x ...
I tried two times to recompile Lazarus.

Then I downloaded again Lazarus 2.0 fixes branch sources via git on this iMac, compiled with the same FPC 3.2.1 fixes, and now everything runs correctly, even without any call of chmod +x ...

So it seems that macOS quarantines downloaded sources and marks app bundles as untrusted. I have no idea why it happens. I have a guess that if re-create APP bundles of Lazarus manually it will solve this strange problem.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: trev on November 22, 2020, 02:00:57 am
You may need to grant various things "Full Disk Access" in the Preferences > Security & Privacy - Privacy tab in Big Sur - at least that was my experience during the betas when copying executable files/apps from elsewhere.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: adderthorn on November 24, 2020, 09:06:04 pm
Two observations about Big Sur and Lazarus:

1. Lazarus 2.0 fixes branch can't be compiled itself on Apple Silicon (DTK or M1) for aarch64 using FPC 3.2.1 (fixes tree).

Lazarus Trunk can be successfully compiled with FPC 3.3.1 Trunk. So I think that Lazarus Trunk has some corrections for Apple Silicon.

If you plan to compile future Lazarus 2.0.11 for Apple Silicon it necessary to add some corrections.

2. On any Mac with Big Sur. I downloaded Lazarus 2.0 fixes branch from SVN on Intel Mac. Then I zipped sources folder, copy to Windows PC via Dropbox, and then copied ZIP archive to another iMac Intel by local network. Unpacked ZIP. Unpacked Lazarus sources compiled correctly with FPC 3.2.1 fixes branch, but it cannot be launched - macOS says in Terminal that I have no rights to run lazarus (a long message), startlazarus or lazbuild. Even with chmod +x ...
I tried two times to recompile Lazarus.

Then I downloaded again Lazarus 2.0 fixes branch sources via git on this iMac, compiled with the same FPC 3.2.1 fixes, and now everything runs correctly, even without any call of chmod +x ...

So it seems that macOS quarantines downloaded sources and marks app bundles as untrusted. I have no idea why it happens. I have a guess that if re-create APP bundles of Lazarus manually it will solve this strange problem.

How did you compile on ASi? Did you build FPC on the ASi mac first or cross compile?
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: skalogryz on November 24, 2020, 09:30:46 pm
How did you compile on ASi? Did you build FPC on the ASi mac first or cross compile?
1. Install Xcode on either ASi or Intel macOS
2. Install fpc 3.2.0 official release
3. follow the steps given on the wiki page (https://wiki.freepascal.org/macOS_Big_Sur_changes_for_developers#ARM64.2FAArch64.2FAppleSilicon_Support)
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: adderthorn on November 24, 2020, 10:53:38 pm
How did you compile on ASi? Did you build FPC on the ASi mac first or cross compile?
1. Install Xcode on either ASi or Intel macOS
2. Install fpc 3.2.0 official release
3. follow the steps given on the wiki page (https://wiki.freepascal.org/macOS_Big_Sur_changes_for_developers#ARM64.2FAArch64.2FAppleSilicon_Support)

I should have looked at the Big Sur wiki page! Fantastic work that this happened so quickly!

Edit: Running into some issues compiling Lazarus on ASi. Tried running:

Code: [Select]
make LCL_PLATFORM=cocoa CPU_TARGET=aarch64 bigide
Which then ends up producing the following error

Code: [Select]
lib/aarch64-darwin/cocoa/tatextelements.s:543:9: error: invalid operand for instruction
        add     x0,w0,w0,lsr #63
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:544:9: error: invalid operand for instruction
        asr     w0,x0,#1
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:546:9: error: invalid operand for instruction
        add     x1,w1,w1,lsr #63
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:547:9: error: invalid operand for instruction
        asr     w1,x1,#1
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3832:9: error: invalid operand for instruction
        add     x0,w0,w0,lsr #63
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3833:9: error: invalid operand for instruction
        asr     w1,x0,#1
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3835:9: error: invalid operand for instruction
        add     x0,w0,w0,lsr #63
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3836:9: error: invalid operand for instruction
        asr     w0,x0,#1
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3934:9: error: invalid operand for instruction
        add     x0,w0,w0,lsr #63
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3935:9: error: invalid operand for instruction
        asr     w1,x0,#1
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3937:9: error: invalid operand for instruction
        add     x0,w0,w0,lsr #63
                   ^
lib/aarch64-darwin/cocoa/tatextelements.s:3938:9: error: invalid operand for instruction
        asr     w0,x0,#1
                   ^
make[2]: *** [tachartlazaruspkg.ppu] Error 1
make[1]: *** [bigide] Error 2
make: *** [bigidecomponents] Error 2

Build Log: https://gist.github.com/adderthorn/ac93eb4bf53fddb7d7c0406e257a0b61

Is this something I made a mistake on during compilation?
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: Igor Kokarev on November 25, 2020, 09:44:53 am
If you install Big Sur on a new Mac or another SSD drive. At the end of installation Big Sur will offer you import settings from your old Mac (or old SSD drive).

It really works great, macOS copied all my settings, home directory, files, Lazarus, FPC, codesign certificates, etc. I've got exact copy of my previous macOS installation. No need to configure macOS from a scratch.

I tried this approach on two Macs (Intel > Intel). I had large SSD drive. With Disk Utility I created a second partition for Big Sur. After the installation macOS copied all settings/files from Catalina. And now I have two installations of macOS - Big Sur and old Catalina. So I can test apps in old Catalina and use new Big Sur on the same Mac.

I didn't test copying from Intel to Apple M1.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: DonAlfredo on November 25, 2020, 10:37:41 am
To steal this thread for a request.
I have tried to cross-build fpcupdeluxe for Darwin arm64 from my Windows PC.
As I do not have a Mac, I would like to ask you to test it ? If it starts, I am ok.
Thanks.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2e/fpcupdeluxe-aarch64-darwin-cocoa.zip
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: nummer8 on November 25, 2020, 12:01:11 pm
I tried it on a mac book pro with Big Sur.
it would not start.  %)
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: DonAlfredo on November 25, 2020, 12:09:26 pm
Thanks for testing ! Final questions.
Did it crash (crash report) ? Or was it a safety issue ?
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: nummer8 on November 25, 2020, 01:15:14 pm
No crash. If I try to start the app I got the message
"You can't open the app FPC.... because this app is not supported on this Mac"
(translated the message)
Hope it helps
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: adderthorn on November 25, 2020, 03:15:33 pm
If you install Big Sur on a new Mac or another SSD drive. At the end of installation Big Sur will offer you import settings from your old Mac (or old SSD drive).

It really works great, macOS copied all my settings, home directory, files, Lazarus, FPC, codesign certificates, etc. I've got exact copy of my previous macOS installation. No need to configure macOS from a scratch.

I tried this approach on two Macs (Intel > Intel). I had large SSD drive. With Disk Utility I created a second partition for Big Sur. After the installation macOS copied all settings/files from Catalina. And now I have two installations of macOS - Big Sur and old Catalina. So I can test apps in old Catalina and use new Big Sur on the same Mac.

I didn't test copying from Intel to Apple M1.

For me this is a brand new mac. I didn't copy from an old mac. I could probably run the latest binaries using Rosetta but was hoping to compile a native build of Lazarus. I got FPC working.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: adderthorn on November 25, 2020, 07:06:46 pm
Okay, tried to take an update for FPC, recompile and then was able to compile lazarus with M1. Very exciting!
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: MiR on December 10, 2020, 01:37:06 am
@DonAlfredo: My Macbook Air M1 arrived today, second thing I tried was running fpcupdeluxe, but it fails (1.8.2f) Is there a way I can help to make it work?

Starting it from Bundle gives a message that I do not have enough rights to start the app, direct start gives this:

Error:
./fpcupdeluxe-aarch64-darwin-cocoa.app/Contents/MacOS/fpcupdeluxe-aarch64-darwin-cocoa
zsh: killed

sudo dtruss ./fpcupdeluxe-aarch64-darwin-cocoa.app/Contents/MacOS/fpcupdeluxe-aarch64-darwin-cocoa
dtrace: system integrity protection is on, some features will not be available

dtrace: failed to execute ./fpcupdeluxe-aarch64-darwin-cocoa.app/Contents/MacOS/fpcupdeluxe-aarch64-darwin-cocoa: Malformed Mach-o file

Michael
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: trev on December 10, 2020, 03:12:01 am
@MIR: Did you do the  CTRL-CLICK dance to bypass Gatekeeper? The fact  fpcupdeluxe-aarch64-darwin-cocoa was being killed suggests not.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: DonAlfredo on December 10, 2020, 06:19:26 am
@MiR
A wrong binary was uploaded by me. Please download fpcupdeluxe-aarch64-darwin-cocoa again. It should work !
Please note: aarch64-darwin is still work-in-progress.

Edit:
Another upload for darwin arm64 is also available.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2f/fpcupdeluxe-aarch64-darwin-cocoa-cross.zip
It has been codesigned on my Windows PC. Would be interesting to know if this one also works on your system. Please test. Thanks.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: MiR on December 10, 2020, 10:47:06 am
Unfortunately both do not work. The error message is different, it now says that the file is corrupt and the only option is to delete it.

Result is the same for both new files from github.

Systemlog revealed that Gatekeeper is standing in the way (Yes, I used CTRL-Click):

10.12.2020, 10:14:56 com.apple.xpc.launchd[1]: Coalition Cache Hit: app<application.com.company.fpcupdeluxe-aarch64-darwin-cocoa.860843.860848(501)> [9961]
10.12.2020, 10:15:07 com.apple.xpc.launchd[1]: removing service since it exited with consistent failure - OS_REASON_EXEC | Gatekeeper policy blocked execution

Next step then was to declare Terminal as a Developer Tool, after this step I could actually start fpcupdeluxe from within Terminal.

But build failed:
Code: [Select]
fpcupdeluxe: Executing: /usr/bin/git log -n 1 --grep=^git-svn-id: (working dir: /Users/ring/fpcupdeluxe/fpcsrc)
fpcupdeluxe: info: FPCNativeInstaller (GetModule: FPC): FPC was at revision: 45643
fpcupdeluxe: info: FPCNativeInstaller (GetModule: FPC): FPC is now at revision: 45643
fpcupdeluxe: info: FPCNativeInstaller (GetModule: FPC): No FPC patches defined.
fpcupdeluxe: info: FPCNativeInstaller (BuildModule: FPC): Building module FPC...
fpcupdeluxe: info: FPC native builder: Detected source version FPC (source): 3.2.0
fpcupdeluxe: info: FPCNativeInstaller (BuildModule: FPC): To compile this FPC, we need (required) a compiler with version 3.2.0 or 3.2.0
fpcupdeluxe: info: FPCNativeInstaller (CheckAndGetTools): Looking for a bootstrap compiler from official FPC bootstrap binaries.
fpcupdeluxe: info: FPCNativeInstaller (CheckAndGetTools): Looking for official FPC bootstrapper with version 3.2.0
fpcupdeluxe: info: FPCNativeInstaller (CheckAndGetTools): Now looking for a better [version] bootstrap compiler from Github FPCUP(deluxe) releases.
fpcupdeluxe: info: FPCNativeInstaller (CheckAndGetTools): Looking online for a FPCUP(deluxe) bootstrapper with name: fpcup-3_2_0-aarch64-darwin-ppca64
fpcupdeluxe: ERROR: FPCNativeInstaller (CheckAndGetTools): No bootstrapper local and online. Fatal. Stopping.
Found valid make application.
fpcupdeluxe: ERROR: FPCNativeInstaller (BuildModuleCustom: FPC): FPC bootstrap version error: 0.0.0 ! Should never happen: expect many errors !!
fpcupdeluxe: info: FPCNativeInstaller (BuildModuleCustom: FPC): Running CleanModule once more before building FPC from sources, due to previous CleanModule failure.
fpcupdeluxe: info: FPCNativeInstaller (CleanModule: FPC): Running  distclean failed: could not find cleanup compiler. Will try again later
fpcupdeluxe: info: FPCNativeInstaller (CleanModule: FPC): Now building FPC revision 45643
fpcupdeluxe: Executing: /usr/bin/make --jobs=8 FPMAKEOPT=--threads=8 PP=/Users/ring/fpcupdeluxe/fpcbootstrap/ppca64 FPCMAKE=/Users/ring/fpcupdeluxe/fpc/bin/aarch64-darwin/fpcmake PPUMOVE=/Users/ring/fpcupdeluxe/fpc/bin/aarch64-darwin/ppumove PREFIX=/Users/ring/fpcupdeluxe/fpc INSTALL_PREFIX=/Users/ring/fpcupdeluxe/fpc FPCDIR=/Users/ring/fpcupdeluxe/fpcsrc INSTALL_BINDIR=/Users/ring/fpcupdeluxe/fpc/bin/aarch64-darwin OS_SOURCE=darwin CPU_SOURCE=aarch64 OS_TARGET=darwin CPU_TARGET=aarch64 OVERRIDEVERSIONCHECK=1 REVSTR=45643 REVINC=force OPT=-Fl/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib -WM10.8 -Sg -vw-n-h-l-d-u-t-p-c- --directory=/Users/ring/fpcupdeluxe/fpcsrc all install (working dir: /Users/ring/fpcupdeluxe/fpcsrc)
Makefile:135: *** Compiler /Users/ring/fpcupdeluxe/fpcbootstrap/ppca64 not found.  Stop.

fpcupdeluxe: ERROR: FPCNativeInstaller (CleanModule: FPC): Error running /usr/bin/make for FPC failed with exit code 512
. Details:


ERROR: Fpcupdeluxe fatal error !
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: trev on December 10, 2020, 11:18:10 am
@MIR: You can compile both FPC + Lazarus from source - see the Wiki article ARM64/AArch64/Apple Silicon Support (https://wiki.lazarus.freepascal.org/macOS_Big_Sur_changes_for_developers#ARM64.2FAArch64.2FApple_Silicon_Support). This works for me on the base M1 Mac mini.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: DonAlfredo on December 10, 2020, 11:22:04 am
@MiR
Thanks for this feedback ! Very useful.
As said, arm64-darwin is still a moving target for fpcupdeluxe: I am also very interested to know if you are able to get the cross-app running (a bit).
Will look into a suitable bootstrapper for FPC.

Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: MiR on December 10, 2020, 11:29:01 am
Thinking about the error message, it makes a lot of sense.

We only have trunk compiler on aarch64 so the search for stable fpc must fail. I tried to build both stable.git and trunk.git for fpc, same result for both.

@DonAlfredo: Can I override this check in some way? I looked through settings+ but the right side of the dialog is greyed out for me.

@trev: Thank you, I already did that yesterday, my point is that I would like to help DonAlfredo to make fpcupdeluxe work on M1 chipssets so others have a smoother transition.

Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: DonAlfredo on December 10, 2020, 11:32:56 am
This message includes a screenshot on how to override the compiler in Setup+.
You need to select the target os and cpu first !
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: MiR on December 10, 2020, 11:39:00 am
I would love to change those settings but.....  :'(
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: DonAlfredo on December 10, 2020, 11:44:31 am
That is a good one ...  ;)
Will build new up-binaries. Stay tuned !
 :D
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: MiR on December 10, 2020, 11:53:56 am
Success.....

I created a symlink to my local build of fpc-trunk in fpcbootstrap directory and tweaked fpc options to include path to my commandlinetools:

-FD/Library/Developer/CommandLineTools/usr/bin -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

and I have a native lazarus built with fpcupdeluxe on my mac.....

To automate the setting of -FD and -XR I'd propose to use this command:

xcrun --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk

and then later include both -FD and -XR in you custom fpc.cfg

This last step is also valid for builds of x64_64, I had to do those tweaks a while ago to make lazarus compile on my 'old' x86_64 mac.

Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: DonAlfredo on December 10, 2020, 12:18:30 pm
That is good news ! Thanks again.

I have uploaded 2 new pre-release versions of up for Darwin AMR64.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2g/fpcupdeluxe-aarch64-darwin-cocoa-signed.zip
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/1.8.2g/fpcupdeluxe-aarch64-darwin-cocoa.zip

If one of these work, the settings panel is enabled and the -XR option is added.

I have also uploaded an non-signed bootstrapper. Meaning: it will be found and downloaded; it will not run until signed.

Note:
The binaries are signed on my Windows PC. And that will most definitely be not enough I guess. But worth a try.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: MiR on December 10, 2020, 12:56:33 pm
Starting both new builds via Finder still does not work, I still have to resort to Terminal to run fpcupdeluxe.

Also the ppca64 does not work, I had to replace it with a symlink to my own build.

But the rest is fixed, the rest worked like a charm....

One question: do you use xcrun to detect commandline tools as I wrote? Hardcoding it will not work for users that have full XCode install, for them the path is different (You can check in the 'building fpc for m1' Article mentioned above, there the path for XCode is used.)

Can you send me your steps for code-signing? Perhaps I do a lucky punch and find something.....

Thank you for your great tool,

Michael

One more thing: When you feel really bored, would it be possible to add an option to do a distclean after build of fpc and lazarus? That saves a little space and as I bought the mac with only 256GB of flash free memory fades away faster than snow in the sun....
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: DonAlfredo on December 10, 2020, 01:09:44 pm
@MiR

Yes, xcrun is used to get the SDK path.

About codesigning and cross-building for arm64. Its not easy to cross towards this new target. Have a look here:
https://github.com/LongDirtyAnimAlf/ld64-msys
https://github.com/LongDirtyAnimAlf/libtapi-msys
I had to make and use the above two repo's to be able to compile Apple's clang12 together with libtapi, blocks, the custom linker LD64 and tools on Windows and Linux.
Inside the LD-repo there is this:
https://github.com/LongDirtyAnimAlf/ld64-msys/tree/master/ldid
Explain:
http://iphonedevwiki.net/index.php/Ldid
So, codesigning on a non-Darwin system will always be very tricky and 90% guaranteed NOT to work.
I do not have a developer-id, as being a Windows guy.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: MiR on December 10, 2020, 02:18:14 pm
I may have found a partial solution:

codesign --force --deep -s - ppca64

makes the bootstrap compiler work for me, worst case fpcupdeluxe could do that step after downloading fpcbootstrap

codesign --force --deep -s - fpcupdeluxe-aarch64-darwin-cocoa.app

also works for your unsigned build, with your signed build I get an exception when starting but nevertheless the code also starts.

Question is now if it could be acceptable for you to run this codesign step from within a vm and, of course, if this adhoc signature works on all devices or only on the device where it was issued.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: DonAlfredo on December 10, 2020, 02:22:16 pm
AFAIK, the "-s -" means (self-)signing for your machine only.
But again, I do not know that much about Mac: only a VM with OSX.
Codesigning the bootstrapper after download might be a nice trick however !
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: MiR on December 10, 2020, 02:35:01 pm
Also, when reading more on ldid and browsing through the source I started doubting if this tool will ever work, reason is that in this article:

http://iphonedevwiki.net/index.php/Code_Signing

they say:

jailbreaks patch the signature verification out of the kernel.

and when I read the ldid code correctly they are creating a self-signed certificate and as this is not in apple's trust chain it will likely not have any real value. (I might of course read the sources wrongly, I did not spend too much time on this).
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: MiR on December 10, 2020, 02:36:59 pm
Can you please codesign the compiler on github, then I can see if it works on my computer.....
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: DonAlfredo on December 10, 2020, 04:03:52 pm
Signed:
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/download/bootstrappers_v1.0/fpcup-3_3_1-aarch64-darwin-ppca64

I have included a screenshot of the signing process. As you can see, this process runs well.
Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: MiR on December 10, 2020, 04:59:34 pm
MacOS seems to disagree:

Your binary (some output of copdesign deleted):
Code: [Select]
codesign --display --verbose fpcup-3_3_1-aarch64-darwin-ppca64
fpcup-3_3_1-aarch64-darwin-ppca64: no signature
TeamIdentifier=not set

My binary, signed with adhoc cert:
Code: [Select]
Signature=adhoc
TeamIdentifier=not set

Your Binary, signed with my Developer-ID:
Code: [Select]
Signature size=8973
TeamIdentifier=4S7HMLQE4Z

I have uploaded both a signed version of the compiler and the whole package here:

http://temp.michael-ring.org/fpcup-3_3_1-aarch64-darwin-ppca64.zip
http://temp.michael-ring.org/fpcupdeluxe-aarch64-darwin-cocoa.zip

You can use my signed version for the compiler on github if you want as it will (hopefully) not need to get rebuilt often, I have also uploaded a signed version of fpcupdeluxe, perhaps some other guy can check it on his M1 system, after signing it I did not need to replace the compiler in fpcbootstrap, but this could be some caching or other strange effect on my system as I have played around a lot with signatures today.

Title: Re: Lazarus and FPC on macOS Big Sur 11
Post by: DonAlfredo on December 10, 2020, 05:16:29 pm
Thanks very much for your help with testing and the signed binaries. I will upload them.
Behind the screens, another user has also been very helpful reaching this target: adderthorn. I would like to thank him also.
TinyPortal © 2005-2018