Contents · Forum Home · StreamSec Tools 4.1.5.365 documentation

Build and run a Delphi application with StreamSec on Linux64

Build a Delphi 13 console application on Windows and run it on x86-64 Linux. The program prints the StreamSec release it linked and a 16-byte run ID from the library's random generator.

Connect Delphi to the Linux target

  1. Install the Delphi Linux 64-bit platform in RAD Studio. Use an x86-64 Linux host with glibc 2.34 or later. Install the host's C development tools and libraries so Delphi can import its SDK.
  2. Install and start the matching RAD Studio Platform Assistant (PAServer) on that host. In Tools > Options > Deployment > Connection Profile Manager, add a Linux profile for the host and test the connection. See Installing the Platform Assistant on Linux.
  3. In Tools > Options > Deployment > SDK Manager, add the Linux 64-bit SDK using that profile. Import the headers and libraries onto the Windows development machine. See Add a New SDK.

Build the console application

Create a Delphi console application named StreamSecLinuxCheck. Save this unit beside the project, then use the project source shown below.

unit TaskDelphiLinux;

interface

function DeploymentReport: string;

implementation

uses
  System.SysUtils, stVersion, stDERUtils, stRandom,
  stDrbgAesCtr, stAESNI, stAESCT;

function DeploymentReport: string;
var
  lId: TBytes;
begin
  SetLength(lId, 16);
  GetRawRandom(False).RawRandom(lId);
  Result := 'StreamSec Tools ' + cStreamSecToolsVersion + '  run ' +
    LowerCase(OSToHex(BytesToOS(lId), True));
end;

end.
program StreamSecLinuxCheck;

{$APPTYPE CONSOLE}

uses
  TaskDelphiLinux in 'TaskDelphiLinux.pas';

begin
  Writeln(DeploymentReport);
end.
  1. In the Projects window, right-click Target Platforms, choose Add Platform, and activate Linux 64-bit. Open that target's Properties and select the connection profile and SDK.
  2. In Project Options select Linux 64-bit for the settings below. For the source edition, add the release's Source directory to the Delphi compiler Search path and Include file search path. For the Delphi 13 DCU trial, set the search path to Source\D13\l64\dcu.
  3. Set Object file search path to the directory containing the release's Linux stAESNIFunc.o and stGHashFunc.o. In the source edition these are in Source. In the Delphi 13 DCU trial they are beside the Linux DCUs. The linker incorporates these objects into the executable.
  4. Select Release, leave runtime packages disabled, and build the project. If the linker cannot find the C runtime, check the imported Linux SDK. If it names one of the StreamSec object files, check the object path for the active target.

Run it on Linux

Use Run > Run Without Debugging with the Linux target active to deploy through PAServer. To see the output in your own terminal, copy the built StreamSecLinuxCheck executable from the project's Linux64 output directory to a directory on the Linux host. From that directory run chmod u+x StreamSecLinuxCheck, then ./StreamSecLinuxCheck.

The output begins with StreamSec Tools and the four-part version from your release. After run there should be 32 hexadecimal digits. The identifier is public and changes between runs. See Generate random bytes and keys for the generator used here.

Reference

stVersion · stRandom · stDrbgAesCtr

Related tasks