Recent

Author Topic: Strange issue - can't launch empty form app  (Read 1524 times)

Mr. George

  • New Member
  • *
  • Posts: 21
Strange issue - can't launch empty form app
« on: April 17, 2021, 09:03:35 pm »
Hi!
For last two days i searched internet to find why i can't launch empty form application.
I use latest versions of Lazarus (2.0.12) x64 which comes with FPC 3.2.0.
Windows 10 1809 (LTSC) x64 (Hyper-V VM, host PC - Windows 10 PRO 20H2).
On same VM i can compile and run Delphi form app without errors.

Basically I create a new form application (LCL) with empty form.

Code: Pascal  [Select][+][-]
  1. program Project1;
  2.  
  3. {$mode objfpc}{$H+}
  4.  
  5. uses
  6.  {$IFDEF UNIX}
  7.  {$IFDEF UseCThreads}
  8.   cthreads,
  9.  {$ENDIF}
  10.  {$ENDIF}
  11.   Interfaces, // this includes the LCL widgetset
  12.   Forms,
  13.   unit1 { you can add units after this };
  14.  
  15. {$R *.res}
  16.  
  17. begin
  18.   RequireDerivedFormResource := True;
  19.   Application.Scaled := True;
  20.   Application.Initialize;
  21.   Application.CreateForm(TForm1, Form1);
  22.   Application.Run;
  23. end
  24.  

Project compiles without problems, but after start I immediately get error "External SIGSEGV in file 'include\customform.inc 2093".

Code: Pascal  [Select][+][-]
  1.   case Application.DoubleBuffered of
  2.     adbDefault: FDoubleBuffered := TWSCustomFormClass(WidgetSetClass).GetDefaultDoubleBuffered; // <<<<<
  3.     adbTrue: FDoubleBuffered := True;
  4.     adbFalse: FDoubleBuffered := False;
  5.   end;
  6.  

Well, i supposed it might be a bug, so i just added next line before CreateForm.

Code: Pascal  [Select][+][-]
  1. Application.DoubleBuffered := adbTrue;

After that, i get new error: "External SIGSEGV in file 'include\monitor.inc 34"

Code: Pascal  [Select][+][-]
  1. function TMonitor.GetPixelsPerInch: Integer;
  2. var
  3.   X, Y: UINT;
  4. begin
  5.   if WidgetSet.GetDpiForMonitor(FHandle, MDT_EFFECTIVE_DPI, X, Y)=S_OK then // <<<< FHandle = Can't read memory at address 0x8
  6.     Result := X
  7.   else
  8.     Result := Screen.PixelsPerInch;
  9. end;
  10.  

What can cause this problems with pretty basic empty project?
« Last Edit: April 17, 2021, 09:11:31 pm by Mr. George »

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: Strange issue - can't launch empty form app
« Reply #1 on: April 17, 2021, 09:19:14 pm »
Congratulations on the fairly coherent description of your problem, wish everybody was that sensible. I'm not a Windows user, but just to get the ball rolling: what happens if you have a /completely/ empty project, i.e. displays a form without even a close button dropped onto it?

Is debugging enabled, and do you get a useful report of where the exception is if you run the program under IDE control?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Mr. George

  • New Member
  • *
  • Posts: 21
Re: Strange issue - can't launch empty form app
« Reply #2 on: April 17, 2021, 10:03:52 pm »
Quote
what happens if you have a /completely/ empty project, i.e. displays a form without even a close button dropped onto it?
That's exactly what i have.
Project, created by wizard with absolutely empty form and zero changes.

Quote
Is debugging enabled
Yes

Quote
and do you get a useful report of where the exception is if you run the program under IDE control?
I have. With absolutely no changes in project, i get only this error report:
External SIGSEGV in file 'include\customform.inc 2093.

After i added "Application.DoubleBuffered := adbTrue;" error gone, but new one come:
External SIGSEGV in file 'include\monitor.inc 34
// FHandle = Can't read memory at address 0x8
« Last Edit: April 17, 2021, 10:15:48 pm by Mr. George »

Mr. George

  • New Member
  • *
  • Posts: 21
Re: Strange issue - can't launch empty form app
« Reply #3 on: April 17, 2021, 10:12:43 pm »
I assume that two things may be related:
1. I work in virtual machine, so Lazarus installed within VM.
2. To connect to this VM i use native Hyper-V tool - VMCONNECT (It opens RDP enhanced session), but same issue happens with default RDP connection.
But both cases should not be a problem for compiled application, users should be able to use it under RDP as well.

Well i tried to start produced app from host machine (with real hardware) - it does not start.
So, it's super strange for me. How is it possible that such basic thing does not work.

It might be a compiler bug as well.
FPC and Lazarus have fixes branches, but for some reasons there are no minor releases with implemented fixes.
Updating FPC inside lazarus is not straight forward operation and AFAIK is not automated.
« Last Edit: April 17, 2021, 10:27:52 pm by Mr. George »

MarkMLl

  • Hero Member
  • *****
  • Posts: 6647
Re: Strange issue - can't launch empty form app
« Reply #4 on: April 17, 2021, 10:29:09 pm »
Virtualisation /shouldn't/ make any difference. Make sure that debugging info is enabled in the build, run the project under Lazarus, and it should show you the failing line.

Apart from that... if you really are getting it with a completely empty project... can you bundle that up into a .zip or whatever and post it here?

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

Mr. George

  • New Member
  • *
  • Posts: 21
Re: Strange issue - can't launch empty form app
« Reply #5 on: April 17, 2021, 10:50:35 pm »
Quote
Apart from that... if you really are getting it with a completely empty project... can you bundle that up into a .zip or whatever and post it here?
Sure. I included exe as well, in case if you want try to see that it is really does not start.
https://drive.google.com/file/d/15aVc_Mo2jtW0a-cbvM1JfjIECojhJ0a1/view?usp=sharing

Quote
Make sure that debugging info is enabled in the build, run the project under Lazarus, and it should show you the failing line.
I already marked failing lines in first post (as comment after "<<<<")
Do you ask me about something else?
« Last Edit: April 17, 2021, 11:12:23 pm by Mr. George »

Josh

  • Hero Member
  • *****
  • Posts: 1270
Re: Strange issue - can't launch empty form app
« Reply #6 on: April 17, 2021, 11:49:20 pm »
Hi
I cannot run the exe in the download, it does nothing.

If I compile your project, the size is 23MB; much bigger than your exe; and the project runs fine.

Do you have an Anti Virus running on this VM, ie microsoft default one; if so try excluding the folder holding the project from the Virus Scanner, as well as the folders that contain your laz and fpc installation.

Tested with Laz 2.0.12 (64642), fpc 3.2.0 r45643

« Last Edit: April 17, 2021, 11:52:00 pm by josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

Mr. George

  • New Member
  • *
  • Posts: 21
Re: Strange issue - can't launch empty form app
« Reply #7 on: April 18, 2021, 12:09:50 am »
Quote
If I compile your project, the size is 23MB; much bigger than your exe
:o
Looks like something not linked in executable.
With Release build mode (disabled debug), what exe size you get?
I get 2mb.

Quote
Do you have an Anti Virus running on this VM, ie microsoft default one;
Yes, i use windows defender. Tried to turn it off. Same results.

Quote
Tested with Laz 2.0.12 (64642), fpc 3.2.0 r45643
Where you find full fpc version, where i can check that i have also "r45643"?

Mr. George

  • New Member
  • *
  • Posts: 21
Re: Strange issue - can't launch empty form app
« Reply #8 on: April 18, 2021, 12:34:36 am »
Tried to reinstall, without luck.
Then, tried to delete settings folder "%USERPROFILE%\AppData\Local\lazarus".
That helped, i have no idea what's wrong. Will investigate.

Thanks for help!
« Last Edit: April 18, 2021, 01:07:49 am by Mr. George »

Josh

  • Hero Member
  • *****
  • Posts: 1270
Re: Strange issue - can't launch empty form app
« Reply #9 on: April 18, 2021, 12:43:07 am »
If I create build modes release and debug.

Default 23589KB
Debug 2791KB + 20821KB dbg file
Release 2763KB

If your run fpc.exe found in your fpc\bin\x86_64-win64 folder, it should give you the info required.

It maybe worth trying a fresh install of both lazarus and fpc into a seperate folder; best utility for this is fpcupdeluxe.
https://github.com/LongDirtyAnimAlf/fpcupdeluxe/releases/latest
choose the file fpcupdeluxe-x86_64-win64.exe.
Copy this into a folder of your choice, ie c:\LazarusStable
when you run the program, change the install directory to just c:\LazarusStable
Choose the FPC version you want to install ie Stable, and click the Install FPC button, sit back while it does it work.
Choose the Lazarus Version you want to install ie Stable, and click the install Lazarus button, sit back while it does it work.
( you can choose to do the both at the same time, but i prefer todo individual, as you can see if you have a problem easier if it fails).

It is best to exclude this folder ie LazarusStable from your AntiVirus Scanner (before you run fpcupdeluxe), else it is likely to fail.


« Last Edit: April 18, 2021, 12:45:04 am by josh »
The best way to get accurate information on the forum is to post something wrong and wait for corrections.

 

TinyPortal © 2005-2018