[Lazarus] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

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

[Lazarus] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list
I have been using fpc/Lazarus on Windows and Raspbian Buster for years
and it has worked just fine.

Now I have installed fpc 3.0.4 / lazarus 2.0.8 in Ubuntu 18.04.4 LTS
on a repurposed HP notebook (8440w).
It seemed to work OK until I retrieved code via SVN that has worked on
Windows and Raspbian in order to build for Linux on Intel hardware.

When I load the project all is OK, but when I try to compile I get to
an error:

Error: resource compiler "fpcres" not found, switching to external
mode

But fpres is built during installation of fpc/lazarus and the binary
is placed in ~/bin, which usually is available on path.

So it seems like on this Ubuntu machine the existing ~/bin dir does
not result in it being placed on PATH and therefore Lazarus is unable
to use it.

What can be done to fix this?

Notice:
-------
I access the Ubuntu Mate desktop via VNC from my Windows 10 main
computer because the notebook is not used actively (it sits in a
cupboard).
THis way of operation has worked just fine with Lazarus on Raspbian
(Raspberry Pi) for years, why not on Ubuntu 18?

And the /home/bosse/.profile file contains this:

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

So it should automatically add ~/bin to PATH, right?
But it is not happening, PATH does not have /home/bosse/bin at the
beginning....

Any help appreciated!


--
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] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list
On Sun, 24 May 2020 22:21:31 +0200
Bo Berglund via lazarus <[hidden email]> wrote:

>[...]
> But fpres is built during installation of fpc/lazarus and the binary
> is placed in ~/bin, which usually is available on path.

> And the /home/bosse/.profile file contains this:

Not every shell uses /home/bosse/.profile.

How do you start lazarus? Maybe this starter uses its own environment.
 
>[...]

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

Re: [Lazarus] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list
On Sun, 24 May 2020 22:30:04 +0200, Mattias Gaertner via lazarus
<[hidden email]> wrote:

>On Sun, 24 May 2020 22:21:31 +0200
>Bo Berglund via lazarus <[hidden email]> wrote:
>
>>[...]
>> But fpres is built during installation of fpc/lazarus and the binary
>> is placed in ~/bin, which usually is available on path.
>
>> And the /home/bosse/.profile file contains this:
>
>Not every shell uses /home/bosse/.profile.
>
>How do you start lazarus? Maybe this starter uses its own environment.
>

I always start Lazarus from the application menu (or a shortcut to
that desktop file placed on the desktop itself.

The content of the desktop file in use is (my logon username is
bosse):

[Desktop Entry]
Comment=Lazarus IDE 2.0.8
Terminal=false
Name=Lazarus 2.0.8
Exec=/home/bosse/dev/lazarus/2.0.8/startlazarus
--pcp=/home/bosse/.lazarus_2.0.8 %f
Type=Application
Icon=/home/bosse/dev/lazarus/2.0.8/images/ide_icon48x48.png
Categories=Application;IDE;Development;GTK;GUIDesigner;Programming;
NoDisplay=false
Keywords=editor;Pascal;IDE;FreePascal;fpc;Design;Designer;

This file is visible on the desktop as an icon as well as on the menu
subsection "programming".

As I said I access the Ubuntu machine via VNC so I can work on it
simultaneously as doing other things on Windows.

NOTE:
I had a problem with the Terminal application, which also does not get
the ~/bin dir added to its path even though .profile says so...

Turned out (after asking on the ubuntu forum) that the Mate and Gnome
Terminal programs both have an Edit/Profile settings where one can set
the terminal to "run command as a login shell"
When I checked that the terminal after a restart had ~/bin as the
first entry in PATH.

So I wonder if maybe Lazarus has a similar setting?

Or maybe VNC server does?
(Of course that is off-topic here, but still if someone "just knows"
maybe a global solution might be possible)


--
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] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list


On Sun, 24 May 2020, Bo Berglund via lazarus wrote:

> Comment=Lazarus IDE 2.0.8
> Terminal=false
> Name=Lazarus 2.0.8
> Exec=/home/bosse/dev/lazarus/2.0.8/startlazarus

Set this to
/bin/bash -l home/bosse/dev/lazarus/2.0.8/startlazarus --pcp=/home/bosse/.lazarus_2.0.8 %f

and .profile will be read.

I have a similar issue, and that is how I solved it.

>
> So I wonder if maybe Lazarus has a similar setting?

No, you must set the options on the desktop/menu entry that starts lazarus.

> Or maybe VNC server does?

You must run lazarus not by directly running the startlazarus, but by
invoking the shell with -l option. You can create a script for it.

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

Re: [Lazarus] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list
On Mon, 25 May 2020 07:36:55 +0200 (CEST), Michael Van Canneyt via
lazarus <[hidden email]> wrote:

>
>
>On Sun, 24 May 2020, Bo Berglund via lazarus wrote:
>
>> Comment=Lazarus IDE 2.0.8
>> Terminal=false
>> Name=Lazarus 2.0.8
>> Exec=/home/bosse/dev/lazarus/2.0.8/startlazarus
>
>Set this to
>/bin/bash -l home/bosse/dev/lazarus/2.0.8/startlazarus --pcp=/home/bosse/.lazarus_2.0.8 %f
>
>and .profile will be read.
>
>I have a similar issue, and that is how I solved it.
>
>>
>> So I wonder if maybe Lazarus has a similar setting?
>
>No, you must set the options on the desktop/menu entry that starts lazarus.
>
>> Or maybe VNC server does?
>
>You must run lazarus not by directly running the startlazarus, but by
>invoking the shell with -l option. You can create a script for it.
>
>Michael.

Something must have gone wrong here...
I changed the desktop file but no Lazarus showed up so I tried to run
the Exec command from a terminal instead:

bosse@polaris-ubuntu:~$ /bin/bash -l
/home/bosse/dev/lazarus/2.0.8/startlazarus
--pcp=/home/bosse/.lazarus_2.0.8 %f

/home/bosse/dev/lazarus/2.0.8/startlazarus:
/home/bosse/dev/lazarus/2.0.8/startlazarus: cannot execute binary file


--
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] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list


On Mon, 25 May 2020, Bo Berglund via lazarus wrote:

> On Mon, 25 May 2020 07:36:55 +0200 (CEST), Michael Van Canneyt via
> lazarus <[hidden email]> wrote:
>
>>
>>
>> On Sun, 24 May 2020, Bo Berglund via lazarus wrote:
>>
>>> Comment=Lazarus IDE 2.0.8
>>> Terminal=false
>>> Name=Lazarus 2.0.8
>>> Exec=/home/bosse/dev/lazarus/2.0.8/startlazarus
>>
>> Set this to
>> /bin/bash -l home/bosse/dev/lazarus/2.0.8/startlazarus --pcp=/home/bosse/.lazarus_2.0.8 %f
>>
>> and .profile will be read.
>>
>> I have a similar issue, and that is how I solved it.
>>
>>>
>>> So I wonder if maybe Lazarus has a similar setting?
>>
>> No, you must set the options on the desktop/menu entry that starts lazarus.
>>
>>> Or maybe VNC server does?
>>
>> You must run lazarus not by directly running the startlazarus, but by
>> invoking the shell with -l option. You can create a script for it.
>>
>> Michael.
>
> Something must have gone wrong here...
> I changed the desktop file but no Lazarus showed up so I tried to run
> the Exec command from a terminal instead:
>
> bosse@polaris-ubuntu:~$ /bin/bash -l
> /home/bosse/dev/lazarus/2.0.8/startlazarus
> --pcp=/home/bosse/.lazarus_2.0.8 %f

You must omit the %f on the command line.

What happens if you do

/bin/bash -l -c '/home/bosse/dev/lazarus/2.0.8/startlazarus --pcp=/home/bosse/.lazarus_2.0.8'

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

Re: [Lazarus] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list
On Mon, 25 May 2020 09:13:42 +0200 (CEST), Michael Van Canneyt via
lazarus <[hidden email]> wrote:

>
>
>On Mon, 25 May 2020, Bo Berglund via lazarus wrote:
>
>> On Mon, 25 May 2020 07:36:55 +0200 (CEST), Michael Van Canneyt via
>> lazarus <[hidden email]> wrote:
>>
>>>
>>>
>>> On Sun, 24 May 2020, Bo Berglund via lazarus wrote:
>>>
>>>> Comment=Lazarus IDE 2.0.8
>>>> Terminal=false
>>>> Name=Lazarus 2.0.8
>>>> Exec=/home/bosse/dev/lazarus/2.0.8/startlazarus
>>>
>>> Set this to
>>> /bin/bash -l home/bosse/dev/lazarus/2.0.8/startlazarus --pcp=/home/bosse/.lazarus_2.0.8 %f
>>>
>>> and .profile will be read.
>>>
>>> I have a similar issue, and that is how I solved it.
>>>
>>>>
>>>> So I wonder if maybe Lazarus has a similar setting?
>>>
>>> No, you must set the options on the desktop/menu entry that starts lazarus.
>>>
>>>> Or maybe VNC server does?
>>>
>>> You must run lazarus not by directly running the startlazarus, but by
>>> invoking the shell with -l option. You can create a script for it.
>>>
>>> Michael.
>>
>> Something must have gone wrong here...
>> I changed the desktop file but no Lazarus showed up so I tried to run
>> the Exec command from a terminal instead:
>>
>> bosse@polaris-ubuntu:~$ /bin/bash -l
>> /home/bosse/dev/lazarus/2.0.8/startlazarus
>> --pcp=/home/bosse/.lazarus_2.0.8 %f
>
>You must omit the %f on the command line.
>
>What happens if you do
>
>/bin/bash -l -c '/home/bosse/dev/lazarus/2.0.8/startlazarus --pcp=/home/bosse/.lazarus_2.0.8'
>

Now Lazarus starts up with the project loaded and the compile and
build operations work OK! :)

How can I change the desktop files so they also work?
I tried to set the Exec like this (single line of course, newsreader
wraps..):

Exec=/bin/bash -l -c '/home/bosse/dev/lazarus/2.0.8/startlazarus
--pcp=/home/bosse/.lazarus_2.0.8'

Then Lazarus starts OK but again throws the error due to
/home/bosse/bin missing from PATH.

It seems like if one could set PATH correctly to include ~/bin for the
VNC environment all would be solved...

The VNC server is a service and is started via this file:
/etc/systemd/system/vncserver@.service

[Unit]
Description=Systemd VNC server startup script for Ubuntu 18.04
After=syslog.target network.target

[Service]
Type=forking
User=bosse
ExecStartPre=-/usr/bin/vncserver -kill :%i &> /dev/null
ExecStart=/usr/bin/vncserver -depth 24 -geometry 1680x1040 :%i
PIDFile=/home/bosse/.vnc/%H:%i.pid
ExecStop=/usr/bin/vncserver -kill :%i

[Install]
WantedBy=multi-user.target

And I think that the content of this file is used as well:
/home/bosse/.vnc/xstartup

#!/bin/sh

# Uncomment the following two lines for normal desktop:
unset DBUS_SESSION_BUS_ADDRESS
unset SESSION_MANAGER
# exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP
Desktop" &
x-window-manager &
mate-session &


Finally, the VNC I am using was installed via
apt install vnc4server

Strange that I never ever saw this problem on Raspbian Buster on an
RPi4...


--
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] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list


On Mon, 25 May 2020, Bo Berglund via lazarus wrote:

>>> /home/bosse/dev/lazarus/2.0.8/startlazarus
>>> --pcp=/home/bosse/.lazarus_2.0.8 %f
>>
>> You must omit the %f on the command line.
>>
>> What happens if you do
>>
>> /bin/bash -l -c '/home/bosse/dev/lazarus/2.0.8/startlazarus --pcp=/home/bosse/.lazarus_2.0.8'
>>
>
> Now Lazarus starts up with the project loaded and the compile and
> build operations work OK! :)
>
> How can I change the desktop files so they also work?
> I tried to set the Exec like this (single line of course, newsreader
> wraps..):
>
> Exec=/bin/bash -l -c '/home/bosse/dev/lazarus/2.0.8/startlazarus
> --pcp=/home/bosse/.lazarus_2.0.8'
>
> Then Lazarus starts OK but again throws the error due to
> /home/bosse/bin missing from PATH.

Where is it added to the PATH ? Normally, if you do this in .bashrc or
.profile, the -l option forces bash to pick it up.

>
> It seems like if one could set PATH correctly to include ~/bin for the
> VNC environment all would be solved...

No, that won't help.

Because you don't know with what environment the desktop items are started.
My guess is these are started with a minimal environment.

That is what I experienced, and the above is how I solved it.
(Instead of bash I am using tcsh though...)

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

Re: [Lazarus] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list
On Mon, 25 May 2020 12:32:59 +0200 (CEST), Michael Van Canneyt via
lazarus <[hidden email]> wrote:

>> Then Lazarus starts OK but again throws the error due to
>> /home/bosse/bin missing from PATH.
>
>Where is it added to the PATH ? Normally, if you do this in .bashrc or
>.profile, the -l option forces bash to pick it up.
>

It is in ~/.profile

These are the active lines in that file:

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/.local/bin" ] ; then
    PATH="$HOME/.local/bin:$PATH"
fi

So whenever .profile is loaded the ~/bin dir gets prepended to PATH...

Soo strange that it is not working...


--
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] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list


On Mon, 25 May 2020, Bo Berglund via lazarus wrote:

> On Mon, 25 May 2020 12:32:59 +0200 (CEST), Michael Van Canneyt via
> lazarus <[hidden email]> wrote:
>
>>> Then Lazarus starts OK but again throws the error due to
>>> /home/bosse/bin missing from PATH.
>>
>> Where is it added to the PATH ? Normally, if you do this in .bashrc or
>> .profile, the -l option forces bash to pick it up.
>>
>
> It is in ~/.profile

Take care: if either of
   ~/.bash_profile,  ~/.bash_login,
exist, then .profile is not read.

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

Re: [Lazarus] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list
On Mon, 25 May 2020 19:06:32 +0200 (CEST), Michael Van Canneyt via
lazarus <[hidden email]> wrote:

>> It is in ~/.profile
>
>Take care: if either of
>   ~/.bash_profile,  ~/.bash_login,
>exist, then .profile is not read.
>

Well that is not the case either...

~$ ls -la .bas*
-rw------- 1 bosse bosse 20005 maj 25 21:06 .bash_history
-rw-r--r-- 1 bosse bosse   220 apr 10 15:22 .bash_logout
-rw-r--r-- 1 bosse bosse  4039 apr 26 08:56 .bashrc

But I have been mixing up the desktop files.... :(

It turns out there are *three* sets of desktop files in use, they are
located in:

~/.local/share/applications (user specific use by the Mate menu)

~/Desktop (shortcuts shown on the user desktop)

/usr/share/applications (global use by the Mate menu)

I had been manipulating the ~/Desktop files and then tested from the
menu and found no change in behavior...

But in fact if I edit and use the *same* desktop file it shows that
your suggestion is working!

So if I have this desktop file in ~/.local/share/applications it will
work from the menu too:

[Desktop Entry]
Comment=Lazarus IDE 2.0.8
Terminal=false
Name=Lazarus 2.0.8
#Entry below in order to secure setting up PATH correctly on start
Exec=/bin/bash -l -c '/home/bosse/dev/lazarus/2.0.8/startlazarus
--pcp=/home/bosse/.lazarus_2.0.8'
Type=Application
Icon=/home/bosse/dev/lazarus/2.0.8/images/ide_icon48x48.png
Categories=Application;IDE;Development;GTK;GUIDesigner;Programming;
NoDisplay=false
Keywords=editor;Pascal;IDE;FreePascal;fpc;Design;Designer;

Thanks a million for your help!!!!


--
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] Lazarus on Ubuntu 18.04.4 via VNC cannot find utilities

Free Pascal - Lazarus mailing list


On Mon, 25 May 2020, Bo Berglund via lazarus wrote:

> So if I have this desktop file in ~/.local/share/applications it will
> work from the menu too:
>
> [Desktop Entry]
> Comment=Lazarus IDE 2.0.8
> Terminal=false
> Name=Lazarus 2.0.8
> #Entry below in order to secure setting up PATH correctly on start
> Exec=/bin/bash -l -c '/home/bosse/dev/lazarus/2.0.8/startlazarus
> --pcp=/home/bosse/.lazarus_2.0.8'
> Type=Application
> Icon=/home/bosse/dev/lazarus/2.0.8/images/ide_icon48x48.png
> Categories=Application;IDE;Development;GTK;GUIDesigner;Programming;
> NoDisplay=false
> Keywords=editor;Pascal;IDE;FreePascal;fpc;Design;Designer;
>
> Thanks a million for your help!!!!

Glad you got it working !

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