Hello,
I am using Lazarus 1.8.1 (fixes_1_8 branch) and fpc 3.1.1 (trunk). Both built from scratch. My system is a Debian 9. Lazarus and fpc last check out was 3 days ago. OS updated & upgraded 3 days ago, too.
I am trying to build myself a kind of server. I use database access (Zeoslib), http (IdHTTPServer), tcp (IdTCPServer), some routines from mORMot framework. All of these are put in a TDataModule as well as all my logic code.
I have enabled threading using -dUseCThreads in custom project options.
My project has only following code:
program httpserver_tcpserver;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Interfaces,
SysUtils,
uData,
zcomponent,
indylaz;
begin
try
DM := TDM.Create(nil);
try
if not DM.IdTCPServer1.Active then Exit();
if not DM.IdHTTPServer1.Active then Exit();
if not DM.DB.Connected then
begin
DM.Log('No database connection. Exiting...');
Exit();
end;
while True do Sleep(250);
finally
DM.Log('server stopped.');
DM.Free();
end;
except
on E: Exception do
begin
WriteLn('error: ' + E.Message);
end;
end;
end.
uData is not included in application using project manager, but included as a unit.
When I try to run compiled application in console, I get following warnings (I tried to translate them to English as Linux locale is not English. They should be something similar):
(project1:2076): Gtk-WARNING **: Theme device module_path could not be found in "adwaita",
(project1:2076): Gtk-WARNING **: Theme device module_path could not be found in "adwaita",
What I would like is a pure console application and no GUI. I am not bothered with warnings normally, but I cannot start my application at boot time using /etc/rc.local. What I observe is that it cannot become a daemon but sticks to a TTY. I believe that behavior prevents it to auto-run at system reboot. I can manually run it if a user login and run the executable. Executable do not require root access rights, and can runs as a regular user.
if I remove LCL, FCL dependency from project manager, also remove Interfaces unit from uses and compile. I get linking errors at my very final "end." line above. Says "generic error while linking". (Yes, I received that warning dialog displayed at me about removing LCL will result funny errors).
I started a new project using Project->New Project->Program which is indicated as command line program. Added uData to my uses and I continue to get these warnings above. Exactly same error if I do not include Intercafes unit, let LCL stay as a dependency in project manager.
Things do not change if I set my widget to "nogui".
I am stuck and any help is appreciated.