Recent

Author Topic: Problems installing design time package in Lazarus 4.0 RC1  (Read 1620 times)

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Problems installing design time package in Lazarus 4.0 RC1
« on: October 28, 2024, 05:58:19 pm »
* Mac Mini M1
* macOS 14.6.1
* Lazarus 4.0 RC1
* FPC 3.3.1

Following on from my thread at https://forum.lazarus.freepascal.org/index.php/topic,69085.0.html, it seems that I am not quite out of the woods yet! I don't know if it's because of the problems I'm having with the startlazarus loader, but I am not able to installed a design time package which worked perfectly well on Lazarus 3.99. If someone could try it out and report back, I would be very grateful!

The library is called caLibrary and consists of a runtime package calibraryrun.lpk and calibrarydsgn.lpk. calibraryrun.lpk seems to build okay, and it looks as if calibrarydsgn.lpk builds okay when the install is started. However, Lazarus does not restart successfully and I'm wondering if this is stopping the control being added to the component palette. It is supposed to produce a component called TcaEdit on the caControls tab.
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #1 on: October 28, 2024, 06:25:19 pm »
Can I broaden the question: Has anyone been able to install a new component in Lazarus 4.0 RC1? Try this combined design and runtime package. It installs in 3.99 but not on 4.0 RC1 :o
« Last Edit: October 28, 2024, 06:28:47 pm by carl_caulkett »
"It builds... ship it!"

dbannon

  • Hero Member
  • *****
  • Posts: 3156
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #2 on: October 29, 2024, 12:17:33 am »
Yes, I have a working 4.0rc1 (on linux) and have installed kcontrols (design and run time) without problems.  And minor packages like IdentifierDictionary.

But I built my initial 4.0rc1 from source so know I have a working system.  That may not solve your problem (you are, after all using beta software) but will allow you to identify the problem.

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

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #3 on: October 29, 2024, 12:39:22 am »
Yes, I have a working 4.0rc1 (on linux) and have installed kcontrols (design and run time) without problems.  And minor packages like IdentifierDictionary.

But I built my initial 4.0rc1 from source so know I have a working system.  That may not solve your problem (you are, after all using beta software) but will allow you to identify the problem.

Davo

Thanks for the reply, Davo! Installing from source may have to be my next step, now that you've confirmed that installing components is possible with 4.0RC1...
"It builds... ship it!"

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #4 on: October 29, 2024, 12:43:44 am »
Try this combined design and runtime package. It installs in 3.99 but not on 4.0 RC1 :o
That package installed without any issues for me on Lazarus 4.0rc1 (though Linux x86_64).

However, Lazarus does not restart successfully and I'm wondering if this is stopping the control being added to the component palette. It is supposed to produce a component called TcaEdit on the caControls tab.
When Lazarus is unable to restart that means that there is an issue with the component it tried to install. In case the compilation of the package itself succeeded (the message window is able to show that) then you can assume Lazarus tries to incorporate that package on the rebuild.

However, when there is something wrong with the component itself (that is a very broad spectrum) then it might be able to 'crash' the IDE, resulting in failure to load the IDE.

Under normal circumstances Lazarus is able to detect this situation and tries to reload an older version of the IDE (it made a backup of itself just before doing a rebuild) which I have not seen failed (yet). As mentioned before afaik that is a feature specific to startlazarus (and as mentioned before, I do not know if that works the same for MacOS).

The problem is that the number of issues that could go wrong is pretty substantial and with that a variety of different causes and corresponding solutions.

That is why I mentioned before to not mix installations, not have a 'normal' system wide installed FPC/Lazarus setup (in case using FPCUpDeluxe, even though it should not matter but it sure can). To complicate things further you have rosetta that allows to mix-match between architectures.

That is why it is very important to distinguish these things and make a clear distinction between one and the other. If things are not clear for you then it is almost impossible to provide any help that is actually helpful for you.

For example, the fact that you seem to be mixing/trying 3.99 and 4.0rc1 both at the same time is already a warning sign (of things that could go wrong).
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #5 on: October 29, 2024, 12:52:45 pm »
When Lazarus is unable to restart that means that there is an issue with the component it tried to install. In case the compilation of the package itself succeeded (the message window is able to show that) then you can assume Lazarus tries to incorporate that package on the rebuild.

Both 3.99 and 4.0rc1 fail to restart properly. This is nothing to do with the component but because the startlazarus.app bundle is badly constructed (nothing to do with me, before you say anything!). The difference is that the component installs correctly on 3.99 but not on 4.0rc1.

As I demonstrated in my post https://forum.lazarus.freepascal.org/index.php/topic,69059.msg535775.html#msg535775, the Register procedure is not even being called in 4.0rc1 :o

As I also pointed out, attempts to install components via Package -> Install/Uninstall Packages or Package -> Online Package Manager also result in no components being added, under 4.0rc1.

The more I think about it, the more I am convinced that this is not a problem with Lazarus 4.0rc1 per se, rather a problem with the lazarus-darwin-aarch64-4.0RC1.zip download on https://sourceforge.net/projects/lazarus/files/Lazarus%20macOS%20aarch64/Lazarus%204.0RC1/, which is why I'm going to follow Davo's advice and rebuild Lazarus 4.0rc1 from source!

For example, the fact that you seem to be mixing/trying 3.99 and 4.0rc1 both at the same time is already a warning sign (of things that could go wrong).

Here we go again :o  3.99 and 4.0rc1 are in entirely different folders, with separate config paths, separate fpc installations, separate everything, basically! I really wish you would stop trying to portray what I'm doing as a confused mess, followed by "words of wisdom, based on experience"! It does come across as somewhat patronising :o

To illustrate this, one of the last things I did last night was to entirely delete my entire /Applications/Lazarus_4.0 folder, installed from the aforementioned lazarus-darwin-aarch64-4.0RC1.zip download. The old Lazarus 3.99 installation continued to work perfectly. Hardly "mixing/trying 3.99 and 4.0rc1 both at the same time", as any reasonable person would agree, I think!
"It builds... ship it!"

TRon

  • Hero Member
  • *****
  • Posts: 3623
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #6 on: October 29, 2024, 01:40:05 pm »
Both 3.99 and 4.0rc1 fail to restart properly. This is nothing to do with the component but because the startlazarus.app bundle is badly constructed (nothing to do with me, before you say anything!). The difference is that the component installs correctly on 3.99 but not on 4.0rc1.
I did not have any intention to blame that on you. It is just annoying that it does not seem to work that way as it does for other platforms.

Quote
As I demonstrated in my post https://forum.lazarus.freepascal.org/index.php/topic,69059.msg535775.html#msg535775, the Register procedure is not even being called in 4.0rc1 :o
Thanks, because I missed that particular post. I get confused by so many threads regarding the same setup (which is my problem, not yours).

Quote
As I also pointed out, attempts to install components via Package -> Install/Uninstall Packages or Package -> Online Package Manager also result in no components being added, under 4.0rc1.
Note only because I do not have the foggiest.

Quote
The more I think about it, the more I am convinced that this is not a problem with Lazarus 4.0rc1 per se, rather a problem with the lazarus-darwin-aarch64-4.0RC1.zip download on https://sourceforge.net/projects/lazarus/files/Lazarus%20macOS%20aarch64/Lazarus%204.0RC1/, which is why I'm going to follow Davo's advice and rebuild Lazarus 4.0rc1 from source!
That might very well be the case. I hate to ask but have you tried using the x86_64 version and does that act the same ? e.g. are you able to confirm that suspicion ?

Quote
Here we go again :o  3.99 and 4.0rc1 are in entirely different folders, with separate config paths, separate fpc installations, separate everything, basically! I really wish you would stop trying to portray what I'm doing as a confused mess, followed by "words of wisdom, based on experience"! It does come across as somewhat patronising :o
It is not meant to be patronizing.

I am used to have different Lazarus versions installed for over a decade and all it takes to end up in mayhem is one single slip-up. Most common one being not setting the pcp path. Once it is there (at the default location(s) it just lingers and waits for the next subtle fault where things get complicated pretty fast.

It is the most common error and one that is repeated over and over again over the years and thus results in a re-occurring  topic.

Got another common one: rebuilding the IDE from the command-line instead of letting Lazarus do it for you. And then not mentioning having a system wide installed FPC while Lazarus was installed with FPCUpDeluxe or using FPCUpdeluxe layout with an included compiler).

That list goes on and on and the people on the other side of the internet-wire that are trying to help can never be sure if a person fell for the most obvious pitfalls. And knowing it is not your fault but having something like Rosetta adds to the confusion. People even get confused when running make files with WSL and/or wine. You gotta love seamless integration.

But, since I do not have the hardware myself, I am unable to test and I get tired of taking blindfolded drives so I wish you good luck !
This tagline is powered by AI (AI advertisement: Free Pascal the only programming language that matters)

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #7 on: October 29, 2024, 02:18:48 pm »
The more I think about it, the more I am convinced that this is not a problem with Lazarus 4.0rc1 per se, rather a problem with the lazarus-darwin-aarch64-4.0RC1.zip download on https://sourceforge.net/projects/lazarus/files/Lazarus%20macOS%20aarch64/Lazarus%204.0RC1/, which is why I'm going to follow Davo's advice and rebuild Lazarus 4.0rc1 from source!

That might very well be the case. I hate to ask but have you tried using the x86_64 version and does that act the same ? e.g. are you able to confirm that suspicion ?

I haven't tried that yet. I'll do so once I get a build from source done.
« Last Edit: October 29, 2024, 03:10:26 pm by carl_caulkett »
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #8 on: October 29, 2024, 03:09:04 pm »
Yes, I have a working 4.0rc1 (on linux) and have installed kcontrols (design and run time) without problems.  And minor packages like IdentifierDictionary.

But I built my initial 4.0rc1 from source so know I have a working system.  That may not solve your problem (you are, after all using beta software) but will allow you to identify the problem.

Davo

Thanks for the reply, Davo! Installing from source may have to be my next step, now that you've confirmed that installing components is possible with 4.0RC1...

With fpc 3.3.1 installed under /Applications/Lazarus_4.0, I tried make bigide, but almost straight away it failed with...
Code: Bash  [Select][+][-]
  1. /Applications/Lazarus_4.0  make bigide
  2. /Applications/Xcode.app/Contents/Developer/usr/bin/make -C packager/registration
  3. /bin/rm -f ../units/aarch64-darwin/fcllaz.ppu
  4. /bin/mkdir -p ../units/aarch64-darwin
  5. /Applications/Lazarus_4.0/fpc/bin/aarch64-darwin/ppca64 -MObjFPC -Scghi -O1 -g -gl -l -vewnhibq -gw -Fu. -FE. -FU../units/aarch64-darwin -XR/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -daarch64 fcllaz.pas
  6. Hint: (11030) Start of reading config file /Users/carlcaulkett/.fpc.cfg
  7. Hint: (11030) Start of reading config file /etc/fpc.cfg
  8. Hint: (11031) End of reading config file /etc/fpc.cfg
  9. Hint: (11031) End of reading config file /Users/carlcaulkett/.fpc.cfg
  10. Free Pascal Compiler version 3.3.1-16659-g8e58bbea61-dirty [2024/10/16] for aarch64
  11. Copyright (c) 1993-2024 by Florian Klaempfl and others
  12. (1002) Target OS: Darwin for AArch64
  13. (3104) Compiling fcllaz.pas
  14. Fatal: (10022) Can't find unit system used by fcllaz
  15. Fatal: (1018) Compilation aborted
  16. make[1]: *** [fcllaz.ppu] Error 1
  17. make: *** [registration] Error 2
  18.  

I'm now going to replace fpc 3.3.1 with a FpcUpDeluxe generated fcp 3.2.2 since that seem to be the default choice for 4.0rc1. I shall report back, although I do grow weary of all of these shenanigans ;)
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #9 on: October 29, 2024, 05:03:17 pm »
I got exactly the same results with fpc 3.2.2.
« Last Edit: October 29, 2024, 05:57:34 pm by carl_caulkett »
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #10 on: October 29, 2024, 06:15:09 pm »
So, I tried the build from source option again with @TRon's great suggestion of make clean all bigide FPC="/Applications/lazarus_4.0/fpc/bin/aarch64-darwin/fpc.sh". This is using FPC 3.2.2, btw.

Happily, the build completed! However, I am left with 3 problems:
  • The startlazarus.app bundle still doesn't work. It comes up with "Can't find the lazarus executable /Applications/lazarus_4.0/startlazarus.app/Contents/MacOS/lazarus". I may be able to fix this with a shell script I have for constructing .app bundles for macOS
  • Whereas previous attempts, for all of their failures, have, at least, given me a Lazarus which respects the Dark Mode of my macOS, this one seams to resolutely insist on a light mode :o
  • Worst of all, components still will not install. See below for more details...

My test component is...
Code: Pascal  [Select][+][-]
  1. unit testEdit;
  2.  
  3. {$mode ObjFPC}{$H+}
  4.  
  5. interface
  6.  
  7. uses
  8.   Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, StdCtrls;
  9.  
  10. type
  11.   TtestEdit = class(TEdit)
  12.   end;
  13.  
  14. procedure Register;
  15.  
  16. implementation
  17.  
  18. procedure Register;
  19. begin
  20.   RegisterComponents('Test',[TtestEdit]);
  21.   ShowMessage('Register called!');
  22. end;
  23.  
  24. end.
  25.  

With 4.0rc1, the 'Register called!' message is not being displayed when Lazarus is stated after an IDE rebuild, indicating that the Register command is not being called.

with 3.99, the message is displayed, the component is installed, and all is well  ;)

UPDATE: With regard to item 2 in the list, my Configure "Build Lazarus" settings are: LCL widget type=Cocoa, Target OS=Darwin, Target CPU=aarch64, Options=-WM10.4 -vd

I've also tried Options=-WM11.0 -vd which is how it is set in my Dark and Doomy 3.99 ;)

I am at a loss as to what else to try :o
« Last Edit: October 29, 2024, 06:51:25 pm by carl_caulkett »
"It builds... ship it!"

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10553
  • Debugger - SynEdit - and more
    • wiki
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #11 on: October 29, 2024, 06:53:54 pm »
There must be an autogenerated unit in that package, that uses your unit and has an initialization section
Code: Pascal  [Select][+][-]
  1. initialization
  2.   RegisterPackage('name', @Register);
  3. end.
  4.  

and in your PCP there should be a file staticpackages.inc that contains the name of that unit.

Is both there.

If the 2nd is missing:
- uninstall the package (probably no need to rebuild)
- restart ide
- install again
- rebuild


When rebuilding, check that staticpackages.inc is updated => put some comment in there, it should disappear.  Otherwise you probably got the wrong  PCP.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 10553
  • Debugger - SynEdit - and more
    • wiki
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #12 on: October 29, 2024, 06:54:56 pm »
you can also check that the IDE is build with your package => but a syntax error into your unit.

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #13 on: October 29, 2024, 06:59:11 pm »
There must be an autogenerated unit in that package, that uses your unit and has an initialization section
Code: Pascal  [Select][+][-]
  1. initialization
  2.   RegisterPackage('name', @Register);
  3. end.
  4.  

and in your PCP there should be a file staticpackages.inc that contains the name of that unit.

Is both there.

If the 2nd is missing:
- uninstall the package (probably no need to rebuild)
- restart ide
- install again
- rebuild


When rebuilding, check that staticpackages.inc is updated => put some comment in there, it should disappear.  Otherwise you probably got the wrong  PCP.

The test library is called testpkg.lpk, and yes there is an autogenerated file testpkg.pas, consisting of...
Code: Pascal  [Select][+][-]
  1. { This file was automatically created by Lazarus. Do not edit!
  2.   This source is only used to compile and install the package.
  3.  }
  4.  
  5. unit testpkg;
  6.  
  7. {$warn 5023 off : no warning about unused units}
  8. interface
  9.  
  10. uses
  11.   testEdit, LazarusPackageIntf;
  12.  
  13. implementation
  14.  
  15. procedure Register;
  16. begin
  17.   RegisterUnit('testEdit', @testEdit.Register);
  18. end;
  19.  
  20. initialization
  21.   RegisterPackage('testpkg', @Register);
  22. end.
  23.  

UPDATE: This is my staticpackages.inc, and yes, testpkg is in there!
Code: Pascal  [Select][+][-]
  1. // In case of duplicate identifier errors, see lazarus.pp
  2. laztestinsight,
  3. datetimectrls,
  4. sdflaz,
  5. anchordockpkg,
  6. lhelpcontrolpkg,
  7. pascalscript,
  8. testpkg,
  9. printer4lazarus,
  10. anchordockingdsgn,
  11. charactermap_ide_pkg,
  12. chmhelppkg,
  13. datetimectrlsdsgn,
  14. dbflaz,
  15. editormacroscript,
  16. exampleprojects,
  17. externhelp,
  18. fpcunitide,
  19. instantfpclaz,
  20. jcfidelazarus,
  21. lazprojectgroups,
  22. memdslaz,
  23. printers4lazide,
  24. projtemplates,
  25. runtimetypeinfocontrols,
  26. sqldblaz,
  27. allsyneditdsgn,
  28. tachartlazaruspkg,
  29. todolistlaz,
  30. turbopoweripro,
  31. dockedformeditor,
  32. onlinepackagemanager,
  33. simplewebservergui,
  34. turbopoweriprodsgn,
  35. leakview,
  36. pas2jsdsgn,
  37.  
« Last Edit: October 29, 2024, 07:02:31 pm by carl_caulkett »
"It builds... ship it!"

carl_caulkett

  • Hero Member
  • *****
  • Posts: 649
Re: Problems installing design time package in Lazarus 4.0 RC1
« Reply #14 on: October 29, 2024, 09:13:37 pm »
When rebuilding, check that staticpackages.inc is updated => put some comment in there, it should disappear.  Otherwise you probably got the wrong  PCP.

I put in a comment and it disappeared.

you can also check that the IDE is build with your package => but a syntax error into your unit.

I put in a syntax error and the Rebuild Lazarus routine picked it up seconds after starting.

I'm just wondering how important to the success of the rebuild is the automatic restarting of Lazarus... I'm guessing that because the component gets installed in 3.99 which fails to restart properly, but not in 4.0rc1 which also fails to restart, that the answer is "not very"!

UPDATE: Interesting! I've just use FcpUpDeluxe to install FCP 3.22 and Lazarus 3.2 in an entirely separate folder to the others, and this one automatically restarts after a Lazarus Rebuild, and it installs the test component :o

As an experiment, I backed up the 4.0rc1 startlazarus executable and the startlazarus.app bundle which links to it, and then copied in the corresponding files from 3.2! When I ran startlazarus.app it flashed up the start screen from Lazarus 3.2 but then proceeded to open up Lazarus 4.0rc1. Curiouser and curiouser ;)  However, this did not solve the automatic restarting of the Lazarus rebuild in 4.0rc1, and the component remains resolutely uninstalled.

I'm going to draw a line over my attempts get this to work, although if @Martin_fr or any of the other Lazarus devs want me to try any thing else, just ask  :)
"It builds... ship it!"

 

TinyPortal © 2005-2018