Introduction to FmxLinux
Delphi’s FireMonkey for Linux Solution
Jim McKeeth
Embarcadero Technologies
jim.mckeeth@embarcadero.com
Chief Developer Advocate & Engineer
For quality purposes, all lines except the presenter are muted
IT’S OK TO ASK QUESTIONS! Use the Q&A Panel on the Right
This webinar is being recorded for future playback.
Recordings will be available on Embarcadero’s YouTube channel
Your Presenter:
Jim McKeeth
Embarcadero Technologies
jim.mckeeth@embarcadero.com | @JimMcKeeth
Chief Developer Advocate & Engineer
Agenda • Overview
• Installation
• Supported platforms
• PAServer
• SDK & Packages
• Usage
• UI Elements
• Samples
• Database Access FireDAC
• Migrating from Windows VCL
• midaconverter.com
• 3rd Party Support
• Broadway Web
Why FMX on Linux?
• Education - Save money on Windows licenses
• Kiosk or Point of Sale - Single purpose
computers with locked down user interfaces
• Security - Linux offers more security options
• IoT & Industrial Automation - Add user
interfaces for integrated systems
• Federal Government - Many govt systems
require Linux support
• Choice - Now you can, so might as well!
Delphi for Linux History
• 1999 Kylix: aka Delphi for Linux, introduced
• It was a port of the IDE to Linux
• Linux x86 32-bit compiler
• Used the Trolltech QT widget library
• 2002 Kylix 3 was the last update to Kylix
• 2017 Delphi 10.2 “Tokyo” introduced Delphi for x86 64-bit Linux
• IDE runs on Windows, cross compiles to Linux via the PAServer
• Designed for server side development - no desktop widget GUI library
• 2017 Eugene Kryukov of KSDev release FmxLinux
• Eugene was one of the original architects of FireMonkey
• A modification of FireMonkey, bringing FMX to Linux
• 2019 Embarcadero includes FmxLinux with Delphi 10.3.2 “Rio”
FmxLinux Overview
• Eugene Kryukov of KSDev created FmxLinux
• Eugene was one of the original architects of FireMonkey
• The installation modifies FireMonkey and adds additional libraries
• FmxLinux still uses the same Delphi compiler for x86 64-bit Linux
• It does not support ARM Linux like the Raspberry Pi
• The IDE runs on Windows and connects to Linux via PAServer
• Uses the same FireMonkey framework and components from
Windows, macOS, Android and iOS
• Works with the RTL, FireDAC, Live Bindings, and other Delphi libraries
• Included with RAD Studio & Delphi 10.3.1 “Rio” and newer under
Update Subscription
• docwiki.embarcadero.com/RADStudio/en/FireMonkey_for_Linux
FireMonkey & VCL - FmxLinux vs. CrossVCL
• KSDev also makes CrossVCL which allows VCL on Linux and macOS
• Embarcadero includes FmxLinux with Delphi & RAD Studio 10.3.1+
• Why? FireMonkey is designed to be cross platform
• Felt FmxLinux made more sense as a Linux GUI solution
• You are still able to purchase CrossVCL from KSDev at crossvcl.com
• If you have an existing VCL application you want to bring to Linux try
midaconverter.com to first convert it to FireMonkey
FmxLinux Installation
FmxLinux Installation Overview
• Available via GetIt
• For Delphi or RAD Studio Rio 10.3.1+ with active Update Subscription
• Supported Platforms
• Must be x86 64-bit Linux Desktop (or server with Desktop installed)
• Officially: Ubuntu 18.04 LTS, Ubuntu 16.04 LTS, Ubuntu 14.04 LTS, and RedHat
Enterprise Linux (version 7)
• docwiki.embarcadero.com/PlatformStatus/en/Main_Page
• docwiki.embarcadero.com/RADStudio/en/Supported_Target_Platforms
• Unofficially: Most any Linux if you install the right packages in the right place
• List of 134 successfully test distros (YMMV)
bitbucket.org/crossvcl/fmxlinux/issues/130/controlsdemo-test-on-different-linux
• Known to fail on 4: KNOPPIX 8.1, 4MLinux 27.0, elementary OS 5.0, & GALPon MiniNo
Queiles 3.1
• Still uses PAServer & requires SDK & Packages installed and setup
134 Successfully Tested Linux Distros
ALT Linux 8.2; Antergos 17.11.; antiX 17.2; ArchBang Linux Winter 0112; Archman KDE Plasma 2019.02; ArcoLinux v18.11.2; Argent
KDE Plasma 1.5.2; Artix Linux LXQT 2018.10.13; AryaLinux 1.0 XFCE; Asril OS 7.0 Lare; AUSTRUMI 3.9.0; AV Linux (2018.06.25);
B2D Desktop 2019 V1.0.5 XFCE; BackBox Linux 5.2; Berry Linux 1.30; BigLinux 7.10; Bionicpup64 8.0 CE; BlackArch Linux
2018.12.01; Black Lab Enterprise Linux 8; blackPanther OS v18.1; BlackWeb 1.2; BlankOn 11.0.1; Bluestar Linux 4.19.2; Bodhi Linux
5.0.0; BunsenLabs Linux Helium; CAELinux 2018; CAINE 10.0; Calculate Linux 18; CentOS 7; ChaletOS 16.04.2; Chakra
GNU/Linux 2019.01; Condres OS 2019.03 Gnome Edition; Debian 9.1; Deepin 15.4.1; Devuan 2.0.0 ASCII; DuZeru; EasyOS 1.0.8;
Endless OS 3.5; ExTiX 19.0; EducatuX 9.8; Enso 0.3.1; ETi-pup 5.1.6; Fatdog64 Linux 800; Fedora 26; Feren OS (July 2018);
Freespire 4.5.; GeckoLinux Static Plasma; Gentoo Linux 2016.07.04; Greenie Linux 18.04.0.2; Grml 2018.12; GoboLinux 016.01;
Hamara Sugam 2.1; Kali Linux 2017.2; Kanotix Steelfire KDE; KaOS 2018.01; KDE neon; Kubuntu 18.10; KXStudio 14.04.5;
Linspire 8.0 RC1; Linux Kodachi 5.2; Linux Lite 4.2; Linux Mint 18.1; Lubuntu 17.10; LuninuX OS 17.04; LXLE Linux 16.04.4; Mageia
6.1; MakuluLinux 15 Flash Edition; Manjaro Linux 17.0; Maui Linux 17.06; MAX: Madrid_Linux 10.0; MAZON OS 1.4.3.l;
MorpheusArch Linux 2018.4; MX Linux 17.1; Namib GNU/Linux Budgie 18.08; Neptune 5.6; Nova 6.0; NuTyX MATE 10.4;
OpenMandriva Lx 3.0; openSUSE Leap 42.2; Oracle Linux 7.6; OSGeoLive 12.0; Pardus 17.4 XFCE; Parrot Studio 3.8; PCLinuxOS
2017.07; Peach OSI 16.04 TW; Pearl Linux MATE 7.0; PelicanHPC GNU Linux 4.1 XFCE; Pentoo 2018.0; Peppermint 9; Pinguy OS
18.04.1; Pisi Linux 2.1 ATA; Plop Linux 4.3.9; Pop!_OS 18.10; Porteus 4.0 MATE; Poseidon Linux 9 MB2315; Q4OS 2.6 Scorpion;
Rebellin Linux 3.5 Gnome; Redcore Linux Hardened 1806; Red Hat Enterprise Linux 7; Refracta 8.3; Resilient Linux 1.0;
Robolinux Cinnamon 10.3; ROSA Fresh KDE R10; Runtu LITE 18.04; Sabayon Linux 18.05 GNOME Edition; SalentOS 2.0; Salix
Xfce 14.2; Scientific Linux 7.4; SELKS 4.0; Septor-2019; SharkLinux 4.15.0-39; siduction 18.3.0 XFCE; Slax 9.8.0; Slackel 7.1;
Slontoo 18.07.1 MATE; Solus 3 GNOME; SolydXK 201902; SparkyLinux 4.9; SuliX Professional 8; SuperX 5.0; SwagArch
GNU/Linux 18.12; Tails 3.10.1; Trisquel 8.0 LTS Flidas; Tsurugi Linux Lab 2018.1; Ubuntu 16.10; Ubuntu Budgie 18.04.1; Ubuntu
MATE 18.04.1; Ubuntu Studio 18.10; Ultimate Edition 5.0; Uruk GNU/Linux 2.0 XFCE; Void Linux MATE (2018.11.11.); Voyager
18.04 LTS; Xubuntu 18.04; Zorin OS 12.1 Core
Working Platforms Personally Tested
• elementary OS 5.0 “Juno”
• Red Hat Enterprise Linux 8
• Mint 19.1
• Bionic Puppy Linux 8
• Deepin 15
• Debian 9
• Manjaro 18
• Zorin 12.4
• MX Linux 18.3
• openSUSE Leap 15.1
• CentOS 7
• Fedora 30
• Ubuntu 18.04.2 LTS
Cursors
CustomFont
Installation CustomIcon
EventSim
FontList
● Available via GetIt GetFileIcon
● Delphi or RAD Studio GtkWindow
Samples installs to Screenshot
● Rio 10.3.1+ C:\Users\Public\Documents\Embarcadero\Studio\ ShellApi
20.0\Samples\Object Pascal\FMX Linux Samples WebScript
● Update Subscription
required
FmxLinux installs to
C:\Users\Public\Documents\Embarcadero\Studio\
20.0\CatalogRepository\FmxLinux-1.41
Download Link Ubuntu 18.04.2 LTS
ubuntu.com/download/desktop “Bionic Beaver”
Update
sudo apt-get update && sudo apt-get upgrade && sudo apt-get
dist-upgrade
Install Dev Packages
sudo apt-get install wget p7zip-full build-essential
Clean-up
sudo apt-get autoremove && sudo apt-get autoclean
Download & Install (Requires creating an account)
• developers.redhat.com/rhel8/
• developers.redhat.com/rhel8/install-rhel8/
Update (Requires Red Hat account)
sudo subscription-manager register --auto-attach
sudo yum repolist
sudo yum update
Install Dev Packages
sudo yum groupinstall 'Development Tools'
Firewall for PAServer
sudo firewall-cmd --zone=public --add-port=64211/tcp --permanent
sudo firewall-cmd --reload
PAServer Install
• PAServer connects the IDE to Linux
• Copy from your install, or download
• Full instructions
docwiki.embarcadero.com/RADStudio/en/Installing_the_Platform_Assistant_on_Linux
To install from the web . . ..
cd ~
wget http://altd.embarcadero.com/releases/studio/20.0/PAServer/Release1/LinuxPAServer20.0.tar.gz
tar -xvf LinuxPAServer20.0.tar.gz
rm LinuxPAServer20.0.tar.gz
mv PAServer-20.0/ PAServer/
PAServer/paserver
Using FmxLinux
Using FmxLinux
• Open new or existing FireMonkey application
• New projects need to be saved
• Right click on the Project in the Project Manager
• Choose “Add Linux Platform”
• Linux is now included as a platform
• Make sure the Linux Platform and SDK are setup
correctly
• Once the SDK is imported, a Linux platform is no
longer needed to build (unlike iOS)
• You could manually copy SDK from another computer
Connection Profile Manager - 1
• Tools -> Options -> Deployment -> Connection Profile Manager
• Click [Add]
• Provide
• Profile name
• Platform
• Host Address
• Port number
• Password (optional)
Connection Profile Manager - 2
• Tools -> Options -> Deployment -> Connection Profile Manager
• Click [Add]
1
• Provide
• Profile name
• Platform
• Host Address
• Port number
• Password (optional) 2
SDK Manager - 1
• Tools -> Options -> Deployment -> SDK Manager
• Click [Add]
• Select
• Platform
• Connection
• SDK Version
• Wait while the SDK
imports
SDK Manager - 2
• Typically need only one Linux SDK to
support multiple Linux distros
• You can typically replace existing files
during import (I always click “Yes to all”)
• Pay attention if you get missing folder in
the log file. It might indicate you didn’t
install the dev packages on Linux
Troubleshooting SDK Import
• The import is based on defaultsdkpaths files found in the bin folder
• C:\Program Files (x86)\Embarcadero\Studio\20.0\bin
• In 10.3.1 Linux has 3 different definitions (in XML format)
• Linux64.defaultsdkpaths
• rhel7.2.defaultsdkpaths
• ubuntu14.4.defaultsdkpaths
• If a file is missing during build or there is an error in the log
• Figure out how to install it on Linux
• Use the Linux find command to figure out where it is installed
• Modify your defaultsdkpaths files to point to the correct locations
• Use [Update Local File Cache] button once changes are made
FmxLinux Demos
Samples installed to
Samples C:\Users\Public\Documents\Embarcadero\Studio\
20.0\Samples\Object Pascal\FMX Linux Samples
• Cursors - Capturing the desktop cursor image
• CustomFont - Using a custom font
• CustomIcon - Changing the main window font icon
• EventSim - Simulate keyboard and mouse events
• FontList - List installed fonts
• GetFileIcon - Display the icon for a file
• GtkWindow - Use GTK directly to manipulate a window
• Screenshot - Take a screenshot of the desktop
• ShellApi - Open URLs and Files with associated programs
• FmxWebScript - Use FireMonkey to draw graphics in a web CGI-BIN
Note About CustomFont Sample
• The font file passed to the FmuxAddCustomFont call must exist locally
• You can use the Deployment manager to deploy it to Linux
• Side note about libfmux.so
• You might see libfmux.so in some of the deployment manager for some samples,
or a warning about it while building
• It is an artifact from when the library was dynamically linked
• It is statically linked now, and no longer needed
Note About GtkWindow Sample
• The GtkWindow Sample has early bound dynamic linking
procedure gtk_window_set_title(window: Pointer; title: PUtf8Char);
cdecl; external 'libgtk-3.so.0';
• You might get an error on linking (something like)
ld-linux.exe: error: cannot find -lgtk-3
undefined reference to 'gtk_window_set_title'
• The solution: Install libgtk-3-dev and update the SDK’s Local File Cache
sudo apt-get install libgtk-3-dev
Note About CustomIcon Sample
• The new icon is loaded as a resource
• Project -> Resources & Images
• PNG File
• Identifier MAINICON
• Resource type RCDATA
• Include the dres in the dpr file
• {$R *.dres}
Creating an Icon Launcher aka [Desktop Entry]
• Create a .desktop file to customize the icon (like a Windows shortcut)
• Used by both Gnome, KDE, etc.
• The .desktop file must have execute permissions
• To show up in the Application list, copy to either
• ~/.local/share/applications
• /usr/share/applications
• Sample:
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Name=My FmxLinux Program
Comment=I made this program with Delphi and FmxLinux!
Exec=/home/jim/PAServer/scratch-dir/jim-Ubuntu/CoolApp/CoolApp
Path=/home/jim/PAServer/scratch-dir/jim-Ubuntu/CoolApp/
Icon=/home/jim/PAServer/scratch-dir/jim-Ubuntu/CoolApp/MainIcon.svg *.png
Terminal=false *.svg
Type=Application
Categories=Utility;Development;
https://wiki.archlinux.org/index.php/Desktop_entries
https://specifications.freedesktop.org/desktop-entry-spec/latest/
Media Player
• Requires the free VLC installed on Linux
• Fedora 30/29/28
• sudo dnf install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E
%fedora).noarch.rpm
• sudo dnf install vlc
• CentOS/RHEL 7
• sudo rpm -Uvh
http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
• sudo rpm -Uvh
http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm
• yum install vlc
• Ubuntu / Debian
• sudo apt-get install vlc
Using FMX to Generate Web Server Graphics
• This is different than the Broadway server that serves the entire UI
• Allows you to use FMX to generate graphics and effects via CGI-BIN
• Create a standard Apache module
• Linux dependencies
• sudo apt install libgl1-mesa-glx libglu1-mesa libgtk-3-common libgstreamer1.0
libgstreamer-plugins-base1.0
• More information
ksdev.blogspot.com/2017/12/using-firemonkey-graphics-in-cgi-script.html
HTML5 Web Deployment
● Install Required Libs:
sudo apt install xorg libgl1-mesa-dev
libosmesa-dev libgtk-3-bin
● Start broadway server: broadwayd
● Run application with:
GDK_BACKEND=broadway ./myapp
● Load [ip]:8080 in the browser
● Note: Only supports a single user
instance at a time
● Broadway is a feature of GTK+
● For more information
developer.gnome.org/gtk3/stable/gtk-broadway.html
Current Select 3rd Party Support
• TScene - github.com/eugenekryukov/TScene - Isolated buffered container control
• TMS FMX UI Pack - tmssoftware.com/site/tmsfmxpack.asp - Set of highly configurable and
styleable components
• Steema TeeChart - steema.com - Hundreds of Graph styles in 2D and 3D for data visualization,
56 mathematical, statistical and financial Functions, with an unlimited number of axes
• Steema TeeGrid - www.steema.com - Lightweight and fully-featured grid control (not derived
from TCustomGrid or TGrid)
• Woll2Woll FirePower - woll2woll.com/firepower - The most critical components for building
professional desktop and mobile user-interfaces
• HTML Component Library - delphihtmlcomponents.com - HTML Component Library is a
cross-platform and 100% native HTML/CSS rendering library
• TatukGIS Developer Kernel 11 - tatukgis.com - Professional grade geographic information
system (GIS) SDK for desktop and mobile
QUESTIONS!
: @embarcaderotech
FREE 30 Day Trial Architect
Edition on our website!
: Embarcadero Technologies
ple Full-Bleed
kground image.
Sparingly. Too
y distract in a
entation.
e Sure photos are
r own or approved.
uld have enough
ite space” when
g text. Text
uldn’t be hard to
d!
There icons are editable shapes.
This means that you can:
● Resize them without losing quality.
● Change fill color and opacity.
● Change line color, width and style.
Examples:
Place your screenshot here
Place your screenshot here
Place your Place your
screenshot screenshot here
here