I use stable versions of the Lazarus/Free Pascal compiler for my production projects. Decades of experience has left me very leery of the latest and greatest of any software.
For Lazarus, that means going to SourceForge (https://sourceforge.net/projects/lazarus/files/) and using a x.x.2 or greater version of the compiler. x.x.0 is forbidden in my book and even x.x.1 typically I avoid.
This is all fine and dandy until I find a bug in the compiler, and I cannot come up with a reasonable work around.
When an error is found with no resolution, I report it to the compiler writers. Without fail, the first question will be – can you reproduce it with the trunk compiler (the absolute most recent). Not that I can blame them. The bug may well already be fixed and they don’t want to waste time chasing down problems already fixed.
This means I need to be able to create a trunk version of the compiler on demand.
In the past, I’ve manually built the Lazarus compiler on Windows system. It is not a simple process but I know the procedure and can get a compiler running in a few hours. One downside to manually building the compiler is it will interfere with any existing Lazarus compiler, so the manual build should be done in a clean VM.
This week I found myself in the same predicament, except the bug is occurring only on the MacOS platform. I can just barely manage getting my production software to run on this platform. Manually building a compiler would be very time-consuming for me.
As I was researching the build process for MacOS I stumbled across the FPCUPDELUXEprogram. You tell it the version of Free Pascal and the version of Lazarus you want, it will download the code from the SVN along with the proper bootstrap compiler, then build everything for you. Further, the install is completely isolated from the rest of the system so any production Lazarus compiler is not impacted. YES!
I installed FPCUPDELUXE on my Mac system and used it to build FPC/Lazarus 3.0.4/Trunk. In about 1/2 an hour I had a usable compiler.
The FPCUPDELUXE program can be found here:
I needed to build the 64bit MacOS compiler, so I downloaded
Note: On MacOS, FPUPDELUXE must be installed properly into the Applications folder. I didn’t do that on my first attempt and had some access issues.
When you start FPUPDELUXE you will see:
Operation is quite straight forward.
- Click on setInstallDir and select where you want the blob of code (FPC and Lazarus).
- Select the Version of the FPC compiler. Note the branches stable, trunk, and fixesn.n. These are useful if you want the latest or just the fixes.
- Select the Version of Lazarus to install. Note that Lazarus relies upon various features of the FPC compiler. It would be a bad idea to select an FPC compiler older than what that version of Lazarus was released with.
- Finally, click on the Install/Update FPC+Laz button.
About 30 minutes later you will have a running compiler. So much easier than the manual method!
Once the compile is done, you will find a link to the Lazarus program in your home directory:
You will find that a Desktop Link was built as well:
There are many other options available including cross compiling to Raspberry Pi. If / When I use some of these options, I’ll document them as well.
Compiling Specific Revision
I discovered rather than just compiling trunk, I needed trunk up to a specific revision.
Click on setup, for Lazarus Branch, select trunk. For revision, enter the revision you want (62400 in my case).
After you enter the revision, it is recalled when you restart fpcupdeluxe.