Recent

Author Topic: Lazarus crashing at startup  (Read 2077 times)

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Lazarus crashing at startup
« on: December 04, 2022, 10:30:09 am »
Hi,
I have laz  2.0.10 on deb 11.5.
It is some days that Lazarus crashes and dies after I click the menu button to launch it  (sometimes, not always).
It was about 2 months I am using it normally.
The suspect is that all started when I tried to put a link to lazarus on the below panel (widget).

Is there some log I can see to do some inspection?
Thanks
FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus crashing at startup
« Reply #1 on: December 04, 2022, 10:58:48 am »
if you are using Linux you can start it from the command line. A stream of log data ....

If you are using Windows, its possible to redirect that output to a file, start it (maybe from a shortcut) with a commandline option like this
Code: [Select]
--debug-log=SOME.LOG
Make sure SOME.LOG will be written to somewhere you have write permission.

If you are using OSF on an Alpha System, then, sorry, you are on your own.  (thats a soft hint to tell us what your system is when you post such a message).

David
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Re: Lazarus crashing at startup
« Reply #2 on: December 04, 2022, 11:15:54 am »
(thats a soft hint to tell us what your system is when you post such a message).

David, thanks for the suggestions, I will use for sure.

My system was written in the post:

I have laz  2.0.10 on deb 11.5.

But maybe deb is a short of debian and was not 100% clear... sorry..
FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus crashing at startup
« Reply #3 on: December 04, 2022, 12:01:10 pm »
No tt, that should be entirely clear to me and I apologize unreservedly !

So, start your lazarus from a command line. You will see quite a lot of whats happening as it starts up.

2.0.10 is pretty old, thats an issue with long life distros  like bullseye (I am assuming, sigh, that yours is installed from the Debian Repo ?)  While being old is not the cause of your problem (again, I assume) newer is always better !

There are current FPC and Lazarus in backports, but, honestly, I would strongly recommend either getting it from the official Lazarus download or, my preference, build Lazarus from source, honestly, its really easy ! At the end of the install, you will feel you really own the install, you understand how it all works !  Very liberating...

Davo

EDIT: You can, if you like, also add a command line switch to your start menu.  But better, maybe, to use a small script that will capture each restart, deleting the previous one. Thats way, if it does not crash every time, you can use it until it does, then swoop down on the log file.





« Last Edit: December 04, 2022, 12:05:52 pm by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Re: Lazarus crashing at startup
« Reply #4 on: December 05, 2022, 11:55:27 am »
I created a small startup sh to add debugging to lazarus.

Code: Text  [Select][+][-]
  1. user_tt@user_tt-development:~$ cat /usr/bin/startlazarus-user_tt
  2. #!/bin/sh
  3.  
  4. # /usr/bin/lazarus-ide is the link to the actual startup program in debian 11.5
  5. /usr/bin/lazarus-ide  --debug-log=lazarus-ide-debug.log --debug-enable=DBG_VERBOSE,DBG_WARNINGS,DBG_STATE,DBG_EVENTS,DBG_STATE_EVENT,DBG_DATA_MONITORS,DBG_DISASSEMBLER,DBG_LOCATION_INFO,SYNMOUSEEVENTS,SRCED_LOCK,SRCED_OPEN,SRCED_CLOSE,SRCED_PAGES,DBG_CMD_ECHO,DBG_CMD_ECHO_FULL,DBGMI_TYPE_INFO,DBGMI_TIMEOUT_DEBUG,DBG_THREAD_AND_FRAME,DBGMI_QUEUE_DEBUG,DBGMI_STRUCT_PARSER,FPDBG_DWARF_ERRORS,FPDBG_DWARF_WARNINGS,FPDBG_DWARF_VERBOSE,FPDBG_DWARF_VERBOSE_LOAD,FPDBG_DWARF_SEARCH,FPDBG_DWARF_DATA_WARNINGS,DBG_ERRORS $@ &
  6.  

I attached two logs one with a crash and one with a normal open/close of lazarus. These logs where produced within the same minute using the same startup lpi, and without any modification to the lpi or to any unit of it. Very strange.

If someone can tell I would appreciate a lot.
FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus crashing at startup
« Reply #5 on: December 05, 2022, 11:22:39 pm »
Not much to be found in the logfile.

When you say "crash", you mean
- the IDE closes without any notification / no error dialog
- there is an error dialog of some kind

Could you start the IDE in gdb please?

NOTE, if your IDE is build without debug info, you need to rebuild it with -gw.
- check the size of your lazarus executable. If it is greater 100mb, then it likely has debug info
- to rebuild go menu: Tools > "Configure build lazarus", and in the memo "custom options" enter/add: -gw
  then press build

Code: Text  [Select][+][-]
  1. gdb -ex r -ex bt lazarus > somefile.txt

I guess in your case "gdb -ex r -ex bt /usr/bin/lazarus-ide" => so long as lazarus-ide is linked to "lazarus", but not to "startlazarus" (the startlazarus that comes with the installation)

If the IDE crashes "somefile.txt" should (towards the very end) contain a stacktrace.

It should contain
- address (in hex)
- file/unit names and linenumbers.

If it has a stacktrace, but address only (no files/lines) then debug info was missing.


Wenn done, gdb will still be running. (and with it the dead lazarus process)
Since you have no command line to it, you need to "kill -9" the gdb process.

To avoid gdb hanging around you can try
Code: Text  [Select][+][-]
  1. gdb -ex "set confirm off" -ex r -ex bt -ex kill -ex q  lazarus > somefile.txt
« Last Edit: December 05, 2022, 11:29:10 pm by Martin_fr »

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Re: Lazarus crashing at startup
« Reply #6 on: December 06, 2022, 08:39:38 am »
Hi, thanks for repying,

- the IDE closes without any notification / no error dialog

It seems to open up his windows for a moment, along with the startup lpi, but then all them close. The splash screen remains visible, and eventually it also closes itself after a while (probably it has a self closing retarder).
No error dialog. Nothing.
And it might occur both when I launch from the kde buttons or from the konsole's command line.
In an unpredictable way.

I don't know, sometimes I have the feeling that is something related to my project, because another thing that sometimes happens, and recently is happening more frequently, is that while I am doing development things, if I push the File open button in the ide menu, once I select the file I wish to open (I do this because my lpi has only main program, the rest is found at compile time by unit search path), ide suddenly crashes (same, closes with no error dialog). Also the latter problem is not systematic, I haven't found a consistent way to get it.

Could you start the IDE in gdb please?

NOTE, if your IDE is build without debug info, you need to rebuild it with -gw.
- check the size of your lazarus executable. If it is greater 100mb, then it likely has debug info
- to rebuild go menu: Tools > "Configure build lazarus", and in the memo "custom options" enter/add: -gw
  then press build

Code: Text  [Select][+][-]
  1. gdb -ex r -ex bt lazarus > somefile.txt

I guess in your case "gdb -ex r -ex bt /usr/bin/lazarus-ide" => so long as lazarus-ide is linked to "lazarus", but not to "startlazarus" (the startlazarus that comes with the installation)

If the IDE crashes "somefile.txt" should (towards the very end) contain a stacktrace.

It should contain
- address (in hex)
- file/unit names and linenumbers.

If it has a stacktrace, but address only (no files/lines) then debug info was missing.


Wenn done, gdb will still be running. (and with it the dead lazarus process)
Since you have no command line to it, you need to "kill -9" the gdb process.

To avoid gdb hanging around you can try
Code: Text  [Select][+][-]
  1. gdb -ex "set confirm off" -ex r -ex bt -ex kill -ex q  lazarus > somefile.txt

In this days I am little busy at work, but I will try to find some time to try this. It will help a lot I am sure.

Martin_fr I can only say thank you for the help.
FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus crashing at startup
« Reply #7 on: December 06, 2022, 12:56:48 pm »
It seems to open up his windows for a moment, along with the startup lpi, but then all them close. The splash screen remains visible, and eventually it also closes itself after a while

That may mean, that you run via "startlazarus" => and then the gdb will not get the trace.

A bit of explanation:
When you install lazarus, then you will do that as root. It will create a directory somewhere in /usr/....../lazarus
In that directory there are 2 executable: startlazarus and lazarus. (Both can display the splash screen)

You normally use startlazarus.
It will find (see below) the correct "lazarus" and run it (telling it, not to show the splash again, since it is already there).

Why all that? Well, because when you install a package, then the "lazarus" executable will be rebuild. But as user you can not update it in /usr/.
So instead a new lazarus executable is placed in (a subdirectory of) the "primary config path" (usually ~/.lazarus/ ). And startlazarus makes sure that is used.

So then, the splash screen is by "startlazarus", and hence it closes later (yes probably on a timer).



gdb will only observe the process it is originally given. It will not deal with processes launched as children.

If gdb debugs startlazarus, then it wont get the crash in "lazarus".

So you need to find the exact location of ~/.lazarus/?????/lazarus
And then feed that to gdb.




About the: crash may be caused by the project
It may, but usually that means the IDE would prompt you the next time it starts.


If you rebuild the IDE (for debug info) you may also want to try and add
-Criot -gt

This adds internally checks, and may help finding the error.

Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Re: Lazarus crashing at startup
« Reply #8 on: December 06, 2022, 03:31:06 pm »
- check the size of your lazarus executable. If it is greater 100mb, then it likely has debug info

Seems deb 11.5 distributes without debug symbols (understandably)

Code: Text  [Select][+][-]
  1. user_tt@user_tt-development:~$ ls -lh /usr/lib/lazarus/2.0.10/la*
  2. lrwxrwxrwx 1 root root   32 Sep  8 12:30 /usr/lib/lazarus/2.0.10/lazarus -> /etc/alternatives/lazarus-2.0.10
  3. -rwxr-xr-x 1 root root  45M Feb 25  2021 /usr/lib/lazarus/2.0.10/lazarus-gtk2
  4. -rwxr-xr-x 1 root root  16M Feb 25  2021 /usr/lib/lazarus/2.0.10/lazbuild
  5.  


FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus crashing at startup
« Reply #9 on: December 06, 2022, 04:21:20 pm »
I hadn't paid attention to 2.0.12
You should really upgrade.



Чебурашка

  • Hero Member
  • *****
  • Posts: 568
  • СЛАВА УКРАЇНІ! / Slava Ukraïni!
Re: Lazarus crashing at startup
« Reply #10 on: December 06, 2022, 04:41:50 pm »
I hadn't paid attention to 2.0.12
You should really upgrade.

I am very sorry about this because the system was working fine initially, and I could work since september when I did this 11.5 vm.

Ok I will take your upgrade advice this into serious consideration, maybe taking advantage of the debian backport system. Or as further resource build lazarus directly from source.
Thanks again.
FPC 3.2.0/Lazarus 2.0.10+dfsg-4+b2 on Debian 11.5
FPC 3.2.2/Lazarus 2.2.0 on Windows 10 Pro 21H2

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Lazarus crashing at startup
« Reply #11 on: December 06, 2022, 06:37:19 pm »
There are official installers on our sourceforge page (link on the left of this forum)

Distros often only have older versions :(

When you do uppdate... Normally all goes fine.
But for that low percentage, backup
- ~/.lazarus
- Your project(s)

After the update, the first start comes with a lot of warnings
=> if needed, update any path that changed / has the version number in it (there will be a dialog at startup)
=> Ignore the remaining warnings
=> rebuild the IDE once.


It's just there is always a chance that the problem has been fixed in the meantime.

Otherwise, if you sent a stack for the old Lazarus, it is possible that it can be mapped to the current version. But likely it will be not matching well enough to find the issue.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus crashing at startup
« Reply #12 on: December 07, 2022, 12:21:14 pm »
=== Option Blow away your Config ===

TT, do you have a lot of config data that is important to you ?  Its not in any way beyond impossibility that removing your config directory ( ~/.lazarus ) and starting again may clear your problem.

And your problem may relate to an issue Debian had in its early releases of Lazarus in Bullseye. Because they need to give it a special Debian version number, the first time Lazarus rebuilds itself, that was conflicting with the version it thought it was. Usually saw this as a threatening message at first startup after a rebuild.

Again, as discussed below, because after your very first rebuild, you are no longer using the Debian supplied binary anyway, removing ~/.lazarus may well solve your issue.

=== Option Update Lazarus (and maybe FPC) ===
TT, as I mentioned up near start of this thread, I recommend building from source rather than updating from either Debian Backports or even using the official Lazarus from SourceForge.

The reason is that if you are having problems (and a new install may well fix that but who knows ?) you are going to need to rebuild it with debug information anyway. But the Debian Backports and Official version from Source Forge both install your Lazarus up in read only space. Now, Lazarus is clever, when you rebuild normally (ie when adding a package) it makes out its rebuilding the original but in fact builds a new copy hidden down in your local config dir. Thats why the startlazarus command, it takes care of all that behind your back.

It works for normal, routine rebuilds but if you want to jump in there and add debug code and run it under gdb, it starts to get complicated.

You are going to rebuild Lazarus anyway, sooner or later, why not do it from the start and end up with a very straightforward install ?

Now, Bullseye has FPC 3.2.0, I don't remember if it will build Lazarus 2.2.4, anyone out there comment ?  If so, leave FPC there but remove Lazarus with apt. Because of the complicated way Debian builds Lazarus, that will probably leave a lot of sub-parts of Lazarus behind, I like to use Synaptic to search for them and remove them manually.

If you need to replace FPC (because its too old to build Lazarus 2.2.4) then install a newer FPC, maybe from Backports or Testing if you feel brave.

=== Option Experiment in a Clone VM ===

Now, this is a VM we are talking about ?  If its Virtual Box, you can make  "linked clone" of your existing VM, experiment on that and blow the clone away, all making absolutely no change the the clone "Base". Now, I routinely use Testing like that and it always has a very current FPC/Lazarus installed. And pretty stable this late in their release cycle.

I bet taking a clone, removing your existing config, updating it all to Testing would solve your problem.

davo





« Last Edit: December 07, 2022, 12:37:53 pm by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Lazarus crashing at startup
« Reply #13 on: December 07, 2022, 12:58:48 pm »
Further information tt.

I just confirmed that FPC3.2.0, as installed from the Debian Bullseye Repository, will build Lazarus 2.2.4 from source fine.

So, I had a Bullseye VM, I took a linked clone, started the clone, installed FPC, I got 3.2.0 as expected. So I then downloaded the Lazarus 2.2.4 source from -

 https://gitlab.com/freepascal.org/lazarus/lazarus/-/archive/lazarus_2_2_4/lazarus-lazarus_2_2_4.zip

unzipped it, cd'ed into the new dir and ran "make bigide <enter>" and it built, and ran perfectly.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

Handoko

  • Hero Member
  • *****
  • Posts: 5130
  • My goal: build my own game engine using Lazarus
Re: Lazarus crashing at startup
« Reply #14 on: December 07, 2022, 01:09:11 pm »
My Lazarus 2.0.10 GTK2 64-bit had weird behavior:
https://forum.lazarus.freepascal.org/index.php/topic,57538.msg428005.html#msg428005

But the issue has gone after I upgraded to  Lazarus to version 2.2.0. Now I'm using Lazarus 2.3.0, no problem so far. Maybe tt should try the Lazarus newer versions.

Or maybe tt should try to build from source like suggestion by dbannon. Building Lazarus from source may sound difficult but actually it's very easy. I done it, and it worked on my first attempt. The wiki page is very helpful:
https://wiki.freepascal.org/Installing_Lazarus_on_Linux

 

TinyPortal © 2005-2018