[Lazarus] Built console app on Linux, but won't run on another Linux machine

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

[Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
Using Lazarus 1.8.4 and FPC 3.0.4 64 bit on Ubuntu 18.04 64 bit.
Project built and runs fine on dev system.

Now copied executable to an Ubuntu Server 16.04 64 bit and tried to
run it. But here I get an immediate error:

./LicMgr: error while loading shared libraries: libgdk-x11-2.0.so.0:
cannot open shared object file: No such file or directory

In my code there is no such request so it must be something built into
the executable when compiled on Ubuntu 18.04, but how can I fix this?

The dev machine has a GUI interface (otherwise Lazarus would not work)
but the program itself is purely non-gui, it is just a Pascal program
and it does not even send output to the console, just handles files
and networking. Still the name libgdk-x11-2.0 suggests that it has
something to do with X...

Any ideas how I can remove dependencies of whatever libgdk-x11-2.0
means?

The Ubuntu Server 16.04 is meant to be the home of this utility...


--
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] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
On Sat, 27 Oct 2018 12:25:04 +0200
Bo Berglund via Lazarus <[hidden email]> wrote:

> Using Lazarus 1.8.4 and FPC 3.0.4 64 bit on Ubuntu 18.04 64 bit.
> Project built and runs fine on dev system.
>
> Now copied executable to an Ubuntu Server 16.04 64 bit and tried to
> run it. But here I get an immediate error:
>
> ./LicMgr: error while loading shared libraries: libgdk-x11-2.0.so.0:
> cannot open shared object file: No such file or directory
>
> In my code there is no such request so it must be something built into
> the executable when compiled on Ubuntu 18.04, but how can I fix this?

Either install libgtk2.0-0 or remove the dependency.

 
> The dev machine has a GUI interface (otherwise Lazarus would not work)
> but the program itself is purely non-gui, it is just a Pascal program
> and it does not even send output to the console, just handles files
> and networking. Still the name libgdk-x11-2.0 suggests that it has
> something to do with X...

Maybe your project uses the LCL either directly or indirectly. See
Project Inspector.
If yes, remove it or set it to lclwidgettype "nogui".


> Any ideas how I can remove dependencies of whatever libgdk-x11-2.0
> means?
>
> The Ubuntu Server 16.04 is meant to be the home of this utility...


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

Re: [Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
On Sat, 27 Oct 2018 12:43:02 +0200, Mattias Gaertner via Lazarus
<[hidden email]> wrote:

>Either install libgtk2.0-0 or remove the dependency.
I don't know how to "remove dependency"
When I work in Ubuntu 18.04 I am using the Xfce desktop, but the
programI am building has no GUI components whatsoever, so why should
there be any dependency towards X11?

>
>> The dev machine has a GUI interface (otherwise Lazarus would not work)
>> but the program itself is purely non-gui, it is just a Pascal program
>> and it does not even send output to the console, just handles files
>> and networking. Still the name libgdk-x11-2.0 suggests that it has
>> something to do with X...
>
>Maybe your project uses the LCL either directly or indirectly. See
>Project Inspector.
>If yes, remove it or set it to lclwidgettype "nogui".
>
I had LCL there as Required package, but I removed it.
When I build the project the resulting binary is exactly the same
size, so there could not be anythingadded or deleted to the program...

The only external I can think of is needed is OpenSSH since my Indy10
external mail connection uses encrypted communication. But tah would
not be related to X11, right?
And I have not used any directive for it (other than what mau be
hidden inside Indy10).


--
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] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
Am 27.10.2018 um 13:03 schrieb Bo Berglund via Lazarus:

>
>>> The dev machine has a GUI interface (otherwise Lazarus would not work)
>>> but the program itself is purely non-gui, it is just a Pascal program
>>> and it does not even send output to the console, just handles files
>>> and networking. Still the name libgdk-x11-2.0 suggests that it has
>>> something to do with X...
>> Maybe your project uses the LCL either directly or indirectly. See
>> Project Inspector.
>> If yes, remove it or set it to lclwidgettype "nogui".
>>
> I had LCL there as Required package, but I removed it.
> When I build the project the resulting binary is exactly the same
> size, so there could not be anythingadded or deleted to the program...
>
> The only external I can think of is needed is OpenSSH since my Indy10
> external mail connection uses encrypted communication. But tah would
> not be related to X11, right?
> And I have not used any directive for it (other than what mau be
> hidden inside Indy10).
Binaries usually have aligned sections so removing or adding just a
small bit (like the dependency on gdk in your case introduced by the
LCL) does not necessarily mean a change in size.

You could also try "objdump -x /path/to/your/binary" and look at was is
listed as NEEDED in the Dynamic Section. You'd then need to find out
what dependencies you don't want to have and then figure out which units
led to their inclusion. Maybe it's just a stray unit that pulls in some
GUI dependencies.

Regards,
Sven

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

Re: [Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Sat, Oct 27, 2018 at 2:03 PM Bo Berglund via Lazarus
<[hidden email]> wrote:
> I had LCL there as Required package, but I removed it.

So you know how to remove a dependency!
How did the LCL dependency come there if you created a console program?

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

Re: [Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Sat, 27 Oct 2018 13:39:12 +0200, Sven Barth via Lazarus
<[hidden email]> wrote:

>Binaries usually have aligned sections so removing or adding just a
>small bit (like the dependency on gdk in your case introduced by the
>LCL) does not necessarily mean a change in size.
>
>You could also try "objdump -x /path/to/your/binary" and look at was is
>listed as NEEDED in the Dynamic Section. You'd then need to find out
>what dependencies you don't want to have and then figure out which units
>led to their inclusion. Maybe it's just a stray unit that pulls in some
>GUI dependencies.
>

I tried to upgrade, dist-upgrade the server to remove the logon
greeting about available updates then rebooted.
No difference.

Then I tried by installing xfce4 desktop, thinking that this would
deposit the X11 stuff into the system. But it did not solve the
problem even though the start error message now changed to:

(LicMgr:19268): Gtk-WARNING **: cannot open display:

So clearly there was a problem somewhere here concerning X11 and it is
gone, but replaced with this display stuff...

I *really* need to get this program running without any GUI references
since it is supposed to be run by cron every 10 minutes to process
website generated request emails...
And the server itself is never accessed except via the command line
over the network. I am currently some 8400 km away from the physical
location of the server....


--
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] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
On 27/10/2018 13.58, Bo Berglund via Lazarus wrote:

> I tried to upgrade, dist-upgrade the server to remove the logon
> greeting about available updates then rebooted.
> No difference.
>
> Then I tried by installing xfce4 desktop, thinking that this would
> deposit the X11 stuff into the system. But it did not solve the
> problem even though the start error message now changed to:

IMHO, that's the wrong approach.

You have to remove the dependency, somehow, not fulfill it.

--
Cheers / Saludos,

                Carlos E. R.
                (from 42.3 x86_64 "Malachite" at Telcontar)


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

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Sat, 27 Oct 2018 14:57:39 +0300, Juha Manninen via Lazarus
<[hidden email]> wrote:

>On Sat, Oct 27, 2018 at 2:03 PM Bo Berglund via Lazarus
><[hidden email]> wrote:
>> I had LCL there as Required package, but I removed it.
>
>So you know how to remove a dependency!
>How did the LCL dependency come there if you created a console program?

I ported an existing Delphi console program to Lazarus using its
conversion function. It was a test to get around a problem running the
original program on a new Windows 2016 Server machine...

After conversion it complained about directive {$APPTYPE CONSOLE}
being unrecognized so I had to IFNDEF FPC that line so it is only
visible in Delphi (which I rarely use these days)...
I assume that the converter brought in LCL, but I have removed it
today, did not make a difference.

Is there a way to tell Lazarus a program is meant to be a console
(command line) type program without GUI connections?
Or should I start over and create a new console program in Lazarus and
then bring in the units I have used for certain functions and also
change the main dpr file into a normal unit?


--
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] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Sat, 27 Oct 2018 14:03:16 +0200, "Carlos E. R. via Lazarus"
<[hidden email]> wrote:

>On 27/10/2018 13.58, Bo Berglund via Lazarus wrote:
>
>> I tried to upgrade, dist-upgrade the server to remove the logon
>> greeting about available updates then rebooted.
>> No difference.
>>
>> Then I tried by installing xfce4 desktop, thinking that this would
>> deposit the X11 stuff into the system. But it did not solve the
>> problem even though the start error message now changed to:
>
>IMHO, that's the wrong approach.
>
>You have to remove the dependency, somehow, not fulfill it.

That is the problem, I don't know how to remove a dependency like
this...


--
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] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
I have an idea. Make an error in some gtk2 widget set unit. Build. Then you ll see which part of the app requires gtk2 code.
Alexey
--
_______________________________________________
Lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Sat, 27 Oct 2018 14:31:31 +0200, Bo Berglund via Lazarus
<[hidden email]> wrote:

>Or should I start over and create a new console program in Lazarus and
>then bring in the units I have used for certain functions and also
>change the main dpr file into a normal unit?

I did this and created a new "Program", which was labeled in Lazarus
as a Free Pascal command line program.

Then I added my units from the other project and converted the dpr
file into a pas unit by moving away the final begin-code-end proram
section to the newly created program's source file.
Had to fix sections etc in the old dpr file so it now is a proper
unit.
But once done it built OK and worked as expected in Ubuntu 18.04.
The stripped size of this program as about 10 Mb whereas the earlier
version was only some 7 Mb...

But when I copied it over into the Ubuntu 16.04 server it again
displayed the GTK error...

(LicMgr:19450): Gtk-WARNING **: cannot open display:

It should not need a display!


--
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] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
On Sat, 27 Oct 2018 15:35:05 +0200
Bo Berglund via Lazarus <[hidden email]> wrote:

>[...]
> (LicMgr:19450): Gtk-WARNING **: cannot open display:
>
> It should not need a display!

Then remove the gtk dependency.
Check  Compiler options / Show Options / Inherited Parameters if you
are using the LCL.

If yes then use the Project Inspector, double click on the required
packages to see their dependencies. Or use Package / Package graph to
see the dependencies.

If no, then some unit uses the gtk2 directly. Use "View / Unit
Dependencies" to find out which one.

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

Re: [Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Sat, Oct 27, 2018 at 4:35 PM Bo Berglund via Lazarus
<[hidden email]> wrote:
> Had to fix sections etc in the old dpr file so it now is a proper unit.

You have a .lpr file in the Lazarus project, right? Not .dpr?

> But once done it built OK and worked as expected in Ubuntu 18.04.
> The stripped size of this program as about 10 Mb whereas the earlier
> version was only some 7 Mb...

With LCL it was 7 Mb and without LCL 10 Mb. Strange.

> (LicMgr:19450): Gtk-WARNING **: cannot open display:

There is no unit called LicMgr in FPC or Lazarus sources. Is it part
of your project?

BTW, the Delphi converter is buggy if it adds LCL dependency for a
console program. It should not.
If you send me a test program then I can have a look.

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

Re: [Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Saturday 27 October 2018 14:32:38 Bo Berglund via Lazarus wrote:
>
> That is the problem, I don't know how to remove a dependency like
> this...
>
Another option:
- Compile the project with -vu, copy the message to a file.
- Analise the file with the MSEunitdep tool from here:
https://gitlab.com/mseide-msegui/mseide-msegui/tree/master/tools/unitdep
- Setup 'Start Unit' and 'Dest- Unit' in order to check the dependency path,
see the screenshot:
https://mseide-msegui.sourceforge.io/pics/mseunitdep.png

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

Re: [Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Bo Berglund via Lazarus <[hidden email]> schrieb am Sa., 27. Okt. 2018, 14:31:
After conversion it complained about directive {$APPTYPE CONSOLE}
being unrecognized so I had to IFNDEF FPC that line so it is only
visible in Delphi (which I rarely use these days)...

It's only a warning, not an error. The $AppType directive is only handled on targets that have a distinction
for binary types (e.g. Windows which has GUI and Console or Classic Mac OS which has Tool). Unix-like systems like Linux do not differ between console and GUI programs in that way and thus the directive is ignored(!) there. 

Regards, 
Sven 

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

Re: [Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
Bo Berglund via Lazarus <[hidden email]> schrieb am Sa., 27. Okt. 2018, 13:58:
On Sat, 27 Oct 2018 13:39:12 +0200, Sven Barth via Lazarus
<[hidden email]> wrote:

>Binaries usually have aligned sections so removing or adding just a
>small bit (like the dependency on gdk in your case introduced by the
>LCL) does not necessarily mean a change in size.
>
>You could also try "objdump -x /path/to/your/binary" and look at was is
>listed as NEEDED in the Dynamic Section. You'd then need to find out
>what dependencies you don't want to have and then figure out which units
>led to their inclusion. Maybe it's just a stray unit that pulls in some
>GUI dependencies.
>

I tried to upgrade, dist-upgrade the server to remove the logon
greeting about available updates then rebooted.
No difference.

Then I tried by installing xfce4 desktop, thinking that this would
deposit the X11 stuff into the system. But it did not solve the
problem even though the start error message now changed to:

(LicMgr:19268): Gtk-WARNING **: cannot open display:

So clearly there was a problem somewhere here concerning X11 and it is
gone, but replaced with this display stuff...

I *really* need to get this program running without any GUI references
since it is supposed to be run by cron every 10 minutes to process
website generated request emails...
And the server itself is never accessed except via the command line
over the network. I am currently some 8400 km away from the physical
location of the server....

As others already wrote you should not try to fulfill twee dependency on t he server, but to remove it from your binary. For this you need to find out what unit pulls in that dependency and get rid of that. You can maybe use the Unit Dependencies window for that (see http://wiki.freepascal.org/IDE_Window:_Unit_dependencies ). 

Alternatively you could try to switch the LCLWidgetType to NoGUI as had already been suggested by Mattias as well and try whether that is sufficient. 

Regards, 
Sven 

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

Re: [Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Sat, 27 Oct 2018 18:00:56 +0300, Juha Manninen via Lazarus
<[hidden email]> wrote:

>On Sat, Oct 27, 2018 at 4:35 PM Bo Berglund via Lazarus
><[hidden email]> wrote:
>> Had to fix sections etc in the old dpr file so it now is a proper unit.
>
>You have a .lpr file in the Lazarus project, right? Not .dpr?

In the converted Delphi project I started with a .dpr file that
contained all active code except for two units to read Ini files mor
easily and to create Unix style hashed passwords.
When it was done it still used the dpr file as the main program
source.

>> But once done it built OK and worked as expected in Ubuntu 18.04.
>> The stripped size of this program as about 10 Mb whereas the earlier
>> version was only some 7 Mb...
>
>With LCL it was 7 Mb and without LCL 10 Mb. Strange.
>
>> (LicMgr:19450): Gtk-WARNING **: cannot open display:
>
>There is no unit called LicMgr in FPC or Lazarus sources. Is it part
>of your project?

My program is called LicMgr because it ie meant to create and send
demo licenses to people asking on our website.
For this it needs to:
- Read incoming email (Indy 10)
- Parse the messages for validity
- If valid:
  - Create a new login entry on the server, so it needs to:
  - Read the password file from the server using FTP (Indy10)
  - Add the new entry to the end
  - Make sure there is not already a duplicate
  - Upload the modified password file (Indy10)
  - Compose an email to the customer with a link and login
  - Send the email (Indy10)
  - Log all activity including saving who is getting logins
 
>
>BTW, the Delphi converter is buggy if it adds LCL dependency for a
>console program. It should not.

Well, I created a new project from scratch and added in my units,
still the same problem.

>If you send me a test program then I can have a look.

I will try to make one from scratch and see what happens.
If still the same then I might take you up on that...


--
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] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
In reply to this post by Free Pascal - Lazarus mailing list
On Sat, 27 Oct 2018 16:06:07 +0200, Mattias Gaertner via Lazarus
<[hidden email]> wrote:

>On Sat, 27 Oct 2018 15:35:05 +0200
>Bo Berglund via Lazarus <[hidden email]> wrote:
>
>>[...]
>> (LicMgr:19450): Gtk-WARNING **: cannot open display:
>>
>> It should not need a display!
>
>Then remove the gtk dependency.
>Check  Compiler options / Show Options / Inherited Parameters if you
>are using the LCL.

Well, I took LCL out of the project and it still has these problems.
Right now the Project Inspector only shows a single Required Package
and this is "indylaz"

>
>If yes then use the Project Inspector, double click on the required
>packages to see their dependencies. Or use Package / Package graph to
>see the dependencies.

This amazingly shows:
  LCL
  IDEIntf
  FCL (>=1.0)
But I think these are for the Lazarus IDE integration of the visual
components and I am not using any forms or such so there is no use for
this.
Now I am at a loss as to how I can use Indy without bringing in
IndyLaz, just the required files. On Windows it is simple, I just set
the search path in Delpi to the location of the three Indy10 source
directories and I am done. Not so simple in Lazarus until I saw I
could install indylaz. Has worked fine for GUI applications so far....

>
>If no, then some unit uses the gtk2 directly. Use "View / Unit
>Dependencies" to find out which one.

Don't know how...

--
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] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
On Sat, Oct 27, 2018 at 7:11 PM Bo Berglund via Lazarus
<[hidden email]> wrote:
> In the converted Delphi project I started with a .dpr file that
> contained all active code except for two units to read Ini files mor
> easily and to create Unix style hashed passwords. When it
> was done it still used the dpr file as the main program source.

I don't understand you. The converter creates a .lpr file for sure.


On Sat, Oct 27, 2018 at 7:20 PM Bo Berglund via Lazarus
<[hidden email]> wrote:

> >If yes then use the Project Inspector, double click on the required
> >packages to see their dependencies. Or use Package / Package graph to
> >see the dependencies.
>
> This amazingly shows:
>   LCL
>   IDEIntf
>   FCL (>=1.0)
> But I think these are for the Lazarus IDE integration of the visual components
> and I am not using any forms or such so there is no use for this.

Indeed!
It is not only for the IDE integration. There are units with GUI that need LCL.


> Now I am at a loss as to how I can use Indy without bringing in
> IndyLaz, just the required files. On Windows it is simple, I just set
> the search path in Delpi to the location of the three Indy10 source
> directories and I am done.

You mean in Delphi it is simple.(?)
But no, actually the global search path in Delphi can be considered a
bug but they cannot remove it for backward compatibility.
It pollutes the namespace also for projects that do not need a
specific library/package.

> Not so simple in Lazarus until I saw I could install indylaz.
> Has worked fine for GUI applications so far....

Yes, Indy apparently suits best for GUI apps.
You can of course set the search path of your Lazarus project to point
to Indy source directories.
That is not recommended normally but this is a special case.
If Indy Lazarus port was well designed, it would separate the GUI and
non-GUI parts to their own packages.

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

Re: [Lazarus] Built console app on Linux, but won't run on another Linux machine

Free Pascal - Lazarus mailing list
On Sat, 27 Oct 2018 20:06:54 +0300, Juha Manninen via Lazarus
<[hidden email]> wrote:

>On Sat, Oct 27, 2018 at 7:11 PM Bo Berglund via Lazarus
><[hidden email]> wrote:
>> In the converted Delphi project I started with a .dpr file that
>> contained all active code except for two units to read Ini files mor
>> easily and to create Unix style hashed passwords. When it
>> was done it still used the dpr file as the main program source.
>
>I don't understand you. The converter creates a .lpr file for sure.
>
>
>On Sat, Oct 27, 2018 at 7:20 PM Bo Berglund via Lazarus
><[hidden email]> wrote:
>> >If yes then use the Project Inspector, double click on the required
>> >packages to see their dependencies. Or use Package / Package graph to
>> >see the dependencies.
>>
>> This amazingly shows:
>>   LCL
>>   IDEIntf
>>   FCL (>=1.0)
>> But I think these are for the Lazarus IDE integration of the visual components
>> and I am not using any forms or such so there is no use for this.
>
>Indeed!
>It is not only for the IDE integration. There are units with GUI that need LCL.
>
>
>> Now I am at a loss as to how I can use Indy without bringing in
>> IndyLaz, just the required files. On Windows it is simple, I just set
>> the search path in Delpi to the location of the three Indy10 source
>> directories and I am done.
>
>You mean in Delphi it is simple.(?)
>But no, actually the global search path in Delphi can be considered a
>bug but they cannot remove it for backward compatibility.
>It pollutes the namespace also for projects that do not need a
>specific library/package.

I am talking about Delphi's project options where search path can be
entered, which are just valid for the project itself.
One can use environment variables here too to simplify the entries in
the list.

>> Not so simple in Lazarus until I saw I could install indylaz.
>> Has worked fine for GUI applications so far....
>
>Yes, Indy apparently suits best for GUI apps.
>You can of course set the search path of your Lazarus project to point
>to Indy source directories.
>That is not recommended normally but this is a special case.
>If Indy Lazarus port was well designed, it would separate the GUI and
>non-GUI parts to their own packages.
>

I found the location of the indylaz package files in:
~/.lazarus1.8.4/onlinepackagemanager/packages/Indy10/
Here are the 3 dirs I need, Core, Protocols and System.

So I adding these into the Compiler/Path/OtherUnitFiles setting in
Project Options lusing the selector button
../../../.lazarus1.8.4/onlinepackagemanager/packages/Indy10/Core
../../../.lazarus1.8.4/onlinepackagemanager/packages/Indy10/System
../../../.lazarus1.8.4/onlinepackagemanager/packages/Indy10/Protocols

And I also removed the indylaz package from the project dependencies.

But when I tried to build the project it complained that it could not
find Interfaces, so I remembered that this is supplied by LCL, so I
tried adding LCL back to the project required packages.
Then the project built OK.

But when I moved the (now skinnier executable) to the Ubuntu 18.04
machine I got the same warning once more:

(LicMgr:3198): Gtk-WARNING **: cannot open display:

So this did not cut it either...

Now I also found that I can test this easier, I just have to log out
of my development machine and stay at the login screen.
Then using PuTTY to connect to it and navigate to the project and
start the program from the command line throws the exact same error
message and the program won't run.

So it seems like someone (or maybe even me) must be logged on to the
machine console in order for it to execute this command line
program...
Being logged on to a TightVNC session does not count...


Soooo strange!

--
Bo Berglund
Developer in Sweden

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