Recent

Author Topic: Installing LMath into the IDE  (Read 5307 times)

Bert_Plitt

  • Jr. Member
  • **
  • Posts: 62
Installing LMath into the IDE
« on: August 25, 2021, 05:27:25 pm »
Hello all.  I'm a novice with Lazarus and need help installing a package group into the IDE.  I'm running Lazarus ver 2.2.0RC1 and FPC ver 3.2.2 on Windows 10, 64 bit.  My PC crashed the other day and I had to reinstall windows and my apps.  Before the crash, I had created a math project that used the LMath package.  After the crash, I had to reinstall Lazarus (latest version) and I want to reinstall LMath so I can edit and rebuild my project. 

LMath does not appear in the Online Package Manage list, so I down loaded the latest version from Source Forge.  I saved it in a subfolder (called "AddIns") of my Lazarus directory.  I successfully compiled the group package using the group file "lmath_projectgroup.lpg".  At this point I rebuilt Lazarus.  When Lazarus reopened, I tried to open my math project, but I got an error saying two packages (which are in the group I just compiled) failed to load.   Evidently, Lazarus cannot find the files.

Please, can someone provide me a detail step-by-step procedure to download a project group package and install it into Lazarus.  BTW, I successfully reinstalled the packages that were listed in the Online Package Manager.

Thanks.
« Last Edit: August 25, 2021, 05:43:59 pm by Bert_Plitt »
Windows 10, Lazarus 2.2.2, FPC 3.2.2

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: Installing LMath into the IDE
« Reply #1 on: August 25, 2021, 07:14:28 pm »
LMath by itself contains only run-time packages which need not be installed and do not show up in the component palette. You only have to load the packages ("Package" > "Open package file (*.lpk)") so that the IDE knows where the packages are.

Since LMath consists of a variety of packages it is quite cumbersome to open all of them one by one. Therefore I proposed the author of LMath to bind all packages to a project group (https://sourceforge.net/p/lmath-library/tickets/2/). The project group can be opened from the "Project" menu: "Open Project Group". The tree view shows all files contained in the group, here: all packages of LMath. At this point you can already close the Packagegroup editor again, because the IDE now already knows the location of the packages. But to make sure you could select the top-level node and click "Compile" so that all packages are compiled for a test.

Unfortunately the LMath project group of the svn trunk repository is defective and contains no files. You should replace it by the one in the attachment of this post.

Bert_Plitt

  • Jr. Member
  • **
  • Posts: 62
Re: Installing LMath into the IDE
« Reply #2 on: August 25, 2021, 08:46:47 pm »
WP, thanks for the reply, but I still can't get my math project to open in the IDE.  I downloaded from Source Forge the file "lmath_06_components_05.zip" and unzipped it to a folder on the C:\ drive.  I downloaded the file you had in your previous post and replace the defective .lpg file.  I opened the lmath_projectgroup.lpg from the IDE and did a "Compile clean". 

After compiling the lmath group, I tried to open my math project again.  I got the error message "The following packages failed to load" and a list of packages, which are in the lmath group.  What am I doing wrong?  Why can't Lazarus find the packages?
Windows 10, Lazarus 2.2.2, FPC 3.2.2

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: Installing LMath into the IDE
« Reply #3 on: August 25, 2021, 10:46:26 pm »
Ah, I tried Laz 2.0.12, and when I load the project group everything is empty... This reminds that project groups for packages were not available in the v2.0.x series. You must upgrade to v2.2RC1, sorry.

But you can work with LMath even without the package group. Go to "Package" > "Open package file (*.lpk)", navigate to the LMath folder of the unzipped download and all of its subfolders and open the package file (extension .lpk) in each subfolder. You can close the package immediately afterwards and then repeat with the next package, etc. Load also the LMath.lpk package because it is a good time saver later. When you are done with all the packages you can try to load a demo project: go to "File" > "Open" > "gui" > "curfit" and load the curfit.lpi project, it should load without any issues; you should be able to compile and run it without errors (you can try others projects too, but this is the one that I tested, and I know it is working).

There is some chance that your own project will not yet load without errors. This is because, coming from Delphi, you may not be familiar with the Lazarus package concept. In Delphi, all components add themselves to a huge library path. In Lazarus, you must add the needed package to the requirements of your project, do not change the unit path unless you really know what you are doing. Open the project inspector (it's a good idea to drag it to the side of the monitor and have it open all the time), click "Add" > "New Requirement", in the dialog select the package LMath in the list and press OK - this package contains all other LMath packages and gives you acces to all LMath units. (If you know in which package a unit is contained you can also add the package with this unit instead).

Bert_Plitt

  • Jr. Member
  • **
  • Posts: 62
Re: Installing LMath into the IDE
« Reply #4 on: August 25, 2021, 11:47:41 pm »
WP - Several things:
1.  I am running ver 2.2.0RC1, so I think the group thing should work.
2.  I forgot how to enter the footnote at the bottom of a post.  Please remind me how to do that so I can fix the ver number.
3.  I tried running the demo you suggested.  When I started it I got an error message saying Lazarus has no .cfg file.  I suspect that's why my project won't load.  How do I make a .cfg file?  Or would it be easier to uninstall Lazarus completely and do fresh reinstall?
Windows 10, Lazarus 2.2.2, FPC 3.2.2

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: Installing LMath into the IDE
« Reply #5 on: August 26, 2021, 12:15:40 am »
Or would it be easier to uninstall Lazarus completely and do fresh reinstall?
Yes.

Bert_Plitt

  • Jr. Member
  • **
  • Posts: 62
Re: Installing LMath into the IDE
« Reply #6 on: August 26, 2021, 04:35:52 am »
Ok, I uninstalled then reinstalled Lazarus 2.2.0RC1, fpc 3.2.2’, and compiled clean the lmath project group.  I then tried to open the demo project and got a message saying it couldn’t find the fpc.cfg file.  I did a file search,which DID find the.cfg file.  Any idea what’s wrong?
Windows 10, Lazarus 2.2.2, FPC 3.2.2

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: Installing LMath into the IDE
« Reply #7 on: August 26, 2021, 11:15:07 am »
Something is very wrong here...
When you open Lazarus it creates an empty project. Can you compile and run this default project?

[...] reinstalled Lazarus 2.2.0RC1, fpc 3.2.2 [...]
This sounds as if you installed Lazarus and fpc separately. But fpc is contained in the Lazarus installation. So, you only must install Lazarus and you will get fpc automatically. At least when you use the official installer.

So the question is: how did you install Lazarus?

Bert_Plitt

  • Jr. Member
  • **
  • Posts: 62
Re: Installing LMath into the IDE
« Reply #8 on: August 27, 2021, 04:24:45 pm »
WP - I agree, something is very wrong. 

Something is very wrong here...
When you open Lazarus it creates an empty project. Can you compile and run this default project?

[...] reinstalled Lazarus 2.2.0RC1, fpc 3.2.2 [...]

This sounds as if you installed Lazarus and fpc separately. But fpc is contained in the Lazarus installation. So, you only must install Lazarus and you will get fpc automatically. At least when you use the official installer.

So the question is: how did you install Lazarus?


Yes, after a clean installation of Lazarus 2.2.0RC1 the default project compiled and ran perfectly, no errors.  Also, as far as I know, I did NOT install Lazarus and fpc separately.  I think I used the official installer (lazarus-2.2.0RC1-fpc-3.2.2-win64.exe), so fpc should have been installed automatically.  Here is the chain of events:

1.   Clean install of "lazarus-2.2.0RC1-fpc-3.2.2-win64.exe"

2.   Manually compiled all packages of LMath_06 and LComponents_05.  I did NOT use the Project Group method.

3.   I successfully compiled and ran the Address Book example that came with the Lazarus installation.  Rans perfectly, no errors.

4.   I successfully compiled and ran several of my old projects.  They all ran perfectly, no errors.

5.   I tried to open "LMath\demo\gui\curfit.lpi".  Got this error message: "The current FPC has no config file.  It will probably miss some units.  Check your installation of fpc".  Then, when I clicked OK in the error box, I got this error message: "The project uses target OS=win32 and cpu=x86_64.  The system.ppu for this target was not found in the FPC binary directories.  Make sure fpc is installed correctly for this target and the fpc.cfg contains the right directories"

6.   But there IS a fpc.cfg file on the PC.  It is located here "F:\Lazarus\fpc\3.2.2\bin\x86_64-win64\fpc.cfg"

It seems to me that there is a major problem installing LMath into "lazarus-2.2.0RC1-fpc-3.2.2-win64.exe".  Can you figure out what's going on?  It seems to me that LMath is not compatible with Lazarus 2.2.0RC1-fpc-3.2.2-win 64  Is there a fix for this?
Windows 10, Lazarus 2.2.2, FPC 3.2.2

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: Installing LMath into the IDE
« Reply #9 on: August 27, 2021, 10:09:56 pm »
Since I normally work with the 32-bit IDE, I did not see this. Now I tried LMath with the 64-bit IDE, and, indeed, I can confirm the issue. I checked some of the other demo projects, and they all open and compile correctly. The problem with the curfit demo, however, is that the author hard-coded the project to compile for an 32-bit application, but you have the 64-bit compiler...

Open the project options > "Compiler options" > "Target Platform": the project lists the entry "win32" in the "Target OS" combobox. Change it to "win64" or - better - "(Default)" since then you will be able to compile it also under Linux or macOS without changes.
« Last Edit: August 27, 2021, 10:12:01 pm by wp »

Bert_Plitt

  • Jr. Member
  • **
  • Posts: 62
Re: Installing LMath into the IDE
« Reply #10 on: August 28, 2021, 02:29:15 am »
OK, changing the TargetOS to "(Default)" fixed the problem for running the demo "curfit".  But when I tried to compile and run my original math project, it failed with an error message saying it can't find two of the packages that were installed with LMath.  I assume I have a setup wrong in my app.  How does the compiler know where to look for packages?  I thought installing a package set that up automatically>
Windows 10, Lazarus 2.2.2, FPC 3.2.2

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: Installing LMath into the IDE
« Reply #11 on: August 28, 2021, 12:06:04 pm »
We're making progress...

Packages must also be added to the project. I told you in the last paragraph of my reply #3 how you can do this.


Bert_Plitt

  • Jr. Member
  • **
  • Posts: 62
Re: Installing LMath into the IDE
« Reply #12 on: August 28, 2021, 07:09:08 pm »
WP - Progress is slow... maybe because I'm so dumb!  Sorry to be such a pest, but I still can't get LMath to work on my version of Lazarus and fpc installed on my PC..  Here the status:

I'm running "lazarus-2.2.0RC1-fpc-3.2.2-win64.exe".  I individually installed all the "sub-packages" of LMath and the LMath  package into "onlinepackagemanager" on the C:\ drive (Lazarus is installed on the E:\ drive), I did not install using the project manager. 

I opened Lazarus and started a New Application Project.  The only thing I did to the default configuration of the new project was add "LMath" to the unit1 uses list.  When I tried to run this new project, it halted with this message:

 "Compile Project, Target: C:\Users\Bert\AppData\Local\Temp\project1.exe: Exit code 1, Errors: 1
unit1.pas(8,58) Fatal: Can't find unit LMath used by Unit1"

What am I missing?  Is there some setting that has to change?  Why doesn't the default configuration work?
Windows 10, Lazarus 2.2.2, FPC 3.2.2

Jurassic Pork

  • Hero Member
  • *****
  • Posts: 1228
Re: Installing LMath into the IDE
« Reply #13 on: August 28, 2021, 07:23:10 pm »
hello,
have you tried the projects in the demo folder of lmath?

Friendly, J.P
Jurassic computer : Sinclair ZX81 - Zilog Z80A à 3,25 MHz - RAM 1 Ko - ROM 8 Ko

Bert_Plitt

  • Jr. Member
  • **
  • Posts: 62
Re: Installing LMath into the IDE
« Reply #14 on: August 28, 2021, 07:45:26 pm »
Jurasic Pork -- Yes, I have successfully compiled and run most of the projects in the demo folder.  That's what's confusing me.  LMath and its "sub-packages" seem to be visible to the demo projects but not to a new default application project and I can't figure out why.
Windows 10, Lazarus 2.2.2, FPC 3.2.2

 

TinyPortal © 2005-2018