[Lazarus] Cannot find inc file from a registered package...

classic Classic list List threaded Threaded
17 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
I am porting a Delphi application, which uses Indy10, to fpc/lazarus
and I have run into a problem regarding an include directive in one
source file:

interface
{$I IdCompilerDefines.inc}

This is a file within the Indy package, on Delphi it is found in the
Indy sources in the directory where the Indy10 package is installed:

Indy10\System\IdCompilerDefines.inc

And Delphi has no problem finding it.

In Lazarus otoh I get the error message:

class_SSRemoteServer.pas(84,2) Fatal: Cannot open include file
"IdCompilerDefines.inc"

I have added indylaz as a "Required Package" for the project but it
does not solve this problem even though it solved a few other Indy
related errors.

What are you supposed to do in order to make Lazarus find this file?

And if you wonder, I do not know why the include directive is present
in the source (they are more than a decade old)...

It works fine in Delphi 2007, but gives an error in Lazarus 2.0.8 on
Windows.
My final target is Linux but first I want to get it running on
Windows.

Googling brought up this:
https://www.freepascal.org/docs-html/current/user/usersu8.html
where it is stated that:

[quote]
If you include a file in your source with the {$I filename} directive,
the compiler will look for it in the following places:

1. It will look in the path specified in the include file name.
2. It will look in the directory where the current source file is.
3. it will look in all directories specified in the include file
search path.[/quote]

But afaik you do not enter full paths into FPC/Lazarus sources, a
registered package should handle this...

And I don't even know where Lazarus has stored the package sources
during installation of indylaz so I cannot enter that into the project
properties either.


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
On Tue, Jun 23, 2020 at 10:10 PM Bo Berglund via lazarus
<[hidden email]> wrote:
> I have added indylaz as a "Required Package" for the project but it
> does not solve this problem even though it solved a few other Indy
> related errors.

Is the path containing the include file (Indy10\System or similar) in
Indy package's include search path?
If not then please add it.
Otherwise it sounds like a bug. Unit files are found from required
packages but apparently include files are not. Please report a bug
with steps to reproduce.


> What are you supposed to do in order to make Lazarus find this file?

As a dirty workaround you can add the path containing the include file
into your project's include search path.


> And I don't even know where Lazarus has stored the package sources
> during installation of indylaz so I cannot enter that into the project
> properties either.

You will figure it out. Open the Indy's package editor for example.

Regards,
Juha
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
On Tue, 23 Jun 2020 22:40:19 +0300, Juha Manninen via lazarus
<[hidden email]> wrote:

>On Tue, Jun 23, 2020 at 10:10 PM Bo Berglund via lazarus
><[hidden email]> wrote:
>> I have added indylaz as a "Required Package" for the project but it
>> does not solve this problem even though it solved a few other Indy
>> related errors.
>
>Is the path containing the include file (Indy10\System or similar) in
>Indy package's include search path?
>If not then please add it.

How can I see what paths are part of the indylaz package?
I just installed it using OnLine Package Manager so I have no idea
where it is located.

>Otherwise it sounds like a bug. Unit files are found from required
>packages but apparently include files are not. Please report a bug
>with steps to reproduce.
>
>
>> What are you supposed to do in order to make Lazarus find this file?
>
>As a dirty workaround you can add the path containing the include file
>into your project's include search path.

Does not seem like the right way to do it, for one it will not be
portable to another Linux installation (the one I will move to on
Linux for instance)...

>
>> And I don't even know where Lazarus has stored the package sources
>> during installation of indylaz so I cannot enter that into the project
>> properties either.
>
>You will figure it out. Open the Indy's package editor for example.

OK, I do know how to search for and find it but as I said it will not
be portable that way. I believe Lazarus should resolve this from the
package data...

For Lazarus 2.0.8 on my Windows 10 installation:
C:\Programs\Lazarus_2.0.8\config\onlinepackagemanager\packages\Indy10\System

For Lazarus 2.0.8 on my RPi4 installation:
~/.lazarus_2.0.8/onlinepackagemanager/packages/Indy10/System

and (Lazarus using fpc 3.2.0):

~/.lazarus_2.0.8_3.2/onlinepackagemanager/packages/Indy10/System


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
On Tue, 23 Jun 2020 22:40:24 +0200
Bo Berglund via lazarus <[hidden email]> wrote:

> On Tue, 23 Jun 2020 22:40:19 +0300, Juha Manninen via lazarus
> <[hidden email]> wrote:
>
> >On Tue, Jun 23, 2020 at 10:10 PM Bo Berglund via lazarus
> ><[hidden email]> wrote:  
> >> I have added indylaz as a "Required Package" for the project but it
> >> does not solve this problem even though it solved a few other Indy
> >> related errors.  
> >
> >Is the path containing the include file (Indy10\System or similar) in
> >Indy package's include search path?
> >If not then please add it.  
>
> How can I see what paths are part of the indylaz package?
> I just installed it using OnLine Package Manager so I have no idea
> where it is located.

Package / Open Loaded Package
Choose the Indy package.

Then a package editor is opened.

Click "Options" to show the package options

Compiler Options / Path / Include files

Mattias
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
On Tue, 23 Jun 2020 23:55:49 +0200, Mattias Gaertner via lazarus
<[hidden email]> wrote:

>On Tue, 23 Jun 2020 22:40:24 +0200
>Bo Berglund via lazarus <[hidden email]> wrote:
>
>> On Tue, 23 Jun 2020 22:40:19 +0300, Juha Manninen via lazarus
>> <[hidden email]> wrote:
>>
>> >On Tue, Jun 23, 2020 at 10:10 PM Bo Berglund via lazarus
>> ><[hidden email]> wrote:  
>> >> I have added indylaz as a "Required Package" for the project but it
>> >> does not solve this problem even though it solved a few other Indy
>> >> related errors.  
>> >
>> >Is the path containing the include file (Indy10\System or similar) in
>> >Indy package's include search path?
>> >If not then please add it.  
>>
>> How can I see what paths are part of the indylaz package?
>> I just installed it using OnLine Package Manager so I have no idea
>> where it is located.
>
>Package / Open Loaded Package
>Choose the Indy package.
>
>Then a package editor is opened.
>
>Click "Options" to show the package options
>
>Compiler Options / Path / Include files

Will that then have to be modified if I move the project to a Linux
box but with the same fpc/lazarus versions?

It seems like the system should keep track of which package is in use,
maybe by utilizing an environment variable like $INDY10 or $INDYLAZ.
Then one could enter a path in the project options/compiler/paths
using that env var?

Concerning the command in question I really do not understand why it
is there in the first place, so I commented it out and then the
"Run/Quick Compile" continued and stopped at another point further
on...

I checked back as far as I could get and found it still in sources
from 2013. But we have switched from CVS to Subversion in the meantime
and I cannot get any history further back. The file I found from 2013
was at CVS rev 1.78 so there had been a lot of work done on that file.

Would have been intersting to find out when and why it was added...


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
On Wed, 24 Jun 2020 10:11:47 +0200
Bo Berglund via lazarus <[hidden email]> wrote:

>[...]
> >> How can I see what paths are part of the indylaz package?

Open its package editor.
Click Options
Click Show Options

Are you sure indylaz from online package manager is broken?

>[...]
> Will that then have to be modified if I move the project to a Linux
> box but with the same fpc/lazarus versions?

If the package is really broken, that you have to fix it, then you have
to apply the fix on another machine as well. Or copy the fixed package
to the new machine.

 
> It seems like the system should keep track of which package is in use,
> maybe by utilizing an environment variable like $INDY10 or $INDYLAZ.
> Then one could enter a path in the project options/compiler/paths
> using that env var?

I'm not sure what you are trying to achieve.
It is enough to open the indylaz lpk once. The IDE then remembers the
location.
Or execute once at command line:
/path/of/your/lazbuild --add-package-link=/path/to/indylaz.lpk


Mattias
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Wed, 24 Jun 2020 10:11:47 +0200, Bo Berglund via lazarus
<[hidden email]> wrote:

>Concerning the command in question I really do not understand why it
>is there in the first place, so I commented it out and then the
>"Run/Quick Compile" continued and stopped at another point further
>on...
>
>I checked back as far as I could get and found it still in sources
>from 2013. But we have switched from CVS to Subversion in the meantime
>and I cannot get any history further back. The file I found from 2013
>was at CVS rev 1.78 so there had been a lot of work done on that file.
>
>Would have been intersting to find out when and why it was added...
>

****UPDATE****
I found a WinCVS changelog file among the old sources where I can
trace back to earlier times...
Turns out that this include file is there in order to handle the use
of Indy10 when Indy9 was still what Delphi7 used...

2007-03-30 Bosse
        * Classes/class_SSRemoteServer.pas 1.47:
        * Server/FormSSRemoteConfig.pas 1.8:
                Added conditionals for Indy10 support while leaving Indy9
                original in place.

It was included in these two source files and the
FormSSRemoteConfig.pas is excluded from the porting to linux anyway...

I will just remove it and move on.


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Wed, 24 Jun 2020 10:24:04 +0200, Mattias Gaertner via lazarus
<[hidden email]> wrote:

>On Wed, 24 Jun 2020 10:11:47 +0200
>Bo Berglund via lazarus <[hidden email]> wrote:
>
>>[...]
>> >> How can I see what paths are part of the indylaz package?
>
>Open its package editor.
>Click Options
>Click Show Options
>
>Are you sure indylaz from online package manager is broken?

I did not claim that...

>>[...]
>> Will that then have to be modified if I move the project to a Linux
>> box but with the same fpc/lazarus versions?
>
>If the package is really broken, that you have to fix it, then you have
>to apply the fix on another machine as well. Or copy the fixed package
>to the new machine.

I just wanted to know how one could include a package file in a
platform independent way. But it is no longer needed.

>
>> It seems like the system should keep track of which package is in use,
>> maybe by utilizing an environment variable like $INDY10 or $INDYLAZ.
>> Then one could enter a path in the project options/compiler/paths
>> using that env var?
>
>I'm not sure what you are trying to achieve.
>It is enough to open the indylaz lpk once. The IDE then remembers the
>location.
>Or execute once at command line:
>/path/of/your/lazbuild --add-package-link=/path/to/indylaz.lpk
>

No, as I described in a follow-up the include is no longer needed.
But what I was curious about is how one can include files from a
package, I never said that indylaz was broken, but my understanding of
Lazarus is incomplete...

But since it is no longer needed I think we can drop it altogether.

Sorry for the noise.


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Tue, Jun 23, 2020 at 10:40 PM Juha Manninen
<[hidden email]> wrote:
> Is the path containing the include file (Indy10\System or similar) in
> Indy package's include search path?

Bo, why don't you just answer my question?

Juha
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Tue, 23 Jun 2020 22:40:19 +0300, Juha Manninen via lazarus
<[hidden email]> wrote:

>Is the path containing the include file (Indy10\System or similar) in
>Indy package's include search path?
>If not then please add it.
>Otherwise it sounds like a bug. Unit files are found from required
>packages but apparently include files are not. Please report a bug
>with steps to reproduce.
>
To answer your question:

So I re-enabled the include and added a path below packages to it as
follows:

interface
{$I Indy10\System\IdCompilerDefines.inc}
{$I ssremote.inc}


uses
....

class_SSRemoteServer.pas(84,2) Fatal: Cannot open include file
"Indy10\System\IdCompilerDefines.inc"

Same with \ as with / as delimiter.

Butit worked when I did this, , but triggered other errors from inside
the inc file:

{$I
C:\Programs\Lazarus_2.0.8\config\onlinepackagemanager\packages\Indy10\System\IdCompilerDefines.inc}

Now working but the source file is cluttered with an installation path
that should not be there.

So I then went into project options/compiler options/paths
and I added this to the include path setting:

C:\Programs\Lazarus_2.0.8\config\onlinepackagemanager\packages\

Then I changed the source file include statement to:
{$I Indy10\System\IdCompilerDefines.inc}

This too worked, the file was found and parsed.

So this is the best solution, one has to remember to change it when
the project moves to a different lazarus version or platform.

It would have been good to be able to set something like $PACKAGEDIR
to C:\Programs\Lazarus_2.0.8\config\onlinepackagemanager\packages\ in
a Lazarus global context so all package files could be reached using
the env var. It then has to be set Lazarus globally like is possible
in Delphi.
But I found no such way...

HTH


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
Am 24.06.20 um 15:39 schrieb Bo Berglund via lazarus:

> On Tue, 23 Jun 2020 22:40:19 +0300, Juha Manninen via lazarus
> <[hidden email]> wrote:
>
>> Is the path containing the include file (Indy10\System or similar) in
>> Indy package's include search path?
>> If not then please add it.
>> Otherwise it sounds like a bug. Unit files are found from required
>> packages but apparently include files are not. Please report a bug
>> with steps to reproduce.
>>
> To answer your question:
>
> So I re-enabled the include and added a path below packages to it as
> follows:
>
> interface
> {$I Indy10\System\IdCompilerDefines.inc}
> {$I ssremote.inc}
>
>
> uses
> ....
>
> class_SSRemoteServer.pas(84,2) Fatal: Cannot open include file
> "Indy10\System\IdCompilerDefines.inc"
>
> Same with \ as with / as delimiter.
>
> Butit worked when I did this, , but triggered other errors from inside
> the inc file:
>
> {$I
> C:\Programs\Lazarus_2.0.8\config\onlinepackagemanager\packages\Indy10\System\IdCompilerDefines.inc}
>
> Now working but the source file is cluttered with an installation path
> that should not be there.
>
> So I then went into project options/compiler options/paths
> and I added this to the include path setting:
>
> C:\Programs\Lazarus_2.0.8\config\onlinepackagemanager\packages\
>
> Then I changed the source file include statement to:
> {$I Indy10\System\IdCompilerDefines.inc}
>
> This too worked, the file was found and parsed.
>
> So this is the best solution, one has to remember to change it when
> the project moves to a different lazarus version or platform.
>
> It would have been good to be able to set something like $PACKAGEDIR
> to C:\Programs\Lazarus_2.0.8\config\onlinepackagemanager\packages\ in
> a Lazarus global context so all package files could be reached using
> the env var. It then has to be set Lazarus globally like is possible
> in Delphi.
> But I found no such way...
>
> HTH
>
>

Hi Bo,

Never used Indy 10 but just installed it with Online Package Manager on

Lazarus 2.1.0 r63354 FPC 3.0.4 x86_64-linux-gtk2


.. no probs with paths!

regards

John



--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Wed, 24 Jun 2020 11:44:29 +0300, Juha Manninen via lazarus
<[hidden email]> wrote:

>On Tue, Jun 23, 2020 at 10:40 PM Juha Manninen
><[hidden email]> wrote:
>> Is the path containing the include file (Indy10\System or similar) in
>> Indy package's include search path?
>>
>> I did not understand the question.
>> Where do I find the "Indy packages include search path"?
>
>Mattias already explained it. Please read your replies.
> Open its package editor.
> Click Options
> Click Show Options
>
>I installed Indy10 and checked. "Include files (-Fi)" says :
> .;Core;Protocols;System
>So the System directory is there.

Not in my case, OPM did not place it there. The box is empty.

>Then I added to my project source :
>  {$I IdCompilerDefines.inc}
>and indeed it is not found. I added IdCompilerDefines.inc into the
>Indy10 files collection but it still is not found.
>This is a bug. Unit files from -Fu path are found but include files
>from -Fi path are not.

OK, so I did the following:

1) Opened the indylaz package and added an include path looking the
same as the previous two:
.;Core;Protocols;System
Notice. Before I did this the inclute path box was empty.

2) Removed the path to the OPM installation from my project options

3) Uncommented the include statement in my source file

4) Tried a test compile

But it stopped at the exact same place again with the error message:
class_SSRemoteServer.pas(84,2) Fatal: Cannot open include file
"IdCompilerDefines.inc"

So adding a path to the include path box for the package does not work
either.

>Please report in bug tracker so it is not forgotten.

How is that done? I have never evr done such a report. Do I have to
have an account somewhere to do it?


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
> >Please report in bug tracker so it is not forgotten.
>
> How is that done? I have never evr done such a report. Do I have to
> have an account somewhere to do it?

Yes. Please see https://wiki.lazarus.freepascal.org/How_do_I_create_a_bug_report

Pascal
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Thu, Jun 25, 2020 at 9:51 PM Bo Berglund via lazarus
<[hidden email]> wrote:
> On Wed, 24 Jun 2020 11:44:29 +0300, Juha Manninen via lazarus
> <[hidden email]> wrote:
> >I installed Indy10 and checked. "Include files (-Fi)" says :
> > .;Core;Protocols;System
> >So the System directory is there.
>
> Not in my case, OPM did not place it there. The box is empty.

OPM does not alter the packages. It only lets you download and install them.
I wonder what could cause the difference. I got package indylaz 10.6.2 from OPM.

> But it stopped at the exact same place again with the error message:
> class_SSRemoteServer.pas(84,2) Fatal: Cannot open include file
> "IdCompilerDefines.inc"
>
> So adding a path to the include path box for the package does not work
> either.

Yes, that was my experience, too, as I explained.

Juha
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Fri, 26 Jun 2020 08:04:07 +0200 (CEST), Pascal Riekenberg via
lazarus <[hidden email]> wrote:

>> >Please report in bug tracker so it is not forgotten.
>>
>> How is that done? I have never evr done such a report. Do I have to
>> have an account somewhere to do it?
>
>Yes. Please see https://wiki.lazarus.freepascal.org/How_do_I_create_a_bug_report
>
>Pascal

For some reason I am disallowed from creating a new account (email
already used) and the "forgot password" path is blocked because I have
to supply a "user name" along with the email, which I also do not
know/remember.

Apparently I have an active account tied to my email and since I have
forgotten the details (username and password) I cannot reset it
either.
Seems like a catch-22 situation.

So I am presently unable to log in and enter the bug report.


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
> For some reason I am disallowed from creating a new account (email
> already used) and the "forgot password" path is blocked because I have
> to supply a "user name" along with the email, which I also do not
> know/remember.
>
> Apparently I have an active account tied to my email and since I have
> forgotten the details (username and password) I cannot reset it
> either.
> Seems like a catch-22 situation.
>
> So I am presently unable to log in and enter the bug report.

BosseB
--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Cannot find inc file from a registered package...

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Thu, 25 Jun 2020 20:51:22 +0200, Bo Berglund via lazarus
<[hidden email]> wrote:

>>Please report in bug tracker so it is not forgotten.

done, report 0037271


--
Bo Berglund
Developer in Sweden

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus