Lazarus

Using the Lazarus IDE => Editor => Topic started by: Dan3468298 on July 05, 2020, 03:16:58 am

Title: Cannot Specify Printer4Lazarus in Project Inspector
Post by: Dan3468298 on July 05, 2020, 03:16:58 am
I installed Printer4Lazarus (see first attached image) yet cannot specify it as a Requirement in Project Inspector because the package is listed as Online. I have tried to remove and re-add to no avail.   I am not sure if my Package Manager became corrupt because I could spec the Printer4Lazarus in another project.   
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: trev on July 05, 2020, 04:24:00 am
As your printer woes seem to be related to your earlier thread (https://forum.lazarus.freepascal.org/index.php/topic,50395.0.html), if it was me, I would uninstall Lazarus, delete the .lazarus (dot lazarus) directory in your home directory and then reinstall a fresh copy of Lazarus.
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: JuhaManninen on July 05, 2020, 10:02:16 am
Is it really listed as online? Maybe it already is a dependency for your project through some other package.
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: Dan3468298 on July 05, 2020, 01:25:36 pm
The screen shots are for a new project with only the default code.   I previously had Lazarus pre-2.0.8 installed on Mac OS but couldn't get it to run because of linking errors so after awhile I did a complete uninstall with the wiki script then installed 2.0.8.  All worked fine until tried Printer4Lazarus.  See attached for new screen shot that explicitly shows Lazarus thinks the Printer4Lazarus is Online though PackageManager lists it as Installed.   After removing Printer4Lazarus it is marked with a Red 'x', why?  (see second screenshot).   Thanks!
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: JuhaManninen on July 05, 2020, 05:53:06 pm
The screen shots are for a new project with only the default code.   I previously had Lazarus pre-2.0.8 installed on Mac OS but couldn't get it to run because of linking errors so after awhile I did a complete uninstall with the wiki script then installed 2.0.8.  All worked fine until tried Printer4Lazarus.  See attached for new screen shot that explicitly shows Lazarus thinks the Printer4Lazarus is Online though PackageManager lists it as Installed.
There is something wrong in your installation or configuration. Please see my screenshots. Printer4Lazarus shows there as expected. It is not online and I can add it as a new project dependency to one of my test projects. No problems.

Quote
After removing Printer4Lazarus it is marked with a Red 'x', why?  (see second screenshot).   Thanks!
Good question. The packages have many icons to indicate their state and purpose. I don't  remember what the red 'x' means. Somebody else may remember (wp maybe).
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: Dan3468298 on July 05, 2020, 06:33:34 pm
I did an uninstall using the script from Wiki then deleted .Lazarus in home folder and Lazarus folder in Library.   Downloaded files again installing FPC, FPC Source, then Laz.   Ran Laz and with default code tried to add Printer4Lazarus to new project but it is still marked as Online.  How can this be?   Are there other files that have to be removed that are not documented?
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: howardpc on July 05, 2020, 08:21:44 pm
Quote
After removing Printer4Lazarus it is marked with a Red 'x', why?  (see second screenshot).   Thanks!
Good question. The packages have many icons to indicate their state and purpose. I don't  remember what the red 'x' means. Somebody else may remember (wp maybe).
The icon in question is named pkg_package_uninstall.png. The L overlay indicates that it is a Lazarus package (the icons used are all in .../Lazarus/images/packages).
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: trev on July 06, 2020, 05:11:37 am
I can confirm that this appears to be a bug.

Fresh installation of Mojave in a VM with Xcode, Xcode command line tools, Lazarus 2.0.6 and FPC 3.0.4.

Attachment 1 - shows Printer4Lazarus is installed
Attachment 2 - shows Printer4Lazarus as "online" and not installed
Attachment 3 - shows attempt to Install from Project Inspector

Error message when compiling otherwise blank project after adding printer4lazarus to uses clause of project source:

Quote
Compile Project, Target: project1: Exit code 1, Errors: 1
project1.lpr(10,10) Fatal: Cannot find printer4lazarus used by project1. Check if package Printer4Lazarus is in the dependencies of the Project Inspector.

Directory listing of /Library/Lazarus/components/printers/lib/x86_64-darwin/cocoa showing printer4lazarus:

Code: Text  [Select][+][-]
  1. -rw-r--r--  1 root  wheel     546  6 Nov  2019 Printer4Lazarus.compiled
  2. -rw-r--r--  1 root  wheel  265188  5 Nov  2019 cocoaprndelegate.o
  3. -rw-r--r--  1 root  wheel    9920  5 Nov  2019 cocoaprndelegate.ppu
  4. -rw-r--r--  1 root  wheel  201220  5 Nov  2019 osprinters.o
  5. -rw-r--r--  1 root  wheel   30780  5 Nov  2019 osprinters.ppu
  6. -rw-r--r--  1 root  wheel    1776  6 Nov  2019 printer4lazarus.o
  7. -rw-r--r--  1 root  wheel    1456  6 Nov  2019 printer4lazarus.ppu
  8. -rw-r--r--  1 root  wheel   11836  5 Nov  2019 printer4lazstrconst.o
  9. -rw-r--r--  1 root  wheel    8182  5 Nov  2019 printer4lazstrconst.ppu
  10. -rw-r--r--  1 root  wheel    4345  5 Nov  2019 printer4lazstrconst.rsj
  11. -rw-r--r--  1 root  wheel  270012  5 Nov  2019 printersdlgs.o
  12. -rw-r--r--  1 root  wheel   12179  5 Nov  2019 printersdlgs.ppu
  13. -rw-r--r--  1 root  wheel    9505  5 Nov  2019 printersdlgs.res

As the original poster indicated, I cannot add Printer4Lazarus using the Project Inspector.

The workaround was to manually add it to the project.lpi file changing:

Code: XML  [Select][+][-]
  1.    <RequiredPackages Count="1">
  2.       <Item1>
  3.         <PackageName Value="LCL"/>
  4.       </Item1>
  5.    </RequiredPackages>

to:

Code: XML  [Select][+][-]
  1.     <RequiredPackages Count="2">
  2.       <Item1>
  3.         <PackageName Value="Printer4Lazarus"/>
  4.       </Item1>
  5.       <Item2>
  6.         <PackageName Value="LCL"/>
  7.       </Item2>
  8.     </RequiredPackages>

I also tried Lazarus 2.1.0 (trunk r63272) with FPC v3.3.1 (trunk r45525) on Mojave with the same results.
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: Dan3468298 on July 06, 2020, 02:13:21 pm
Thank you Trev.  Your workaround worked for me on Catalina.
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: skalogryz on July 06, 2020, 04:16:48 pm
you can also Open the package (through "Installed Packages" dialog) and click "Use"->"Add to project"
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: Dan3468298 on July 06, 2020, 04:31:04 pm
Please excuse my ignorance but where do I find the 'Installed Packages' dialog?   This should be under the 'Package' menu?
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: skalogryz on July 06, 2020, 04:48:05 pm
Please excuse my ignorance but where do I find the 'Installed Packages' dialog?   This should be under the 'Package' menu?
Sorry, I meant Packages -> "Open Loaded Packages"
It should give you the list of IDE installed packages. When you double click one any of those it will bring up the package dialog.
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: Dan3468298 on July 06, 2020, 11:55:18 pm
Is this considered a Bug?  If so, who wants to file the report?
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: trev on July 07, 2020, 05:04:13 am
Is this considered a Bug?  If so, who wants to file the report?

I would think so. Usually the person who encounters the issue would log an issue in the BugTracker. If you do not wish to do so, I'm happy to do it.

As there is a workaround, you might also wish to mark this thread as [SOLVED] by modifying the post title in the first post.
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: JuhaManninen on July 07, 2020, 11:25:44 am
Is this considered a Bug?  If so, who wants to file the report?
It must be specific to MacOS somehow. Can you please verify that it happens only on MacOS. Does widgetset (Carbon / Cocoa) make a difference?
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: Dan3468298 on July 07, 2020, 05:02:55 pm
Is this considered a Bug?  If so, who wants to file the report?
It must be specific to MacOS somehow. Can you please verify that it happens only on MacOS. Does widgetset (Carbon / Cocoa) make a difference?

I only have access to MacOS Catalina so Carbon will not run on my machine.
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: trev on July 08, 2020, 12:33:47 pm
I can confirm that the issue does not occur with FreebSD 12.1, FPC 3.3.1 snapshot from June 2019 and Lazarus 2.0.6 or 2.1.0 (trunk) using the GTK2 widget set.

[EDIT]
Lazarus v2.1.0 r61574 with GTK2 widget set, FPC v3.0.4, Ubuntu 18.04 is also OK.
[/EDIT]
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: JuhaManninen on July 11, 2020, 09:53:52 am
Yes I believe it is a bug as many people can reproduce it in MacOS. I wonder what makes it OS or Widgetset dependent. I don't have a Mac and cannot test myself.
Please report in bug tracker with all details.
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: trev on July 11, 2020, 10:34:27 am
Verified it did not happen with Lazarus compiled with 32 bit Carbon, but does happen with Lazarus compiled with 64 bit Cocoa (tested on macOS 10.11.6).

Bug lodged: https://bugs.freepascal.org/view.php?id=37330
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: Dan3468298 on July 11, 2020, 02:13:29 pm
Trev, thank you for your good work!
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: JuhaManninen on July 12, 2020, 10:05:56 am
This is fixed now. :)
It was a clear error of memory access caused by wrong typecasts. It was not specific to OS or Widgetset but it caused more trouble in some systems as memory bugs often do.
It is good for code to be tested in many systems. More bugs are revealed.
Title: Re: Cannot Specify Printer4Lazarus in Project Inspector
Post by: trev on July 12, 2020, 10:43:28 am
Thanks Juha!
TinyPortal © 2005-2018