Difference between revisions of "Building from Source"

From Ultibo.org
Jump to: navigation, search
Line 4: Line 4:
 
=== Building Free Pascal ===
 
=== Building Free Pascal ===
 
----
 
----
 +
 +
The version of Free Pascal (FPC) included with Ultibo core has been modified to add the Ultibo target (-Tultibo) and to enable linking of the executable produced into a form that is suitable for use on Raspberry Pi. The complete source of the modified FPC can be found on GitHub in the [https://github.com/ultibohub/FPC Ultibo FPC] repository and can be downloaded (zip or clone) and overlayed onto the Ultibo core installation to allow rebuilding of FPC.
 +
 +
These instructions only relate to building the ARM cross compiler and use the native compiler installed with Ultibo core to perform the build, you can find instructions in the Free Pascal Wiki for building a native compiler for your platform if required.
 +
 +
Once you have the sources installed, open a command prompt and change to the directory where the FPC sources for Ultibo core are installed:
 +
 +
cd C:\Ultibo\Core\fpc\3.1.1\source
 +
 +
Set the path to include the Free Pascal compiler version used by Ultibo core:
 +
 +
set path=C:\Ultibo\Core\fpc\3.1.1\bin\i386-Win32
 +
 +
Delete any instances of fpmake.exe otherwise make will fail with an error (they will be recreated as part of the build):
 +
 +
del fpmake.exe /s
 +
 +
 +
Do a make distclean to remove unwanted files from previous builds:
 +
 +
make distclean OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a CROSSBINDIR=C:/Ultibo/Core/fpc/3.1.1/bin/win32-arm-none CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -OoFASTMATH" FPC=C:/Ultibo/Core/fpc/3.1.1/bin/i386-win32/ppc386.exe
 +
 +
Run make all to build the compiler, rtl and packages:
 +
 +
make all OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a CROSSBINDIR=C:/Ultibo/Core/fpc/3.1.1/bin/win32-arm-none CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -OoFASTMATH" FPC=C:/Ultibo/Core/fpc/3.1.1/bin/i386-win32/ppc386.exe
 +
 +
Finally run make crossinstall to install the new cross compiler, rtl and packages
 +
 +
make crossinstall CROSSBINDIR=C:/Ultibo/Core/fpc/3.1.1/bin/win32-arm-none CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPC=C:/Ultibo/Core/fpc/3.1.1/bin/i386-win32/ppc386.exe INSTALL_BASEDIR=C:/Ultibo/Core/fpc/3.1.1
 +
 +
The cross install will place all of the rtl and package files in the folder C:\Ultibo\Core\fpc\3.1.1\units\arm-ultibo but since these build instructions specify ARMV7A they will not be usable for Raspberry Pi A, B, A+, B+ and Zero. To resolve this delete the entire arm-ultibo folder in C:\Ultibo\Core\fpc\3.1.1\units and follow the instructions above to rebuild the Ultibo RTL for both ARMv6 and ARMv7.
  
 
=== Building Lazarus ===
 
=== Building Lazarus ===
Line 29: Line 60:
 
----
 
----
  
The information on this page is specific to building FPC and Lazarus on Windows but should be able to be modified to suit other platforms such as Linux. The links below provide more detailed information on building and installing FPC and Lazarus for users with advanced requirements.
+
The information on this page is specific to building FPC and Lazarus on Windows but should be able to be modified to suit other platforms such as Linux or Mac OS X. The links below provide more detailed information on building and installing FPC and Lazarus for users with advanced requirements.
  
 
* [http://wiki.freepascal.org/Installing_Lazarus Building Lazarus] - Detailed information and examples for building and installing Lazarus and FPC on a variety of platforms.
 
* [http://wiki.freepascal.org/Installing_Lazarus Building Lazarus] - Detailed information and examples for building and installing Lazarus and FPC on a variety of platforms.
 
* [http://wiki.freepascal.org/buildfaq Build FAQ] - The official Free Pascal build FAQ with full details on how to build FPC for many platforms.
 
* [http://wiki.freepascal.org/buildfaq Build FAQ] - The official Free Pascal build FAQ with full details on how to build FPC for many platforms.
 
* [http://wiki.freepascal.org/Cross_compiling Cross Compiling] - A guide to building FPC cross compilers for multiple platform combinations.
 
* [http://wiki.freepascal.org/Cross_compiling Cross Compiling] - A guide to building FPC cross compilers for multiple platform combinations.

Revision as of 01:07, 29 January 2016

Building the Ultibo RTL


Building Free Pascal


The version of Free Pascal (FPC) included with Ultibo core has been modified to add the Ultibo target (-Tultibo) and to enable linking of the executable produced into a form that is suitable for use on Raspberry Pi. The complete source of the modified FPC can be found on GitHub in the Ultibo FPC repository and can be downloaded (zip or clone) and overlayed onto the Ultibo core installation to allow rebuilding of FPC.

These instructions only relate to building the ARM cross compiler and use the native compiler installed with Ultibo core to perform the build, you can find instructions in the Free Pascal Wiki for building a native compiler for your platform if required.

Once you have the sources installed, open a command prompt and change to the directory where the FPC sources for Ultibo core are installed:

cd C:\Ultibo\Core\fpc\3.1.1\source

Set the path to include the Free Pascal compiler version used by Ultibo core:

set path=C:\Ultibo\Core\fpc\3.1.1\bin\i386-Win32

Delete any instances of fpmake.exe otherwise make will fail with an error (they will be recreated as part of the build):

del fpmake.exe /s


Do a make distclean to remove unwanted files from previous builds:

make distclean OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a CROSSBINDIR=C:/Ultibo/Core/fpc/3.1.1/bin/win32-arm-none CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -OoFASTMATH" FPC=C:/Ultibo/Core/fpc/3.1.1/bin/i386-win32/ppc386.exe

Run make all to build the compiler, rtl and packages:

make all OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a CROSSBINDIR=C:/Ultibo/Core/fpc/3.1.1/bin/win32-arm-none CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -OoFASTMATH" FPC=C:/Ultibo/Core/fpc/3.1.1/bin/i386-win32/ppc386.exe

Finally run make crossinstall to install the new cross compiler, rtl and packages

make crossinstall CROSSBINDIR=C:/Ultibo/Core/fpc/3.1.1/bin/win32-arm-none CROSSOPT="-CpARMV7A -CfVFPV3 -CIARM -OoFASTMATH" OS_TARGET=ultibo CPU_TARGET=arm SUBARCH=armv7a FPC=C:/Ultibo/Core/fpc/3.1.1/bin/i386-win32/ppc386.exe INSTALL_BASEDIR=C:/Ultibo/Core/fpc/3.1.1

The cross install will place all of the rtl and package files in the folder C:\Ultibo\Core\fpc\3.1.1\units\arm-ultibo but since these build instructions specify ARMV7A they will not be usable for Raspberry Pi A, B, A+, B+ and Zero. To resolve this delete the entire arm-ultibo folder in C:\Ultibo\Core\fpc\3.1.1\units and follow the instructions above to rebuild the Ultibo RTL for both ARMv6 and ARMv7.

Building Lazarus


Building or rebuilding Lazarus follows almost exactly the instructions provided with the official sources. The changes made to Lazarus for the Ultibo edition relate mostly to adding and removing menu items and options that are not relevant to embedded development, some of the makefiles have also been modified to remove components and reduce the size of what is distributed.

You will need to add the modified Lazarus sources to your installation before you can build Lazarus, these can be downloaded from the Ultibo Lazarus repository on GitHub. Either download the zip or clone the repository depending on your preference and then overlay the downloaded sources onto your Ultibo core installation.

Once you have the sources installed, open a command prompt and change to the directory where Ultibo core is installed:

cd C:\Ultibo\Core

Set the path to include the Free Pascal compiler version used by Ultibo core:

set path=C:\Ultibo\Core\fpc\3.1.1\bin\i386-Win32

Use make to build Lazarus and all the required components:

make clean all

Make will report any errors, otherwise once the build is completed the newly compiled version of Lazarus will be ready to use.

Additional Information


The information on this page is specific to building FPC and Lazarus on Windows but should be able to be modified to suit other platforms such as Linux or Mac OS X. The links below provide more detailed information on building and installing FPC and Lazarus for users with advanced requirements.

  • Building Lazarus - Detailed information and examples for building and installing Lazarus and FPC on a variety of platforms.
  • Build FAQ - The official Free Pascal build FAQ with full details on how to build FPC for many platforms.
  • Cross Compiling - A guide to building FPC cross compilers for multiple platform combinations.