Recent

Author Topic: Getting Lazarus 4.8 working on macOS 26 (Tahoe) with FPC Trunk  (Read 127 times)

kkuba

  • Jr. Member
  • **
  • Posts: 51
Hi,

I recently spent quite a few hours getting Lazarus working on macOS 26 (Tahoe).
The official Lazarus 4.8 package installs correctly, however the bundled FPC 3.2.4 is currently unable to build applications on macOS 26 because the linker fails with:
ld: library 'c' not found
For that reason I kept the standard Lazarus installation but replaced only the compiler with the latest FPC trunk build.
After a fair amount of debugging I finally got everything working. Hopefully these notes will save someone else some time.
TL;DR: the bundled FPC 3.2.4 in Lazarus 4.8 can't link on macOS 26 ("ld: library 'c' not found"). Keep the official Lazarus 4.8 install, swap in an FPC trunk build, add three lines to /etc/fpc.cfg pointing at the Xcode 26 SDK, fix the missing ppca64 symlink, and patch one line in tadrawercanvas.pas. Details below.
Test configuration
•   macOS 26.5.2 (Tahoe)
•   Xcode 26.6
•   Lazarus 4.8 (official macOS package)
•   FPC trunk 3.3.1-20510-gd68b80000f
•   FPC source commit:
d68b80000faee69d48cd10393ef0c0fb03659b04
(Tested on Apple Silicon / arm64. On Intel Macs the same steps should apply — just substitute ppcx64 for ppca64 in step 3.)
________________________________________
1. Install Xcode
Install Xcode from the App Store.
Launch it once and accept the license.
Verify the installation:
xcodebuild -version
xcrun --show-sdk-path
________________________________________
2. Install FPC Trunk
Download the latest macOS package from:
https://github.com/viking1304/fpc-trunk/releases
If Gatekeeper blocks the installer, remove the quarantine attribute:
xattr -dr com.apple.quarantine <package>.pkg
Then install the package normally.
________________________________________
3. Missing ppca64 symlink
After installation
fpc -iV
returned
Error: ppca64 can't be executed
The compiler binary existed in
/usr/local/lib/fpc/3.3.1/ppca64
but the installer did not create
/usr/local/bin/ppca64
Creating the missing symbolic link fixed the issue:
sudo ln -s /usr/local/lib/fpc/3.3.1/ppca64 /usr/local/bin/ppca64
________________________________________
4. Generate fpc.cfg
The installer did not generate /etc/fpc.cfg.
Create it with:
sudo fpcmkcfg \
  -d "basepath=/usr/local/lib/fpc/3.3.1" \
  -o /etc/fpc.cfg
The warnings about missing GCC for cross-compilation can be ignored.
________________________________________
5. Update fpc.cfg
The generated configuration is still incomplete for macOS 26.
Without the following additions every application fails to link with
ld: library 'c' not found
Append this to /etc/fpc.cfg:
#ifdef DARWIN
-XR/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
-Fl/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib
-FD/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
#endif
After this change, a simple "Hello World" application compiles and links successfully.
This isn't new to macOS 26 — the same "library 'c' not found" symptom has shown up before whenever Xcode/SDK paths shifted (e.g. Big Sur in 2020, Xcode 15 in 2024). The installer-generated fpc.cfg just doesn't keep up automatically.
________________________________________
6. Download matching FPC sources
The release page contains the exact source commit used to build the compiler.
Download the matching source snapshot and remember its location.
________________________________________
7. Install Lazarus 4.8
Install the official Lazarus 4.8 package for macOS.
Configure Lazarus to use:
Compiler executable
/usr/local/bin/fpc
FPC source directory
<directory containing the downloaded FPC sources>
________________________________________
8. Rebuild the IDE
Rebuilding the IDE stopped in components/tachart/tadrawercanvas.pas with
Wrong number of parameters specified for call to "Scale"
The following one-line change fixed the problem.
Replace
Pen.Width := Scale(Pen.Width);
with
Pen.Width := Self.Scale(Pen.Width);
It appears that the new TFPCustomCanvas.Scale(...) method introduced in FPC trunk hides the inherited Scale() method inside the
with GetCanvas do block. Using Self.Scale() removes the ambiguity.
After this single modification Lazarus rebuilt and started successfully.
________________________________________
Remaining linker warnings
I still get:
ld: warning: ignoring duplicate libraries: '-lc'
and
ld: warning: no platform load command found in '*.or'
These appear to be harmless. The IDE and generated applications work correctly.
________________________________________
Summary
The following configuration works for me:
•   macOS 26.5.2 (Tahoe)
•   Xcode 26.6
•   Official Lazarus 4.8
•   FPC trunk 3.3.1-20510-gd68b80000f
•   Matching FPC sources
During installation I encountered three reproducible issues:
1.   The FPC trunk installer does not create the ppca64 symbolic link.
2.   The generated fpc.cfg is missing the SDK configuration required by macOS 26/Xcode 26.
3.   components/tachart/tadrawercanvas.pas requires Self.Scale(...) because of a name lookup conflict with the new TFPCustomCanvas.Scale() method.

Hopefully these notes will save someone else a few hours of debugging.
If any of these issues have already been fixed in newer revisions, please let me know.
I'd also like to thank the FPC and Lazarus developers for their work. The trunk compiler already contains the necessary Darwin changes—the remaining issues were relatively small and easy to work around once identified.
« Last Edit: July 05, 2026, 08:33:09 pm by kkuba »

 

TinyPortal © 2005-2018