Runtime and Designtime package problem lazarus / 4-Ported from Delphi-Kylix ---------------------------------------------------------------------- Chemware · 2008-01-17 02:36 g'day, I'm porting some Delphi packages of visual controls to Lazarus using 0.9.24 win32. I'm using the same Delphi paradigm (and source code) of a runtime and a designtime package, in which the runtime package contains all the .pas files, and designtime package uses runtime, but otherwise only contains the registration. ie: misc_run.lpk:    component1.pas, component2.pas, component3.pas, etc. misc_design.lpk: misc_reg.pas only. required package: misc_run. misc_reg.pas:    uses component1.pas, component2.pas, component3.pas, etc.                  contains procedure Register. The directory structure is: Code: [Select]Misc   |- D7   |- Lazarus           (contains misc_run.lpk, misc_design.lpk)      |- backup      |- lib            (.ppu and .o appear here on _install_)         |- i386-win32  (.ppu and .o appear here on compile)      |- units         |- i386            |- win32   |- Source            (contains component1.pas, etc) Both misc_run.lpk and misc_design.lpk (now !) compile without error or warning, and put their output .o and .ppu files into Misc\Lazarus\lib\i386-win32. However, when I try to install the designtime package, misc_design.lpk, all proceeds well until the process halts with an error: Ambiguous Unit Found The unit component1 exists twice in the path of the IDE: 1. Misc\Lazarus\lib\i386-win32\component1.ppu 2. Misc\Lazarus\lib\component1.ppu and on checking, the installation process has in addition output the same binary files into Misc\Lazarus\lib\. I've tried fiddling with various options, but cannot fix this behaviour. Can someone please give me a pointer ? TIA, Mat ---------------------------------------------------------------------- Phil · 2008-01-17 04:16 Quote from: "Chemware"Ambiguous Unit Found The unit component1 exists twice in the path of the IDE: 1. Misc\Lazarus\lib\i386-win32\component1.ppu 2. Misc\Lazarus\lib\component1.ppu and on checking, the installation process has in addition output the same binary files into Misc\Lazarus\lib\. That does look odd and offhand it sounds like something that should be easy to fix, but at this hour I just can't think of anything. Looking at one of my .lpk files I see only this for -FU (Unit output directory): units/$(TargetCPU)-$(TargetOS) In your case it should read "lib" instead of "units". Normally the install doesn't recompile anything so that's seems odd too. Thanks. -Phil ---------------------------------------------------------------------- Chemware · 2008-01-17 04:59 Thanks for that quick reply Phil ! Quote from: "Phil"... Looking at one of my .lpk files I see only this for -FU (Unit output directory): units/$(TargetCPU)-$(TargetOS) In your case it should read "lib" instead of "units". Normally the install doesn't recompile anything so that's seems odd too. The contents of Package -> Compiler Options :: Paths :: Unit output directory (-FU) is exactly what you suggest: lib\$(TargetCPU)-$(TargetOS)\ what really bugs me is that the compile puts the binaries exactly where they are supposed to go. It's like the "install" process is not reading the location of the binaries it produced in the "compile" process. ---------------------------------------------------------------------- Phil · 2008-01-17 15:16 Quote from: "Chemware"what really bugs me is that the compile puts the binaries exactly where they are supposed to go. It's like the "install" process is not reading the location of the binaries it produced in the "compile" process. Here's some things you could try: - Try the latest 0.9.25 snapshot and see if that makes any difference. - Look at the source for the IDE's Package dialog and see if you can figure out exactly what it's doing. I believe this dialog's code and forms is in the Lazarus packager folder. - I don't suppose you could post your code or a simple example that can reproduce this on the Lazarus bug tracker? - What is units\i386\win32 for? - I assume your package includes a requirement for the LCL and IDEIntf packages, right? Thanks. -Phil ---------------------------------------------------------------------- Chemware · 2008-01-18 04:03 Thanks for that Phil ! Quote from: "Phil"- Try the latest 0.9.25 snapshot and see if that makes any difference. That caused all sorts of interesting problems. Turns out the misc_run.lpk file had become corrputed, and so I had to rebuild the .lpk from scratch. I did that, and now both the runtime and designtime compile just fine, but when I installed the designtime, I got a showstopper error about componenttreeview.pas. Worked out that was an IDE file, so rebuilt the IDE without my files. Fixed that problem. Tried to install again, and now get an error: "Compile IDE (without linking)" completed G:\Data\Delphi\Components\Misc\source\CheckGroupBox.pas(54,21) Error: Identifier not found "class" G:\Data\Delphi\Components\Misc\source\CheckGroupBox.pas(55,3) Error: Error in type definition G:\Data\Delphi\Components\Misc\source\CheckGroupBox.pas(55,3) Fatal: Syntax error, ";" expected but "identifier PRIVATE" found That line is a classic class definition (irrelevant guff removed): Code: [Select]unit CheckGroupBox; interface uses   Classes,   {$IfDef FPC}LCLIntf, LMessages,{$EndIf} Windows,   {$IFDEF CLR}System.ComponentModel, Variants,{$ENDIF}   Controls, Messages, Stdctrls; type   TrGroupBox = class(TGroupBox) I think that the 9.25 snapshot is still a bit flakey. Quote- I don't suppose you could post your code or a simple example that can reproduce this on the Lazarus bug tracker? Will do that if worst comes to worst. Is a lot of files to tidy up. Quote- What is units\i386\win32 for? Someone else's idea. I use libs\i386\win32 for binary output. Quote- I assume your package includes a requirement for the LCL and IDEIntf packages, right? Yes - FPC, LCL, IDEInft and misc_run are the required packages. Will cogitate on this some more, and maybe re-install 0.9.24 in a different location and try it again. ---------------------------------------------------------------------- Chemware · 2008-01-18 05:35 OK, re-installed 0.9.24 in a different location, and now, when I try to install, I get: "Compile IDE (without linking)" completed Recompiling misc_run, checksum changed for Splash c:\p\lazarus_0.9.24\ide\lazarus.pp(1,1) Fatal: Can't find unit misc_run used by Lazarus Also tried creating a single package, that is Runtime+Designtime, and added the registration unit, and nominated it as the registration unit, and I get the same error 8^( ---------------------------------------------------------------------- Vincent Snijders · 2008-01-18 08:32 Quote from: "Chemware" Recompiling misc_run, checksum changed for Splash c:\p\lazarus_0.9.24\ide\lazarus.pp(1,1) Fatal: Can't find unit misc_run used by Lazarus( Lazarus has a unit called Splash. Do you have a unit called splash too? If so, rename it. ---------------------------------------------------------------------- Phil · 2008-01-18 15:14 Quote from: "Chemware"I did that, and now both the runtime and designtime compile just fine, but when I installed the designtime, I got a showstopper error about componenttreeview.pas. Worked out that was an IDE file, so rebuilt the IDE without my files. Fixed that problem. Tried to install again, and now get an error: "Compile IDE (without linking)" completed G:\Data\Delphi\Components\Misc\source\CheckGroupBox.pas(54,21) Error: Identifier not found "class" G:\Data\Delphi\Components\Misc\source\CheckGroupBox.pas(55,3) Error: Error in type definition G:\Data\Delphi\Components\Misc\source\CheckGroupBox.pas(55,3) Fatal: Syntax error, ";" expected but "identifier PRIVATE" found Sorry, I forgot to mention that the current snapshots of 0.9.25 on Windows require that you first rebuild IDE Interface before you can install a package. In Tools | Configure set everything to None except IDE Interface and rebuild. The "class" error is because you haven't enabled Delphi compatibility. Check Delphi Compatible box in Compiler Options. One other thing: You don't have to use Windows or Messages unit with Lazarus since those are represented by LclIntf and LMessages. Here's what the uses looks like in most of my units:   {$IFNDEF LCL} Windows, Messages, {$ELSE} LclIntf, LMessages, LclType, LResources, {$ENDIF} Now it's compatible with both Delphi and Lazarus _and_ it's cross platform ready. If your unit doesn't have a form you can probably omit LResources. Thanks. -Phil ---------------------------------------------------------------------- Chemware · 2008-01-19 04:46 Thanks again Phil (and Vincent), but ... Quote from: "Phil"Sorry, I forgot to mention that the current snapshots of 0.9.25 on Windows require that you first rebuild IDE Interface before you can install a package. In Tools | Configure set everything to None except IDE Interface and rebuild. Done. QuoteThe "class" error is because you haven't enabled Delphi compatibility. Check Delphi Compatible box in Compiler Options. Done. QuoteOne other thing: You don't have to use Windows or Messages unit with Lazarus since those are represented by LclIntf and LMessages and still get the "can't find unit misc_run used by Lazarus" error message - even though it is then opened up in the editor ! There is also a dialog box, with: Unable to find the file "misc_run.pas". If it belongs to your project, check the search path in: Project -> Compiler Options -> Search Paths -> Other Unit Files ... I do, and therefore add the absolute path of the directory with that file in it (G:\Data\Delphi\Components\Misc\Lazarus\). However, it still fails with the same error, and when I check that "Other Unit Files", the directory I entered has been replaced by a ".". Now, while "." means something under *nix, does it mean anything on Lazarus under Windows ??? ---------------------------------------------------------------------- Phil · 2008-01-19 14:27 Quote from: "Chemware"and still get the "can't find unit misc_run used by Lazarus" error message - even though it is then opened up in the editor ! There is also a dialog box, with: Unable to find the file "misc_run.pas". If it belongs to your project, check the search path in: Project -> Compiler Options -> Search Paths -> Other Unit Files ... I assume misc_run.pas is the main auto-created file in your misc_run.lpk package. Whenever you compile an app that uses this package, Lazarus re-compiles the package's main file. Maybe what it's telling you is that it can't find the package's misc_run.pas file, not the project's. I wonder if there's something else going on. There are probably hundreds of packages out there so I doubt if it's a general problem with packages or Lazarus or we'd probably hear about it here. Can you install and use other packages okay? I can point you to some that you can test with your Laz installation. Thanks. -Phil