Installing FastReport and FastCube components in Lazarus

2023-09-26

FastReport in Lazarus

The release of the new version of Delphi in 2023.3 introduced changes in the internal infrastructure of the products. In this article, we will talk about the installation of FastReport components in Lazarus.

The content of the article:

1. What’s new?
2. Comparison of versions and products;
3. Installing products in Lazarus;
3.1 Installing Lazarus for Windows;
3.2 Installing Lazarus for Linux;
3.3 Installing packages in Windows;
3.4 Installing packages in Linux.

What’s new?

FastReport, a report generation product, consists of several components, including a script engine, report building core, and localization packages. These components are distributed both in Rad Studio and Lazarus.

There are new packages in Lazarus. Previously, changing the language required extensive recompilation, but now we have the frLocalizationLibrary.lpk package that handles language switching. Each language is in the form of a separate package, for example, frLanguageGermanPkg.lpk, frLanguageJapanesePkg.lpk, and so on.

English, as before, is selected by default, so there is no separate language package for English.

Language switching does not even require restarting the application; it can be changed directly during operation.

To change the language, you need:
1. Place the TfrLocalizationController component on the form (from frLocalizationLibrary.lpk package);
2. Select the desired language in its Language property (for example, Italian); the list of languages depends on the packages installed in the IDE;
3. Add a language package (for example, frLanguageItalianPkg) in the project inspector;
4. Add the package name without the Pkg ending in the main unit code and in the uses section (for example, frLanguageItalian).

Additionally, we have allocated the frCoreLibrary.lpk and frGraphicsLibrary.lpk packages. They do not add new components but contain shared code for different products.
For convenience, all packages with the .lpk extension have been moved to a single directory. Users will no longer have to manually search for specific packages in different folders.
The remaining files are still distributed in directories as before, as required by Lazarus.

Additionally, the FastCube product was adapted for the Lazarus platform. You can read more about the FastCube product at this link. Try integrating FastCube into your project using trial components.

Comparison of versions and products

The best way to look at products is to look at what packages they contain.

Package name

Package description

FastScript

FastReport

FastCube

fs_lazarus.lpk

library for script execution

+

+

+

frCoreLibrary.lpk

auxiliary package with common basic functionality

+

+

+

frLocalizationLibrary.lpk

language management package

+

+

+

frLanguage*Pkg.lpk

40 language packs

+

+

+

frGraphicsLibrary.lpk

auxiliary package with the general graphical functionality

-

+

-

fr_lazarus.lpk

package with all the main components of the product

-

+

-

frxchartlazarus.lpk

package for charts (diagrams)

-

+

-

frxe_lazarus.lpk

package with exports

-

+

-

frxlazdbf.lpk

package for working with BDF format database

-

+

-

frxlazsqlite.lpk

package for working with the SqLite DBMS

-

+

-

frxPDFlazarus.lpk

package for displaying PDF documents (Windows only)

-

+

-

frxrichlazarus.lpk

package for displaying Rich documents (recommended for Windows only due to basic package limitations)

-

+

-

frCS_lazarus.lpk

a package with client-server components, you can find them here

-

+*

-

fcxLazarus.lpk

package with all the main components of the product

-

-

+

fcxprint.lpk

package for integration with FastReport

-

-

+

fcxprintTee.lpk

package for integration with the FastReport Chart (diagrams) 

-

-

+

fcxScript.lpk

package for integration with FastScript

-

-

+

fcxexport.lpk

package with FastCube exports

-

-

+

fcxCharting.lpk

package for charts (diagrams) in FastCube

-

-

+

*Client-server components are included in FastReport only in the Enterprise license.

Let’s also look at the Trial and Academ licenses of the corresponding products.

Trial is needed to test a product before purchasing, Academ is used for educational purposes and is not used in commercial projects.

Both licenses include pre-compiled versions of stripped-down packages.

FastScript Trial has one limitation—running scripts is not available.

Limitations of FastReport Trial:
- English only;
- Printing and export is limited to 5 pages with a Trial note in the corner;
- Missing Rich View.

Limitations of FastReport Academ:
- Printing and export are marked with an editorial watermark;
- Missing Rich View, 2D barcodes, most exports.

FastCube Trial has one limitation—the “TrialString” text is displayed in random cells instead of data.


Installing FastReport in Lazarus

Let’s start with Lazarus. First, we need to install the software for our operating system.

Installing Lazarus for Windows

Download the Lazarus installation package from the official website and select the bit depth of your system.

Installing Lazarus for Windows

For Windows, the Lazarus installer fits into just one .exe file, and there should be no problems with it.

Next, we download the required version of the archive from the official website.

Installing Lazarus for Windows

From the downloaded archive, copy the contents to C:\Windows\System32 and C:\Lazarus, and then reboot Windows. Then we launch Lazarus and configure it. Just click “OK” and agree to the default settings.

Installing Lazarus for Linux


There are 2 ways to install Lazarus on Linux. The first method is through a package manager. To do this, enter one of the following commands in the terminal:

// DEB Users -
sudo apt-get install lazarus
// RPM Users -
sudo yum install lazarus
// or
sudo dnf install lazarus

This is very fast and easy, and this command will install the "stable" version of Lazarus (referring to the latest thoroughly tested version available on your distribution, which may differ for different distributions). The stable version may lag behind the most current version.

Unlike Delphi and Rad Studio, our components do not support older versions of Lazarus. Thus, there may be situations where our products will not work with the stable version. Our components for Lazarus are developed only for the latest version of Lazarus.

This is especially relevant for major (release) updates of Lazarus. If the stable version differs insignificantly from the current version, there is a high chance that our components will work correctly. Our company is not responsible for the correct operation with this version. As a user, you do this "at your own risk." In the worst case, you will lose some time updating Lazarus to the current version.

But even more important is the case of precompiled components (Trial and Academic editions). The main feature of precompiled Lazarus packages is that they will only work on the version of Lazarus on which they were compiled (i.e., the current version).

Therefore, we recommend the second method, namely manual installation of the packages.

As in Windows, first of all, download the Lazarus installation package from the official website (https://www.lazarus-ide.org/).

Installing Lazarus for Linux

Each item in this list consists of 4 files (3 installer packages and a text file).
- Lazarus installation package (project);
- Installation package fpc-src;
- Installation package fpc (laz);
- README.txt file.

It is important to install them in the right order. First fpc (laz), then fpc-src, and lastly, Lazarus (project).

Let's take a closer look at the installation process itself. The thing is, the latest Lazarus (project) package in most distributions will have around 100 missing dependencies.

Therefore, the easiest way is to install packages through some graphical auxiliary application (for example, QApt or GDebi), which will automatically download the necessary auxiliary packages.

But if you use simpler utilities that do not automatically download dependencies (for example, dpkg), then after installation, you will have to install them yourself. This is often done very simply. In our example, after installing the package with unresolved dependencies, you will simply need to enter the following command:

sudo apt-get -f install

This completes the installation of Lazarus on Linux.

Let’s fix the problem with fonts first. All operating systems have default fonts. For example, the Arial font is the default in both Windows and, say, Ubuntu. But in fact, Arial installed by default in Ubuntu is not the same Arial installed in Windows. Thus, text reports created in Windows Lazarus will look bad on Linux Lazarus (and vice versa).

To avoid this, let’s immediately install fonts in Linux as in Windows. For Ubuntu you can do this this with the command:

sudo apt-get install msttcorefonts

However, the command may be different for other Linux distributions. Next, for SqLite to work correctly, install the following packages: sqlite3, libsqlite3-dev. You can read more here (https://wiki.freepascal.org/SQLite).

For Ubuntu, this can be done with the command:

sudo apt-get install sqlite3 libsqlite3-dev

Launch Lazarus and configure it. Click “Ok” and agree to the default settings.

Installing packages on Windows

Our new Windows installer will install all the packages for you. Just launch it and follow the instructions.

Installer Welcome Window

Selecting the IDE and version to install

It’s also worth noting that you don’t have to search for Lazarus directories all over your computer; you need to use the settings files generated when installing Lazarus. Therefore, our installer will not find your 2 or 3 Lazarus, which you copied by hand.

If you want to have several Lazarus on your device and each one has FastReport or our other product, then run the Lazarus installer and check the “multi-install” box to install a second copy of Lazarus.

Multi-install feature in the Lazarus installer

Installing packages on Linux

For Linux, you need to download the appropriate .deb or .rpm package from the official website and install it. Now they are simply unpacked into the appropriate folder in the “/usr/share/...” directory. The directory is specified in the description of the package itself.

Automatic package installation similar to Windows is not currently planned for Linux.

If you are new to Linux, we recommend copying the unzipped product to your home directory (“/home/username/”) to avoid dealing with access rights.

As said above, all .lpk files are collected in the Lpks folder. To install packages, click Package -> Open Package File .lpk, select the package in the file manager, and you will see the following window:

Installation window

In it, click Compile for Professional and higher, wait until the compilation is complete, and click Use.

For Academic and Trial, immediately click Use. Lazarus will reboot after installing each package.

Previously, we mentioned a strict order of package installation. But this approach has become irrelevant for many reasons (an increased number of packages, more complex connections between packages, and also considering that they are all located in the same folder). You can easily find the package that appears in the dependencies of the one you want to install.

However, you can install all the packages at once, and Lazarus itself will deal with the compilation order, for this:

1. In Lazarus, select “Package” -> “Open Package File (.lpk)”;
2. Select all required packages and click “open”;
3. Select “Package” -> “Install/Delete packages”;
4. In the “Available for installation” column (on the right), select the required packages;
5. Click “Save and restart IDE.”

Before version 2.0.0, compilation and (or) installation errors were very common; at the time of writing this document, the latest version is 2.2.6 and this error has not yet been completely removed in Lazarus, but its likelihood has been significantly reduced.

If 1 of your packages won’t compile or install, then you’ll have to go down and recompile or reinstall the package’s dependencies.

Installation window

To do this, double-click on the required package, recompile, and then reinstall.

After successfully installing all the packages, click on Project -> Open Project and open the project fast-report\LDemo\FRDemo.lpi and try to run it. Then click the Design button.

If you get this negative height error in Linux:

Negative height error

This bug can be found in some rare GTK interfaces. Just run the application without debugging or check the box next to “Ignore this type of exception.”

*Or change the graphical shell. For example, this bug does not appear in the KDE Plasma GTK shell.

One last detail that is important for you to know is that our designer uses multithreading, which is disabled by default in Linux Lazarus. To enable it, open the project inspector (Project -> Project Inspector), find the file with the “.lpr” extension, and add the “cthreads” unit as the first item in the “uses” section.

August 08, 2024

How to install FastReport .NET and its components on Windows

Step-by-step instructions for online and manual installation via the FastReport registration code.NET and its components in Windows.
December 11, 2023

New S3 transport (Amazon) in FastReport VCL

In this article, we will look at the new transport in S3 (Amazon) for FastReport VCL, which is an object storage of files and buckets.
October 04, 2023

How to generate a report from an ASP.NET Core application using FastReport.Core.Skia

We tell you how to generate a report on Windows and Linux using FastReport.Core.Skia and a private NuGet server.
Fast Reports
  • 800-985-8986 (English, US)
  • +4930568373928 (German)
  • +55 19 98147-8148 (Portuguese)
  • info@fast-report.com
  • 901 N Pitt Str #325 Alexandria VA 22314

© 1998-2024 Fast Reports Inc.