Recent

Author Topic: install a package depending on another package  (Read 6940 times)

kuvali

  • New member
  • *
  • Posts: 7
install a package depending on another package
« on: April 18, 2013, 05:32:42 pm »
I have a package, which depends on the sources of another package. I can compile the first, if I add the folder with the source files of the second package to the other unit files in the compiler options of the first package. But that's not the correct way, because a second set of the ppu-files of the second components is created then. After rebuilding lazarus I get errors like: unit ... exists twice and unable to find file ...

Instead I have to use the existing ppu-files. But I could not manage this. Please can you tell me, how I have to change the package options of the first package correctly?

Thank you!

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: install a package depending on another package
« Reply #1 on: April 18, 2013, 06:03:52 pm »
You have to make sure that the first package is in the required list of the second package, and to do that you need to add it using the big plus button on the package display form.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

kuvali

  • New member
  • *
  • Posts: 7
Re: install a package depending on another package
« Reply #2 on: April 18, 2013, 06:31:45 pm »
Now I get the message: the package has already a dependency for the second package and indeed I can find the item in the lpk-file. I guess, that I still have to add a path somewhere in the options.

Thank you for the quick answer

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: install a package depending on another package
« Reply #3 on: April 18, 2013, 07:04:06 pm »
Open the second package using the menu "package\open package", in the window that appears scroll down until you find the required packages node, does the first package name appears in there? If not then add it using the big plus button on the same window do not rely on the existanse of the package in the lpk only.

Make sure that you do not have any circular references eg package1 requires package2 and package2 requires package1 those requirements must be in one way ee package2 requires package1 only.
If everything has been set correctly the the path to the compiled units of package one should be accessible by package2.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

kuvali

  • New member
  • *
  • Posts: 7
Re: install a package depending on another package
« Reply #4 on: April 18, 2013, 07:37:35 pm »
>Open the second package
>does the first package name appears in there? If not then add it

Sorry, I guess, my terminology was not clear. The first package depends on the second. So the first is not required by the second and indeed, it is not in the required packages node there.

>Make sure that you do not have any circular references

There aren't circular references. the second package appears in the requirements of the first, but not the other way round.

>the path to the compiled units of package one should be accessible by package2.

In my terminology:
the path to the compiled units of package two should be accessible by package one.

Unfortunately, this is not the case. When I try to compile the package one, source files of package two cannot be found, though package two belongs to the requirements of package one.

Do you have any more ideas?

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: install a package depending on another package
« Reply #5 on: April 18, 2013, 07:48:42 pm »
err I never said that the source files will be accessible I only said that the compiled units should be accessible by the package. Why do you need access to the source files?
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

kuvali

  • New member
  • *
  • Posts: 7
Re: install a package depending on another package
« Reply #6 on: April 18, 2013, 08:05:42 pm »
when I try to compile package one, I get the error message:

unit1.pas Fatal: can not find unit2 used by unit1

unit1.pas(0,0) is a file of package1
unit2 is a unit of package2


kuvali

  • New member
  • *
  • Posts: 7
Re: install a package depending on another package
« Reply #7 on: April 18, 2013, 11:12:17 pm »
to make it more clear: this error can be avoided as described at the beginning of this thread. Instead of using the existing ppu-files, new ppu-files are created.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: install a package depending on another package
« Reply #8 on: April 19, 2013, 12:40:58 am »
that has happen to me only when unit1 is not part of the package1 but is used by a unit in package1 and is located in the same folder as the source of the package1. So make sure that unit1 has been added to package1
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

kuvali

  • New member
  • *
  • Posts: 7
Re: install a package depending on another package
« Reply #9 on: April 19, 2013, 01:49:10 am »
Indeed, unit1 was not part of the package, but it makes no difference: no matter whether I add the file or not, if I don't set the folder with the source files of the second package in the compiler options of the first package, the files are not found. If I set the folder path, I get the error, that units exists twice.

But suddenly I found an unexpected solution: I removed the unit, which was not found from the uses clause of unit1.pas. Now the whole package one compiled. I neither can tell you why the unit was included in the uses clause nor can I explain why it wasn't found - it really exists. But I'm happy that it works now.
Many thanks for your feedback

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: install a package depending on another package
« Reply #10 on: April 19, 2013, 02:56:17 am »
you have to keep in mind that the path a project/package uses to search for files is dynamic each package you add in the required section of a project adds to the search path its own settings, if a file is not included in a package it is impossible to be used correctly since each project has its own target folder of compiled files the files that are not part of any package will have multiple ppus all over your disc.

That's the reason I have all my units in packages and I do not leave out any of them. in the event you do not want to have some units in a package you need to make sure that the source folder is part of default path in your environment.

edit: Last thing to remember is that after you change a package in any way you need to compile it before the changes take effect.
« Last Edit: April 19, 2013, 02:57:50 am by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

kuvali

  • New member
  • *
  • Posts: 7
Re: install a package depending on another package
« Reply #11 on: April 19, 2013, 06:16:26 pm »
I now understand better what's going on with paths and packages.
Thank you again!

 

TinyPortal © 2005-2018