Steve--W / XComponents

Lazarus package - components cross-compilable to web
12 stars 3 forks source link

[3.155] C:\XComponents-master\nodeutils.pas(20,3) Fatal: (10022) Can't find unit uCEFApplication used by NodeUtils #1

Open JanuszChmiel opened 1 year ago

JanuszChmiel commented 1 year ago

Dear elite Pascal programmers, Does somebody of you know, how to fix FPC compiler bug [3.155] C:\XComponents-master\nodeutils.pas(20,3) Fatal: (10022) Can't find unit uCEFApplication used by NodeUtils when building your package? YOu are incorporated so many various components and I like form based approach very much. Because even though I do not see at all, I can use Lazarus form builder and component list to choose The right GUI component from The list. Thank you for your advice where to find The needed unit, right unit version so I will be able to build your package.

Morabaraba commented 1 week ago

Late to the party but...

You need to remove the -dChromium flag. From within the IDE, "Options" > "Compiler Options" > "Custom Options", or a git diff.

$ git diff
diff --git a/xcomponents.lpk b/xcomponents.lpk
index ca28f9a..a2f9a01 100644
--- a/xcomponents.lpk
+++ b/xcomponents.lpk
@@ -49,7 +49,6 @@
         <Verbosity>
           <ShowAll Value="True"/>
         </Verbosity>
-        <CustomOptions Value="-dChromium"/>
       </Other>
     </CompilerOptions>
     <Files Count="43">

To use Chromium follow the Pre-Requisites, 2. CEF Section.

Edit: I also had to register TXForm for it to work in my env (laz-ide v3.4, fpc 3.2.2, pas2js 3.1.1)

$ git diff xform.pas
diff --git a/xform.pas b/xform.pas
index 74d7d38..6c1b8ae 100644
--- a/xform.pas
+++ b/xform.pas
@@ -102,6 +102,10 @@ type TOpenXForm = record
 end;
 var OpenXForms : array of TOpenXForm;

+{$ifndef JScript}
+procedure Register;
+{$endif}
+
 implementation

 var
@@ -153,8 +157,24 @@ begin
     end;
 end;

 {$ifndef JScript}

+procedure Register;
+begin
+  // Lazarus IDE component registration
+  RegisterComponents('XComponents',[TXForm]);
+end;
+
 //function FindFormByName(const AName: string): TForm;      //!!!!namespace??
 //var
 //  i: Integer;

Example one complained about two units, i just commented them out.

$ git diff ExampleProjects/XExample1/example1unit.pas
diff --git a/ExampleProjects/XExample1/example1unit.pas b/ExampleProjects/XExample1/example1unit.pas
index ad29183..c4461a3 100644
--- a/ExampleProjects/XExample1/example1unit.pas
+++ b/ExampleProjects/XExample1/example1unit.pas
@@ -11,7 +11,7 @@ uses
   {$ifndef JScript}
   FileUtil, Forms, Controls, Graphics, Dialogs, LCLIntf,
   ExtCtrls, Menus, ComCtrls, StdCtrls, TypInfo, LazIDEIntf, LResources,
-  Types, IpHtml, Ipfilebroker,
+  Types, (*IpHtml, Ipfilebroker,*)
   CompilerLogUnit,  LazsUtils,
 {$else}
   HTMLUtils,

Finally here is a screenshot of the result with the ide on the left and the win and browser app on teh right.