[fpc-pascal] Building compiler which stalls

Hairy Pixels genericptr at gmail.com
Sat Mar 4 07:24:33 CET 2023


Following up I’m trying to rebuild my compiler from sources and something strange has happened.

Here’s the build command I used and it builds the compiler up to step #2 but then when it copies the compiler to compiler/ppca64 things fall apart. I noticed the following command "make distclean” stalled out at some point so I tried to run the compiler at compiler/ppca64 and it just stalls out, spinning the CPU at 100% in an infinite loop and never prints the normal FPC header.

I remember earlier when I was having that problem with the duplicate pointer addresses I tried to use a nested procedure and this actually caused the compiler (or maybe the assembler) to get stuck also (I was going to try to make an issue for this but I couldn’t isolate it in a test program) so I wonder if that’s related.

Is there anything the compiler could be trying to read like a cache or something which I could delete? I even deleted the entire sources repo and downloaded it again (and restarted) but the same thing happened. 

Any ideas?

========================

set -e
MACOS_SDK=`xcrun --show-sdk-path`
TOOLCHAIN=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
cd $HOME/Developer/fpc

# https://wiki.freepascal.org/macOS_Big_Sur_changes_for_developers#ARM64.2FAArch64.2FApple_Silicon_Support

# 1. Compile a native AArch64 compiler from the FPC trunk source
make distclean
make FPC=ppcx64 OPT="-ap -FD${TOOLCHAIN} -XR${MACOS_SDK}" CPU_TARGET=aarch64 -j 4 FPMAKEOPT="-T 4" all

# 2. Copy the created native compiler to a safe place (the delete + copy is to avoid issues with a code signature caching bug in the OS - see Updating a signed file for an explanation)
rm -f ppca64  ; cp compiler/ppca64 .

# 3. Build a complete native FPC distribution for Darwin/AArch64
make distclean
make FPC=$PWD/ppca64 OPT="-ap -FD${TOOLCHAIN} -XR${MACOS_SDK}" -j 4 FPMAKEOPT="-T 4" OVERRIDEVERSIONCHECK=1 all

# 4. Install the built toolchain globally (under /usr/local)
sudo make FPC=$PWD/ppca64 OPT="-ap -FD${TOOLCHAIN} -XR${MACOS_SDK}" install

# 5. Enable the fpc binary to find the AArch64 compiler (ppca64). You only need to do this once, even if you build/install newer build later on (unless the version number of trunk would change)
sudo ln -sf /usr/local/lib/fpc/3.3.1/ppca64 /usr/local/bin

# 6. Verify new version
NEW_VERSION=`./compiler/ppca64 -iV`
/usr/local/lib/fpc/${NEW_VERSION}/ppca64 -i



Regards,
	Ryan Joseph



More information about the fpc-pascal mailing list