Since macOS 11.5 every new update (11.5.1, 11.5.2) damages FPC 3.2.2 binaries or configuration on M1-powered Mac.
Symptoms:FPC refuses to cross-compile for x86_64/darwin.
Compilation for aarch64/darwin works fine.
Mac-mini-Igor:~ mac$ fpc -Px86_64
Error: /usr/local/bin/ppcx64 can't be executed, error message: Failed to execute "/usr/local/bin/ppcx64", error code: 127
bash-3.2$ lazbuild --cpu=x86_64 --build-mode=Release --build-all --recursive MyApp.lpi
Hint: (lazarus) [RunTool] "/usr/local/bin/fpc" "-iWTOTP" "-Px86_64"
Warning: [TPCTargetConfigCache.Update] cannot find real compiler for this platform: Compiler="/usr/local/bin/fpc" Options="-Px86_64" RealCompiler=""
TProject.DoLoadStateFile Statefile not found: /Users/mac/Dev/MyApp/lib/x86_64-darwin/MyApp.compiled
Error: /usr/local/bin/ppcx64 can't be executed, error message: Failed to execute "/usr/local/bin/ppcx64", error code: 127
Error: (lazarus) Compile Project, Mode: Release, CPU: x86_64, Target: MyApp: stopped with exit code 1
Error: (lazbuild) failed compiling of project /Users/mac/Dev/MyApp/MyApp.lpi
Native aarch64/darwin compiler works fine:
bash-3.2$ fpc -Paarch64
Free Pascal Compiler version 3.2.2 [2021/05/16] for aarch64
<...>
Solution:I found a simple workaround. Reinstallation of fpc-3.2.2.intelarm64-macosx.dmg cures FPC configuration and now FPC works correctly again.
It seems that this problem doesn't appear on Intel Macs. Only on M1 Macs.