Recent

Author Topic: error while building Lazarus  (Read 3282 times)

440bx

  • Hero Member
  • *****
  • Posts: 4491
error while building Lazarus
« on: June 28, 2024, 07:24:41 pm »
Hello,

I attempted to build the latest version of Lazarus (v3.4) using the .lpi file that is part of the installation.    After checking "Build" in Project->Project Options->Compiler command I proceeded to do a build (checking that "Build" box was the only change made.)

The build ended with an error:
Code: Text  [Select][+][-]
  1. main.pp(62,72) Error: Cannot find Laz_AVL_Tree used by Main of the Project Inspector.

For more details, please refer to the screenshot.

I found the Laz_AVL_Tree file that the compiler is complaining about not finding and it would be simple to add its directory to the build configuration but, I'm wondering if the error isn't due to something I failed to do instead of something that needs to be added to the build config.

I will be grateful to be given the correct course of action.

Thank in advance for your help.

PS: in case this may be important, I am using a, roughly, month old trunk version of Lazarus to build v3.4 (it's about 2 weeks pre-v3.4)

Also, it's compiling for 64 bit but that was (and still is) the default in the .lpi.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

n7800

  • Full Member
  • ***
  • Posts: 134
Re: error while building Lazarus
« Reply #1 on: June 28, 2024, 08:43:26 pm »
As far as I know, the project lazarus.lpi exists only for debugging the IDE ("pressing" [F9]), not building it. You can even look at the list of build modes in the Project Options window, and see that they are different from the list of profiles in the Main menu > Tools > Configure "Build Lazarus" window...

I remember reading this on Wiki somewhere, but I can't find it. But you can see confirmation in this thread.

Building the IDE should only be done via Main menu > Tools > Build Lazarus with profile ... or via the make build system.
« Last Edit: June 28, 2024, 09:02:25 pm by n7800 »

440bx

  • Hero Member
  • *****
  • Posts: 4491
Re: error while building Lazarus
« Reply #2 on: June 29, 2024, 07:21:34 am »
Thank you n7800.

I followed the Wiki instructions to the letter and either I am misunderstanding the instructions or there is a problem with the instructions.

Here is what the Wiki says:

Code: Text  [Select][+][-]
  1. Debugging the IDE
  2. Open a Lazarus instance (called 1st instance of Lazarus).
  3. Compile the IDE as usual e.g. via Tools/Build Lazarus. Make sure you set up debugging flags like -g or -gw2. Best is to use the profile "Debug IDE" which contains many flags useful for debugging.
  4. Open the ide\lazarus.lpi project (always with the 1st instance of Lazarus).
  5. Compile this lazarus project (always with the 1st instance of Lazarus): another instance of Lazarus should appear (called 2nd instance of Lazarus).
  6. Set breakpoints as needed etc in the opened source code (in the 1st instance of Lazarus), and play with 2nd run-time instance: for example, install a design-time static package *.lpk, then use, interact with this just installed package inside this 2nd instance.

Goal: I want to debug Lazarus v3.4.  To do that I did the following:

Code: Text  [Select][+][-]
  1. Open a Lazarus instance (called 1st instance of Lazarus).
I opened (run) Lazarus v3.4 (this is, per the Wiki instructions above, the 1st instance.)

Code: Text  [Select][+][-]
  1. Compile the IDE as usual e.g. via Tools/Build Lazarus. Make sure you set up debugging flags like -g or -gw2. Best is to use the profile "Debug IDE" which contains many flags useful for debugging.
  2.  
Went to "Tools -> Configure Build Lazarus" and selected "Debug IDE".
Immediately after that:
"Tools -> "Build Lazarus with Profile: Debug IDE"

Code: Text  [Select][+][-]
  1. Compile this lazarus project (always with the 1st instance of Lazarus): another instance of Lazarus should appear (called 2nd instance of Lazarus).
  2.  

This is where the problems start. 

I closed/exited Lazarus v3.4 (which I intend to debug) and started Lazarus Trunk (which I intend to use as the debugger). 

I opened v3.4's Lazarus.lpi and as the instructions state, attempted to compile that project.  That causes the MessageBox shown in the attachment to show up and inform me that there is "Nothing to do", "The project has no compile command."... etc.  I did NOT make any changes whatsoever to the project. 

I tried that step twice, once clicking "Cancel" which does nothing and another time clicking "Ignore".  There is apparently no difference between them as far as the result.

Code: Text  [Select][+][-]
  1. Set breakpoints as needed etc in the opened source code (in the 1st instance of Lazarus), and play with 2nd run-time instance: for example, install a design-time static package *.lpk, then use, interact with this just installed package inside this 2nd instance.
Using Lazarus Trunk, I opened the Lazarus v3.4 .lpi project file, set a breakpoint and it _partially_ works.

I say partially because, in the Lazarus.pp file, the little blue dots that indicate where executable instructions are, are correct but, in the file "Application.inc", it is quite obvious that the blue dots are not on the correct lines.  For some files, the dots seem to be in the right place while for others they are not.  In some other files, they seem to start in the right place and then they get messed up.

See screenshots of various instances of incorrect locations of blue dots.

In Application.inc, it starts ok but gets messed up later (look at ActivateHint)

In Forms.pp, it's messed up from the very beginning.

Am I misunderstanding the instructions and/or doing something incorrectly ?

Obviously, if the blue dots are not on the right lines debugging becomes impossible.

Thank you for your help.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

440bx

  • Hero Member
  • *****
  • Posts: 4491
Re: error while building Lazarus
« Reply #3 on: June 29, 2024, 04:48:21 pm »
The following information may be useful to the Lazarus developers.

I figured I'd start with a clean and updated slate.  First, with fpcupdeluxe, I updated the trunk version to the latest version.  I deleted all the files that were part of my Lazarus v3.4 installation and with fpcupdeluxe, created a fresh v3.4 installation.

In that fresh v3.4 installation, I installed TurboPowerIProDsgn 0.0 to get the nice looking yellow popup hints.  After doing that, I proceeded to verify everything still worked as expected and it did.  Note, that the package was installed with the build ide profile:  Normal IDE.

Since the purpose of the exercise is to debug that IDE, I changed the build profile to Debug IDE.  That profile caused lots of problems. Among the problems,  stepping no longer works, breakpoints are ignored and the blue dots are all over the (wrong) place.

Fortunately, rebuilding the IDE using the "Normal IDE" profile brings everything back to normal.

Another detail which is an annoyance is that, the refreshed Trunk version of Lazarus never gets the blue dots in the right place when it comes to debugging v3.4.  I speculate this was caused by choosing "Ignore" in the MessageBox that said there was nothing to do.  Now, every time I step into the code, it tries to compile (or do something, I'm not sure), emits a bunch of hints, starts debugging but, the blue dots are everywhere. 

This does not happen when debugging v3.4 with another instance of v3.4 and the difference between the two installations is that the v3.4 installation was never told to "ignore" the "nothing to do" message.

question: is there a way to undo whatever "Ignore" did ?  (I'd like to use the trunk version to debug the v3.4 version.)  The trunk version is now stuck with blue dots in the wrong places.

Thank you for your help.


(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

n7800

  • Full Member
  • ***
  • Posts: 134
Re: error while building Lazarus
« Reply #4 on: June 30, 2024, 02:29:52 am »
Frankly, I also find the instructions on the Wiki not very clear. Maybe I'll even find time to improve the description.

1. Let's first. You don't have to have two IDEs of different versions. The word "instances" means two programs running simultaneously. That is, two processes in the OS. I will say more - trying to debug the IDE of one version from another version can cause a lot of problems (I just tried it for fun). The same IDE is always used (same installation, same "lazarus.exe").

2. Yes, to be able to debug, you need to compile the environment in the "Debug IDE" profile, via "Main menu > Tools > Configure Build Lazarus...". The IDE will be rebuilt and restarted.

3. Now open the project "ide\lazarus.lpi" from the folder of the same IDE. You can open any files in this project and set breakpoints.

4. Now click "Main menu > Run > Run" (or press [F9]). The environment will launch itself like any other program. And you can work with it like with any other program. Click buttons, open projects, etc. If a breakpoint is reached, focus will switch to the first IDE. Then you can press [F8] for step-by-step debugging and so on.

5. If you want to not only debug, but also change the IDE code, then each time to rebuild you need to call "Main menu > Tools > Build Lazarus with profile ..." again. I recommend assigning a hotkey to this menu item, for example [Ctrl+Alt+Shift+F9].

Remember, if you change the code and press [F9], the process of compiling the units will be started, but the IDE itself ("lazarus.exe") will not be rebuilt, and the old (current) version will be launched. A program cannot change itself while it is running. This is the main difference between the IDE and other programs. Use only "Build Lazarus with profile ..." for rebuilding, and [F9] only for debugging the current version.
« Last Edit: June 30, 2024, 02:33:46 am by n7800 »

440bx

  • Hero Member
  • *****
  • Posts: 4491
Re: error while building Lazarus
« Reply #5 on: June 30, 2024, 03:18:33 am »
2. Yes, to be able to debug, you need to compile the environment in the "Debug IDE" profile, via "Main menu > Tools > Configure Build Lazarus...". The IDE will be rebuilt and restarted.
Currently, that is, using v3.4, that does not work.

Rebuilding the IDE with the "Debug IDE" configuration yields an IDE that does not even know how to break on a breakpoint.  The "Normal IDE" configuration yields a workable IDE.

The reason I want to use the trunk version to debug v3.4 is because I've configured the trunk version to work the way I like Lazarus to work and I don't remember all the settings I changed and there is no way of exporting all the settings and importing them in another installation (at least not that I know of.)

All that said, I am grateful for your help, thank you!
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4517
  • I like bugs.
Re: error while building Lazarus
« Reply #6 on: June 30, 2024, 08:25:32 am »
Here is what the Wiki says:

Code: Text  [Select][+][-]
  1. Debugging the IDE
  2. Open a Lazarus instance (called 1st instance of Lazarus).
  3. Compile the IDE as usual e.g. via Tools/Build Lazarus. Make sure you set up debugging flags like -g or -gw2. Best is to use the profile "Debug IDE" which contains many flags useful for debugging.
  4. Open the ide\lazarus.lpi project (always with the 1st instance of Lazarus).
  5. Compile this lazarus project (always with the 1st instance of Lazarus): another instance of Lazarus should appear (called 2nd instance of Lazarus).
  6. Set breakpoints as needed etc in the opened source code (in the 1st instance of Lazarus), and play with 2nd run-time instance: for example, install a design-time static package *.lpk, then use, interact with this just installed package inside this 2nd instance.
The "Compile this lazarus project" part is wrong! It should say "Run this lazarus project".
Which Wiki page says that? It must be fixed. The project cannot be compiled as you noticed.

Most installed IDE packages should get the same debug flags, and thus blue dots for debugging, when you do a clean build. They have a macro $(IDEBuildOptions) in their options.

I have never debugged and older Lazarus version using a trunk version. Having sources and binaries in 2 places while debugging can be tricky.
Would it work if you rename a trunk Lazarus binary (like "lazarus_trunk"), then copy it into your 3.4 directory, run it and run the 3.4 lazarus.lpi project?
I haven't tried.

One more issue :
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40973
The debugger does not like the -Sy option. Remove it from the "Debug IDE" profile if you have it.
Currently the trunk FpDebug does not even compile with it. IMO Martin should fix the code so that it compiles and work also with -Sy.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

n7800

  • Full Member
  • ***
  • Posts: 134
Re: error while building Lazarus
« Reply #7 on: June 30, 2024, 08:40:44 am »
The "Compile this lazarus project" part is wrong! It should say "Run this lazarus project".
Which Wiki page says that? It must be fixed. The project cannot be compiled as you noticed.

https://wiki.freepascal.org/Extending_the_IDE#Debugging_the_IDE

It's written here. You can correct this word now, and maybe someday I will write more detailed instructions, as in my post above.

https://wiki.freepascal.org/How_To_Write_Lazarus_Component#Design-time_component_debugging

There is also a similar instruction here, but it says "Run" rather than "Compile". But I think, in order to avoid duplication and not miss anything, it’s better to just provide a link to the wiki-page above.

n7800

  • Full Member
  • ***
  • Posts: 134
Re: error while building Lazarus
« Reply #8 on: June 30, 2024, 08:47:36 am »
The reason I want to use the trunk version to debug v3.4 is because I've configured the trunk version to work the way I like Lazarus to work and I don't remember all the settings I changed and there is no way of exporting all the settings and importing them in another installation (at least not that I know of.)

The Lazarus configuration is in one folder. On Windows, the default folder is "C:\Users\<UserName>\AppData\Local\lazarus". But if you used fpcupdeluxe, then a different path may be used. You can see it in the "lazarus.cfg" file, if one exists in your Lazarus folder.

To transfer settings, you can simply copy all files from the settings folders. But you should understand that there may be some incompatibility between versions. Be sure to create backups.

After this, when starting, a warning may appear that these are settings from another IDE (due to changed paths and versions). Just confirm and the window will no longer appear.

440bx

  • Hero Member
  • *****
  • Posts: 4491
Re: error while building Lazarus
« Reply #9 on: June 30, 2024, 09:04:47 am »
The "Compile this lazarus project" part is wrong! It should say "Run this lazarus project".
Which Wiki page says that? It must be fixed. The project cannot be compiled as you noticed.
Here is the link to the Wiki page that has the statement https://wiki.freepascal.org/Extending_the_IDE#Debugging_the_IDE

I have never debugged and older Lazarus version using a trunk version. Having sources and binaries in 2 places while debugging can be tricky.
What I really want is for the debugger version/instance to be invariant/stable.  IOW, I want the debugger installation to be completely independent of the installation I'm debugging.  Having both change when a change is made is just too confusing.  One installation/version has to remain unchanged.
 
I was trying to use the trunk version because I have that installation configured the way I like and, unfortunately, the only way I know how to get there is by trial and error which is frustrating.  Very unfortunately, since I tried compiling v3.4 with my trunk installation, the trunk installation never gets the blue dots in the right place.  I'm out of luck as far as that goes.

One more issue :
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40973
The debugger does not like the -Sy option. Remove it from the "Debug IDE" profile if you have it.
Good to know this.  I checked and -Sy was there, I removed it but, so far, the build "Normal IDE" produces a debugable IDE therefore I'm going to stick to that because I know it works, it's working as I type this.

In the meantime... there is more stuff I'm working on... for the time being I'm going to focus mostly on that and revisit the debugging installation when I need a change in thoughts.




@n7800

Yes, I use fpcupdeluxe and I see that it creates "independent" configuration files for each installation it does.  What a great tool !! 

What's got me worried about transferring the settings from my current trunk installation (which has the settings the way I like) is that, that installation doesn't get the blue dots in the right place when it comes to debugging v3.4 and I have no idea how to fix that problem.  Even refreshing that trunk installation with fpcupdeluxe did not make that problem go away.  The last thing I want is to "export" that problem to a new installation.   As far as my settings go, I'm resigned to having to sweat figuring out most of the settings again the hard way (fortunately, colors, font and key mappings are easy... the rest is a different story.)

What I'm going to do is create another v3.4 installation to use as the debugger, configure it the traditional (hard) way (by trial and error) and hopefully eventually get it configured the way I like.  Not the first time I go through the process but, I don't look forward of going through it again.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4517
  • I like bugs.
Re: error while building Lazarus
« Reply #10 on: June 30, 2024, 09:23:04 am »
https://wiki.freepascal.org/Extending_the_IDE#Debugging_the_IDE
It's written here. You can correct this word now, and maybe someday I will write more detailed instructions, as in my post above.
I tried many times but got :
 Internal error: Status::getWikiText called for a good result, this is incorrect
Maybe you can change it.

In general Wiki pages easily get too verbose and have duplicate information. A simple task may then look intimidating for somebody reading instructions. This is an inherent problem with a multi-user Wiki system. Ideal would be a well structured and concise text.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4517
  • I like bugs.
Re: error while building Lazarus
« Reply #11 on: June 30, 2024, 09:33:02 am »
@440bx, you write about "trunk installation". Usually it is not "installed" but its sources are pulled from the repository and it is built and run in-place.
Why exactly do you want to debug Lazarus 3.4? It is in maintenance mode, all development happens in trunk. Are you changing the IDE internals or are you working on a plugin package? In both cases you should do it in Lazarus trunk.
Then you can use Git branches and other features directly in your local repository. Create a feature branch for your code, rebase it sometimes for the latest "main" branch etc.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

n7800

  • Full Member
  • ***
  • Posts: 134
Re: error while building Lazarus
« Reply #12 on: June 30, 2024, 11:56:43 am »
I tried many times but got :
 Internal error: Status::getWikiText called for a good result, this is incorrect
Maybe you can change it.

I get the same error... I tried changing the section and the entire page. There is also an error on the second page. An Internet search turned up nothing.

440bx

  • Hero Member
  • *****
  • Posts: 4491
Re: error while building Lazarus
« Reply #13 on: June 30, 2024, 11:58:18 am »
@440bx, you write about "trunk installation". Usually it is not "installed" but its sources are pulled from the repository and it is built and run in-place.
I have a fair number of copies of Lazarus "dating back" to Lazarus v1.8.4.  I call each one of them an "installation" (the great majority of them installed with fpcupdeluxe), it's also a way of identifying that particular installation.  I guess I could refer to it as v3.99 too.  Anyway, I see it as just an "installation" and refer to it that way.

Why exactly do you want to debug Lazarus 3.4? It is in maintenance mode, all development happens in trunk.
I choose that version because it is stable.  If I mess it up, I can "refresh" it to a working installation using fpcupdeluxe.

Are you changing the IDE internals or are you working on a plugin package?
First thing's first.  I want to see and learn how Lazarus works.  There are a number of features I'd like to contribute but, given that Lazarus is all OOP, the first thing I need to do is figure out  if I can manage to have a working understanding of how the thing functions. 

If I can do that then, I'll consider fiddling with the code in the trunk version.

(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

n7800

  • Full Member
  • ***
  • Posts: 134
Re: error while building Lazarus
« Reply #14 on: June 30, 2024, 12:02:03 pm »
@440bx, I'm not entirely sure what you mean - normal application breakpoints? Or about debugging the IDE itself?

What debugger do you have in the settings "Main menu > Tools > Options > Debugger > Debugger backend"? gdb or fpdebug?

 

TinyPortal © 2005-2018