Recent

Author Topic: Compiled App doesn't start on other PC  (Read 611 times)

Int3g3r

  • Newbie
  • Posts: 5
Compiled App doesn't start on other PC
« on: December 11, 2022, 09:40:02 pm »
Hello

I have written a program in Lazarus.
This is compiled in Win32-i386.
It runs on the PC where it was programmed.
Intel i7-5930k, Win 10 64x (22H2)

When I copy the exe to another PC it does not start.
Intel Xeon X5570 - Win 10 64x (21H1)
I don't get any error message either.
Nothing is displayed in the task manager either.
The application just does not start.

What could be causing this?

Greetings Int3g3r

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10584
  • FPC developer.
Re: Compiled App doesn't start on other PC
« Reply #1 on: December 11, 2022, 09:44:03 pm »
Some external parts not installed ? COM, dlls etc.

Int3g3r

  • Newbie
  • Posts: 5
Re: Compiled App doesn't start on other PC
« Reply #2 on: December 11, 2022, 09:58:19 pm »
Lazarus 2.2.2, FPC 3.2.2
I'm using SQLite and ZeosLib.
Other are default components.
I know i need for SQLite a DLL.
Do i need for Zeos or the other components something too?

I testet it on a 3rd PC, same problem there.

All uses for the project:
Code: Pascal  [Select][+][-]
  1. uses
  2.   Classes, SysUtils, DB, ZConnection, ZDataset,
  3.   Dialogs, IniFiles;                
  4.  
  5. uses
  6.   Classes, SysUtils, Forms, Controls, Dialogs, Buttons, DBGrids, Variants,
  7.   DBCtrls, LCLType, StdCtrls, ExtCtrls, ComCtrls, Grids, Graphics, System.UITypes, Clipbrd;
  8.  
« Last Edit: December 12, 2022, 06:56:46 pm by Int3g3r »

dseligo

  • Hero Member
  • *****
  • Posts: 957
Re: Compiled App doesn't start on other PC
« Reply #3 on: December 12, 2022, 01:59:36 am »
I know i need for SQLite a DDL.

You mean 'DLL'?
Where did you put it? Are you sure dll is in correct bitness (same as your program)?
Usually there is a message if dll can't be found or if it is not correct.

Quote
Do i need for Zeos or the other components something too?

You don't need anything else for Zeos, only dll's for DB you are using.

Also, check task manager to see if your application is there, after starting it.
Maybe it is started, but not showing main window.
Maybe you are trying to create or open database, and that doesn't work for some reason and your code is stuck there.

Int3g3r

  • Newbie
  • Posts: 5
Re: Compiled App doesn't start on other PC
« Reply #4 on: December 12, 2022, 10:57:16 am »
Quote
You mean 'DLL'?
Where did you put it? Are you sure dll is in correct bitness (same as your program)?
Usually there is a message if dll can't be found or if it is not correct.

Yes DLL.
The DLL is in a folder with the exe.
I have created an ini file, this allows me to disable the connection at startup.


Quote
Also, check task manager to see if your application is there, after starting it.
Maybe it is started, but not showing main window.
Maybe you are trying to create or open database, and that doesn't work for some reason and your code is stuck there.

As already written in the first post.
I do not get any error message.
The application is also not present in the task manager.
Nothing happens after double clicking the exe.

I use exactly the same exe on all PCs.
On the PC on which I compiled it everything works.
So it can't be that the form was deactivated/hidden.
This would at least explain why I don't get an error.
Maybe the form is displayed outside the displayed area.
But then my application should be visible in the task manager.

dseligo

  • Hero Member
  • *****
  • Posts: 957
Re: Compiled App doesn't start on other PC
« Reply #5 on: December 12, 2022, 01:02:15 pm »
I'm using SQLite and ZeosLib.

Are you sure you only use ZeosLib to access SQLite? I see you have these in your uses: SQLDB, SQLDBLib, SQLite3Conn. These are not used with ZeosLib.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10584
  • FPC developer.
Re: Compiled App doesn't start on other PC
« Reply #6 on: December 12, 2022, 01:16:40 pm »
Things to try:

- start from commandline see if that says anything.
- Exclude the folder from the antivirus
- run under a commandline gdb
-

Int3g3r

  • Newbie
  • Posts: 5
Re: Compiled App doesn't start on other PC
« Reply #7 on: December 12, 2022, 07:20:16 pm »
Quote
Are you sure you only use ZeosLib to access SQLite? I see you have these in your uses: SQLDB, SQLDBLib, SQLite3Conn. These are not used with ZeosLib.

Had to refactor the Uses, now they are correct.

Quote
- start from commandline see if that says anything.
- Exclude the folder from the antivirus
- run under a commandline gdb

- start from commandline returns no error, it just executes and nothing happens.
- Antivirus is disabled.
- How do i run the application in "commandline gdb" ? I've never done that.

avra

  • Hero Member
  • *****
  • Posts: 2444
    • Additional info
Re: Compiled App doesn't start on other PC
« Reply #8 on: December 13, 2022, 11:46:50 am »
You should either use logging (console, file, ipc...) or install Lazarus on problematic machine and debug step by step to see where is the problem. For a quick test you could just use heaptrc to confirm if your app has started and exited at all.

https://wiki.freepascal.org/Category:Logging
https://wiki.freepascal.org/heaptrc

Btw, there are servers where unsigned executables are forbidden, and servers which do not allow signed executables when certificate expires, but these usually display some info message on starting executable attempt - so I guess it is not your case.
« Last Edit: December 13, 2022, 11:51:45 am by avra »
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10584
  • FPC developer.
Re: Compiled App doesn't start on other PC
« Reply #9 on: December 13, 2022, 11:56:36 am »
- How do i run the application in "commandline gdb" ? I've never done that.

gdb.exe comes with FPC and Lazarus. Copy it to the machine, put it in the path (or the same dir as the exe).

Take a cmd.exe shell, go to the right directory and simply execute

gdb  theexename.exe

If a prompt appears after loading, type  r<enter>  to run

Int3g3r

  • Newbie
  • Posts: 5
Re: Compiled App doesn't start on other PC
« Reply #10 on: December 13, 2022, 09:53:06 pm »
Thank you all for the help.
I found the issue:

If i set TZConnection to "Connected" in Lazarus the Application won't run.
I don't understand why, but if i set Connected to false the Application runs just fine. It's weird that i don't get any exceptions or errors on start.

I execute folllow code in the datamodule (OnCreate), this doesn't work like expected:

Code: Pascal  [Select][+][-]
  1. procedure TdmMain.DataModuleCreate(Sender: TObject);
  2. begin
  3.   DBConnect;
  4. end;
  5.  
  6. procedure TdmMain.DBConnect;
  7. begin
  8.   dbConn.Disconnect;
  9.   dbConn.Connected := false;
  10.   if (FileExists(IniFileName)) then
  11.   begin
  12.     iniRead;
  13.     dbConn.Connected:= false;
  14.     dbConn.Database:= SettingsRec.database;
  15.     dbconn.LibraryLocation := SettingsRec.sqlite3dll;
  16.   end;
  17.   if (SettingsRec.autoconnect = true) then
  18.   begin
  19.     try
  20.           dbConn.Connect;
  21.           qryOpen;
  22.     except
  23.           ShowMessage('Verbindung zur Datenbank konnte nicht hergestellt werden...');
  24.     end;
  25.   end;
  26. end;    
  27.  

 

TinyPortal © 2005-2018