Search code examples
linuxdelphifiremonkeywindows-subsystem-for-linux

How to target Linux Platform on Delphi?


I want to develop an app for Linux using Delphi, but Linux isn't a target platform option on my side:

Delphi IDE with Projects and target platforms

What are the steps to start developing and compiling apps for Linux using Delphi?

What do I need?


Solution

  • Here's a full guide for developing apps for Linux using Delphi:

    Setting up WSL2 (Linux Environment):

    1. Download Ubuntu from the Microsoft Store: Ubuntu WSL on Microsoft Store
    2. Once Ubuntu is installed, you can click on the Open button and set up your account: Ubuntu Terminal
    3. Make sure your Ubuntu WSL is fully up to date using the following command: Update Ubuntu

    sudo apt-get update -y && sudo apt-get upgrade -y

    1. Setup Delphi PAServer using the following command Setup Delphi PAServer on Ubuntu WSL

    curl -L https://embt.co/SetupUbuntu4Delphi22 | bash

    1. You can then launch/run Delphi PAServer with the following command: Run Delphi PAServer

    ~/pa22.sh

    Setting up the Delphi IDE:

    1. You need Delphi 10.4 or newer installed. This also needs to be the Enterprise Edition of the IDE.
    2. Additionally, you need to make sure you have the Linux Platform installed in your IDE: Delphi Platforms Install
    3. You need to install FMXLinux from the GetIt Package Manager: FMXLinux on GetIt Package Manager in Delphi
    4. Go to Tools > Options > Deployment > Connection Profile Manager and set up a connection to your PAServer in the Ubuntu WSL: Delphi Connection Profile Manager Connetion successful
    5. Go to Tools > Options > Deployment > SDK Manager and add a new Linux SDK: Delphi SDK Manager Add SDK in Delphi SDK Manager
    6. Now you can then create a new Multi-Device Application (FireMonkey/FMX) and you should see Linux as an option: Create a Multi-Device Application - Delphi (FireMonkey - FMX) Delphi IDE with Projects and target platforms with Linux selected
    7. If you don't see Linux, then you simply need to add it by right-clicking and selecting "Add Platform": Add Platform Linux Add Platform

    And that's it. Now you should be able to compile and build applications for Linux using Delphi.