Setting up Lazarus IDE for Amiga Crosscompiling
A amigaspirit.hu - pegasos.hu Wiki wikiből
A lap 2019. január 30., 12:49-kori változata
This page provides a brief summary of how to setup the Free Pascal Amiga crosscompiler to be used with Lazarus IDE from macOS, Linux, or Windows. It primarily applies to classic Amiga, but can be used with all Amiga-like systems with minor adaptations and changes.
This article expect that you have already set up Free Pascal Compiler and Lazarus IDE on the host system, and it's functioning perfectly, it can build native binaries for the host. It also assumes that the Amiga crosscompiler archives are is obtained (binary builds are available here) including the required GNU as/ld and/or vlink and vasm binaries, capable of running on the host system, producing binaries for the target system, in this case classic Amiga.
As a first step, make sure, that in the menu Tools -> Options... the Compiler Executable (e.g. fpc) option points to the fpc compiler frontend (e.g. /usr/local/bin/fpc), and NOT to a native compiler directly (e.g. ppc386, or ppcx64).
If this is done, make a new Lazarus project for your Amiga application. The rest of the options will be applied to project specific options.
Go to the Project Options window, available under the menu Project -> Project Options... and apply the following settings. First makes sure the Lazarus passes the right CPU target and OS target to the compiler. This is possible under the Compiler Options > Config and Target tab. For classic Amiga target, set these to Amiga and m68k respectively. Other Amiga-like systems use their respective combinations.
Second, go to the tab Compiler Options > Custom Options, and add the following options to the Custom Options field:
- -Cp option can be used to specify the target m68k CPU type. Note that you will need the runtime library units compiled with the same options.
- -Cf option is optional, can be used to specify the target m68k FPU type. Note that you will need the runtime library units to be compiled with the same options. By default, FPC compiles without utilizing FPU instructions.
- -XV enables linking with vlink. Omit this option if you want to use GNU LD.
- -Avasm enables linking with vasm. Omit this option if you want to use GNU AS.
- -FD option should point to the directory, where GNU as/ld or vasm/vlink for Amiga can be found.
- -Xp option should point to the directory, where the ppcross68k cross-compiler binary resides.
- -Fu option should point to the directory, where all the pre-compiled RTL units reside.
Any other FPC option can be applied here on demand.
Third, Lazarus enables use of the lineinfo unit for new projects by default. This is currently not available for classic Amiga, therefore must be disabled, because it would cause build errors. Other Amiga-like systems can skip this step. This can be done under Compiler Options -> Debugging by disabling the option Display line numbers in run-time error backtraces (-gl).
If you have done everything correctly Clicking Show Options in the bottom of the Project Options window should show something like this. This window shows the invoked compiler binary and all the options Lazarus will pass to it.
Note: while setting up this option and closing the Project Options window, the following requester might appear. This is caused by a minor issue in Lazarus, and it's safe to ignore, if the settings are otherwise correct.
If you have done everything correctly, invoking the menu Run -> Build will result a successful build for classic Amiga, or your chosen target system.