Difference between revisions of "Building from Source"

From Ultibo.org
Jump to: navigation, search
Line 1: Line 1:
 
=== Building the Ultibo RTL ===
 
=== Building the Ultibo RTL ===
 
----
 
----
 +
 +
Ultibo core is actively being developed with new features and bug fixes added regularly. New releases of the installer download will be made available regularly but not as frequently as changes to the Ultibo core source itself, being open source also means that you have the opportunity to modify the source and experiment with ideas and changes (you might even choose to contribute some of those changes).
 +
 +
To take advantage of fixes and enhancements in the Ultibo core source without waiting for a new release of the installer you will need to rebuild the Ultibo run time library (RTL).
 +
 +
The latest version of the Ultibo core source is always available on GitHub in the [https://github.com/ultibohub/Core Ultibo Core] repository and can be downloaded as a zip file, or if you are comfortable with using git you can clone your own copy of it.
 +
 +
The folder structure of the repository is exactly the same as what is used by the Ultibo core installation so you can simply unzip the downloaded file and copy it over the top of what was installed. The repository starts at the <code>source</code> folder, if you look at your installation you will find the same folder at <code>C:\Ultibo\Core\fpc\3.1.1</code> so all you need to do is copy the contents of the zip to this folder and it will overwrite the current version with the new one.
 +
  
 
=== Building Free Pascal ===
 
=== Building Free Pascal ===
Line 21: Line 30:
 
  del fpmake.exe /s
 
  del fpmake.exe /s
  
 
+
Do a make distclean to remove files leftover after previous builds:
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
 
  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:
+
Check for any errors and 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
 
  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
+
If that was successful, 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
 
  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

Revision as of 01:55, 29 January 2016

Building the Ultibo RTL


Ultibo core is actively being developed with new features and bug fixes added regularly. New releases of the installer download will be made available regularly but not as frequently as changes to the Ultibo core source itself, being open source also means that you have the opportunity to modify the source and experiment with ideas and changes (you might even choose to contribute some of those changes).

To take advantage of fixes and enhancements in the Ultibo core source without waiting for a new release of the installer you will need to rebuild the Ultibo run time library (RTL).

The latest version of the Ultibo core source is always available on GitHub in the Ultibo Core repository and can be downloaded as a zip file, or if you are comfortable with using git you can clone your own copy of it.

The folder structure of the repository is exactly the same as what is used by the Ultibo core installation so you can simply unzip the downloaded file and copy it over the top of what was installed. The repository starts at the source folder, if you look at your installation you will find the same folder at C:\Ultibo\Core\fpc\3.1.1 so all you need to do is copy the contents of the zip to this folder and it will overwrite the current version with the new one.


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 files leftover after 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

Check for any errors and 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

If that was successful, 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.