- Linux Application Development
- Contents
- Prerequisites
- Preparing Your Linux Development Environment
- Installing Development Packages
- Preparing Your Linux Machine
- Creating a Connection Profile
- Adding the Installed SDK to RAD Studio
- Running PAServer on Linux machine
- Developing Your Application
- See Also
- jimmckeeth / SetupUbuntu4Delphi22.sh
- Установка Delphi 7 на linux
- Get started writing Linux apps with Delphi 10.3 and 10.4
Linux Application Development
RAD Studio allows you to develop applications for the target Linux platform. Using RAD Studio installed on Windows machine, you can create a 64-bit Linux application and deploy it to the Linux machine. Developing Linux applications is similar to creating Android apps in RAD Studio. However, for Linux, you cannot create the visual VCL and FireMonkey applications. Here is the list of apps that are available for the Linux platform:
- Console Application
- EMS Package (RAD Server)
- DataSnap
- DataSnap WebBroker
- WebBroker
- Dynamic-link Libraries
- DUnitX Project
Contents
Prerequisites
To develop Linux applications, you need to have the RAD Studio installed on the Windows PC as well as a machine with the Linux platform (can be a virtual machine).
Preparing Your Linux Development Environment
To prepare your development system (PC) and Linux machine for application development with RAD Studio:
Installing Development Packages
To install the development packages on Ubuntu:
- Right-click your desktop and select Open Terminal.
- To upgrade the packages you have already installed , type sudo apt update && sudo apt upgrade && sudo apt dist-upgrade in the terminal.
- Type your user password and press Enter
- Wait until prompted to agree to the package upgrade operation. Type Y and press Enter
- Wait until the package upgrade operation is complete. It may take a few minutes to complete.
- To add the development packages, type sudo apt install joe wget p7zip-full curl openssh-server build-essential zlib1g-dev libcurl4-gnutls-dev libncurses5 in the terminal.
- Type your user password and press Enter
- Wait until prompted to agree to the package installation operation. Type Y and press Enter
- Wait until the pacjage installation operation is complete. It may take a few minutes to complete.
To install the development packages on Red Hat:
- Right-click your desktop and select Open Terminal.
- Type yum groupinstall ‘Development Tools’ in the terminal.
- Press Enter and wait until the package installation operation is complete. It may take a few minutes to complete.
Preparing Your Linux Machine
To create Linux applications, you need to add a virtual machine PAServer:
1. Find the LinuxPAServer22.0.tar.gz file in the following location: C:\Program Files (x86)\Embarcadero\Studio\22.0\PAServer\LinuxPAServer22.0.tar.gz 2. Unpack the LinuxPAServer22.0.tar.gz file.
To use the System.zLib unit on Red Hat:
1. Install the zLib-devel library to your RHEL machine with the following command: sudo yum install zlib-devel 2. Update the local SDK cache.
To use the System.zLib unit on Ubuntu:
1. Install the zLib-devel library to your Ubuntu machine with the following command: sudo apt-get install zlib1g-dev 2. Update the local SDK cache.
Creating a Connection Profile
- Right-click the folder where you have unpacked the LinuxPAServer22.0.tar.gz file, and then click Open in Terminal.
- Enter ./paserver in terminal. Then, press Enter.
- On the Tools > Options > Environment Options > Connection Profile Manager page, click the Add button. The Create a Connection Profile wizard opens.
- On the Profile information page, enter the following:
- In the Profile name field, enter the needed name.
- In the Platform field, click the 64-bit Linux platform.
- Click Next.
- On the Remote machine information page, enter the following:
- In the Remote machine field, enter the IP address or Machine name.
- Click Test Connection to check if the values are valid.
- Click Finish.
Adding the Installed SDK to RAD Studio
- On the Tools > Options > Environment Options > SDK Manager page, click the Add button.
- In the Add a New SDK dialog, enter the following:
- In the Select a platform field, click 64-bit Linux.
- In the Select a profile to connect, select a created profile from the drop-down list.
- In the Select an SDK version field, the name of the SDK that you just installed will automatically appear. If you have not installed SDK previously, you can do it on this step. If you have already installed SDK, move on to the next step.
Running PAServer on Linux machine
To run the PAServer on your Linux machine:
Developing Your Application
- Select the project type for your Delphi application.
- File > New > Other > Delphi Projects:
- Console Application
- DUnitX Project
- Dynamic-link Library
- Package
- File > New > Other > Delphi Projects > DataSnap Server:
- DataSnap Server
- DataSnap WebBroker
- File > New > Other > Delphi Projects > WebBroker > WebBroker Application
- File > New > Other > Delphi Projects:
See Also
jimmckeeth / SetupUbuntu4Delphi22.sh
The below Bash script works with Ubuntu 20.04 LTS and 22.04 LTS, on WSL2, VM, or hardware install.
Installing WSL2 on Windows 11
Microsoft has a full article with all the details. This is a summary for quick reference.
On Windows you need to do this from an elevated (administrator) command prompt or PowerShell window. Easiest way is Win+X,A.
Once your machine has finished rebooting, installation will continue and you will be asked to enter a username and password. This will be your Linux credential for the Ubuntu distribution.
Start Ubuntu from the start menu, or from the terminal by typing ubuntu
Then run the following script
curl -L https://embt.co/SetupUbuntu4Delphi22 | bash
If you don’t have curl installed then run sudo apt install curl -y first
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
#! /bin/bash |
# |
# Download and execute with the following: |
# curl -L https://embt.co/SetupUbuntu4Delphi22 | bash |
# |
echo » Updating the local package directory « |
sudo apt update |
echo » Upgrading any outdated pacakges « |
sudo apt full-upgrade -y |
echo » Install new packages necessary for Delphi & FMXLinux « |
sudo apt install joe python3 libpython3-dev wget p7zip-full curl libgtk-3-dev openssh-server build-essential zlib1g-dev libgtk-3-dev libcurl4-gnutls-dev libncurses5 xorg libgl1-mesa-dev libosmesa-dev libgtk-3-bin -y |
echo » Clean-up unused packages « |
sudo apt autoremove -y |
cd ~ |
echo » Downloading Linux PAServer for Alexandria 11.3 (22.0) « |
wget https://altd.embarcadero.com/releases/studio/22.0/113/LinuxPAServer22.0.tar.gz |
echo » Setting up directories to extract PA Server into « |
mkdir PAServer |
mkdir PAServer/22.0 |
rm PAServer/22.0/ * |
tar xvf LinuxPAServer22.0.tar.gz -C PAServer/22.0 —strip-components=1 |
# This fixes the Python 3.6 dependency |
ln -sf ` ls -1 /usr/lib/x86_64-linux-gnu/libpython3. * .so.1.0 | tail -1 ` ~ /PAServer/22.0/lldb/lib/libpython3.so |
rm LinuxPAServer22.0.tar.gz |
echo \#\!\/ bin \/ bash > pa22.sh |
echo # https://docwiki.embarcadero.com/RADStudio/en/Setting_Options_for_the_Platform_Assistant >>pa22.sh |
echo ~ /PAServer/22.0/paserver >> pa22.sh |
chmod +x pa22.sh |
echo » ———————————— « |
echo » To launch PAServer type ~/pa22.sh « |
echo » ———————————— « |
# ~/pa22.sh |
exit |
Установка Delphi 7 на linux
Решил полностью перейти на Ubuntu и сталкнулся с проблеммой.а как устанавливать программы win32,в часности Delphi 7.
Есть конечно аналоги,например Kylix,но это не то.
Решение:
В этом нам поможет Wine
Wine (/waɪn/ — между «уа́йн» и «вайн») — это свободное программное обеспечение, позволяющее пользователям UNIX-подобных систем архитектуры x86 (и других архитектур, при наличии совместимости, например, AMD64) исполнять 16- 32- и 64- битные приложения Microsoft Windows (64-битные приложения находятся в стадии ранней реализации). Wine также предоставляет программистам библиотеку программ Winelib, при помощи которой они могут компилировать Windows-приложения для портирования их в UNIX-подобные системы. Название Wine является рекурсивным акронимом и расшифровывается «Wine Is Not an Emulator» — «Wine — не эмулятор» (имеется в виду, что Wine не является эмулятором компьютера, как, например, qemu или VirtualBox, Wine — это альтернативная реализация Windows API).
После установки wine,разархивируйте туда(обзор диска Синсталятор Delphi 7.
Откройте ком.строку и наберите:
wine «C:\\ путь \install.exe»
Начнётся инсталляция,у вас появится ошибка ,проигнарируйте её.
После того как закончится инсталляция программы.
Перейдите в wine «C:\\ProgramFiles\Borland\Delphi7\»
и создайте папку с названием Projects .
Всё,можно запускать Delphi 7 и кодить.:yahoo:
Get started writing Linux apps with Delphi 10.3 and 10.4
Firstly, you need an Ubuntu installation. If you don’t have a physical machine with Ubuntu, you may chose a suitable Virtual Machine, such as VMWare, VirtualBox or Hyper-Visor.
I chose Hyper-V since it is included with Windows 10.
To enable Hyper-V on your Windows installation, Open the “Windows Features” tool and check Hyper-V. If you alse use Visual Studio, you may want to add Windows Hypervisor Platform as well.
A word of advice with regards to storage: Place your VMs on an SSD disk.
Reboot your Windows installation if so instructed.
When ready, Start Hyper-V Manager, and chose Actions | Quick Create… | Ubuntu 18.04.3 LTS
A 1.6Gb download will pursue, so the time depends on your bandwidth.
Before firing up the VM, tweak the new VM config to f.x. 4 CPUs and 8192Mb RAM to give the VM some juice, then power up and go through the base installation.
To manually add the build tools for Ubuntu, open a terminal, and run
sudo apt update sudo apt install build-essential
The first ensures your VM pull all relevant updates, and the second installs gcc and the suite of build tools for Linux.
Note that you can install PAServers for both Rio and Sydney. Just remember to edit the paserver.config and change the default port number for one of them.
Install it to a folder of your liking, as per the instructions in the link and start ./paserver and enter the (optional) password you want the PAServer to use.
To find the IP address of your local Ubuntu VM, open a terminal and run
The IP address we are looking for is in address 2 – in this case: 172.17.202.68
When you first try to compile a Linux app, start with something simple like a console application.
program LinuxTest; uses System.SysUtils; begin try try Writeln('Hello whirled'); except on E: Exception do Writeln(E.ClassName, ': ', E.Message); end; finally Write('Press Enter: '); Readln; end; end.
On the first ever compile, the IDE will prompt you for a connection profile.
Since we didn’t change the configuration, all we need is to fill in the IP address for the host name.
If you entered a password when starting the PAServer, that password is needed here. Remember to click on Test Connection to verify that the PAServer is reachable.
On the first connection, the IDE will download the SDK through the PAServer. This takes a little while and the progress is presented on a desktop-always-on-top progress dialog which is somewhat annoying if you want to do something else while waiting.
After it is complete, you will have a collection of files that allows the linker to find the right link targets for your Ubuntu host.
At this point, your simple console app should be ready to run. It will compile, link, and then upload it to the Ubuntu VM and start it through the PAServer.
By default, it seems that we won’t get to see the actual console where the app runs when run through PAServer, so if you want to run it manually – locate the uploaded file on your installation.
It will typically reside under a long path that reflects the name of your connection and your Windows username. The PAServer folder will be in the same folder where you installed the PAServer-20.0 (if you are using 10.3.3).
Under scratch-dir, you find the folders for your winuser-connection combos.
Under there again, you will find a folder that matches your Delphi project name, and in that folder your executable which you can start with “./exename”.
At this point, you should be able to do the same.
The next step is to download FMX for Linux via GetIt.
Then you can get started on something beautiful like this 😎
File | New | Multi-device application – change target to Linux 64-bit and run!
Lars Fosdal, August 26th, 2020
Postscript:
I have also done this on VirtualBox, but when comparing Hyper-V and VirtualBox it is clear that Hyper-V is much better at managing HW resources – preventing the constant buzz of the CPU cooling fan which was quite annoying when using VirtualBox.