Do you have an app written in Delphi VCL for Windows? Do you want to take that app and port it to MacOS or Linux? Then CrossVCL may be your answer.
CrossVCL allows you to compile your VCL apps for MacOS and Linux. While there are not yet a lot of 3rd party controls that work with it, there are a few. If your app uses stock VCL controls, then for the most part you are golden.
I have been trying out CrossVCL and it seems to work very well. However there are a few gotchas that are not obvious when you first install it. After install I had no issues compiling to MacOS, but Linux (Ubuntu 18.04 for this article) was another story.
The first gotcha I ran into was a linker error: [DCC Error] E2597 C:\Program Files (x86)\Embarcadero\Studio\21.0\bin\ld-linux.exe: error: cannot find -lGL
This was solved after a visit to the FAQ page. To save you time, here is the command line you need to run from your Linux terminal:
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev libglfw3-dev libgles2-mesa-dev
After this step completes you need to open Delphi’s options ( Tools|Options ) and go to the Deployment|SDK Manager section and update the local file cache for your Linux SDK.
All seemed fine. I ran several of the examples that come with CrossVCL and they worked flawlessly. That is, until I tried the demo called NativeHandles. This demo worked great on MacOS, but failed with the following error when trying to compile for Linux: [DCC Error] E2597 C:\Program Files (x86)\Embarcadero\Studio\21.0\bin\ld-linux.exe: error: cannot find -lgtk-3
So again I went to the FAQ page, hoping to find the answer. Unfortunately it did not contain the answer to this problem. So I did a little bit of searching and found this command that I ran in the Linux terminal.
sudo apt-get install libgtk-3-dev
After that was done I once again went and updated the local file cache for my Linux SDK.
After that I tried building and running NativeHandles in Linux one more time. And… BINGO it ran fine under Linux.
Long story short, if you have a Delphi VCL app that you want to port to MacOS and Linux, give CrossVCL a shot. It seems to be very good at what it does once you get your environment setup correctly. The biggest drawback I ran into is the lack of good documentation.