Recent

Author Topic: fpc/Lazarus on Linux Mint/Cinnamon 20  (Read 2807 times)

CVAlkan

  • New member
  • *
  • Posts: 9
fpc/Lazarus on Linux Mint/Cinnamon 20
« on: November 02, 2020, 11:04:36 pm »
I have a new installation of Linux Mint 20 (Cinnamon) and I need to install fpc and Lazarus to cross compile an app for use on both Linux and Windows. Not having used either fpc or lazarus for quite some time, I seem to have forgotten how to get it all working. I don't recall it being this much of a chore in the past, but ...

Anyway I downloaded the following [having read that the version with the distro a) was older and b) did not support cross-compiling]:

fpc-3.2.0-x86_64-linux.tar
fpc-3.2.0.source.tar.gz
lazarus-project_2.0.10-0_amd64.deb

... and untarred and installed the fpc stuff using the supplied install shell script, and the .deb file with dpkg -i, following up with apt-get install -f to download remaining dependencies.

From the command line, I attempted to compile some older .pas source files that I had around using "fpc -gl MyApp.pas" but was forced to run it as root ("sudo fpc -gl MyApp.pas"); this apparently has to do with accessing libraries rather than the fpc executable itself, but I figured I'd deal with that after checking that lazarus would at least run.

When I ran lazarus, it appeared as I would have expected, but when attempting to "run" a bare window with a single button, I got the message "Fatal: Cannot find xlib used by Gtk2Int of package LCL".

I looked in synaptic and it appears that libgtk2.0-dev as well as various other libraries mentioned are all installed, so I'm mystified. Since I don't recall needing to use sudo to compile .pas files in the past, I suspect I may have missed some fundamental step along the way, but haven't discovered what.

Does anyone know what I've missed or done improperly?

Thanks...


PierceNg

  • Sr. Member
  • ****
  • Posts: 373
    • SamadhiWeb
Re: fpc/Lazarus on Linux Mint/Cinnamon 20
« Reply #1 on: November 03, 2020, 02:15:39 am »
I'm on Ubuntu 20.04. I installed with the .deb packages from Sourceforge:

- fpc-laz_3.2.0-1_amd64.deb
- fpc-src_3.2.0-1_amd64.deb
- lazarus-project_2.0.10-0_amd64.deb

The installation works fine for native Linux compilation.


CVAlkan

  • New member
  • *
  • Posts: 9
Re: fpc/Lazarus on Linux Mint/Cinnamon 20
« Reply #2 on: November 03, 2020, 04:55:17 am »
Thanks for the response, but now I'm even more confused.

I downloaded the packages you recommended.

Then I used Synaptic to completely remove everything I could find related to fpc or lazarus, confirming that "which fpc" and "which lazarus" returned nothing, and then checked to see that nothing remained on the menu.

Then I double-clicked on each downloaded deb file in sequence - each of which brought up the usual gdebi package info screen.

Each installation seemed to go ok, but after crunching ended, it displayed a message saying "same version already installed." (All three files did this!)

But lazarus had re-appeared in the menu, so I tried it but got the same message about "Fatal: Cannot find xlib used by Gtk2Int of package LCL".

So it seems that (possibly) some vestiges of the earlier installation remain lurking somewhere in my machine, so I'll need to do some digging when I get a chance tomorrow. I'll post back if I make any discoveries (I guess there's always a chance that Mint just discarded something that Ubuntu includes, so I'll try to check on that as well).

Again, thanks for responding...

dogriz

  • Full Member
  • ***
  • Posts: 127
Re: fpc/Lazarus on Linux Mint/Cinnamon 20
« Reply #3 on: November 03, 2020, 07:34:18 am »
Try https://github.com/LongDirtyAnimAlf/fpcupdeluxe
There is a list of prerequested libraries for linux, and after that you can install any version and crosscompiler you like.
FPC 3.2.2
Lazarus 2.2.4
Debian x86_64, arm

CVAlkan

  • New member
  • *
  • Posts: 9
Re: fpc/Lazarus on Linux Mint/Cinnamon 20
« Reply #4 on: November 06, 2020, 04:07:45 pm »
Thanks for the info ...

I managed to get both fpc and lazarus working on another Mint 20 machine, though I had to play fast and loose with permissions and things that I don't recall ever having to do in the past. This leads me to believe that EITHER: I'm not correctly or completely purging all previous fpc/lazarus remnants from my primary machine before reinstalling, OR there is some quirk with my new machine that I haven't accounted for, OR there are some changes in Mint 20 itself that aren't accounted for.

Given that there are so many other issues I've run into with Mint 20 (e.g. bugs with IME mappings, loss of scanning ability, etc), I'm inclined to suspect Mint and/or Cinnamon, and just look into changing distros once again.

So - no solution yet. As I get time, I'll play around some more and post if I find the culprit.

For dogriz: I've checked all of the libraries in your list, and they all seem to be installed and with correct versions, but thanks anyway.

zamronypj

  • Full Member
  • ***
  • Posts: 133
    • Fano Framework, Free Pascal web application framework
Re: fpc/Lazarus on Linux Mint/Cinnamon 20
« Reply #5 on: November 08, 2020, 09:18:39 am »
I just want to share my experience.

I had old Lazarus installation in my Ubuntu 16.06. IIRC, it was Lazarus 1.6. it worked. I tried to install newer Lazarus. I downloaded deb package from sourceforge and installed it without removing old Lazarus with hope that it can works side by side with older Lazarus, or at least upgrade it. However my effort did not succeed and left me with both Lazarus installation broken.

I tried to purge both Lazarus, and reinstall. I lost count how many purge and reinstall I did, including fpcupdeluxe. eventually I gave up.

Few months ago, I had new Ubuntu 16.04 installation. I did fresh install of Lazarus 2.0.10 using fpcupdeluxe and it installed without any problem.
Fano Framework, Free Pascal web application framework https://fanoframework.github.io
Apache module executes Pascal program like scripting language https://zamronypj.github.io/mod_pascal/
Github https://github.com/zamronypj

dbannon

  • Hero Member
  • *****
  • Posts: 2794
    • tomboy-ng, a rewrite of the classic Tomboy
Re: fpc/Lazarus on Linux Mint/Cinnamon 20
« Reply #6 on: November 08, 2020, 09:57:06 am »
Just to be sure CVAlkan, you said it first post that you installed the fpc binary and source from tar files, PierceNg suggested you use the SourceForge debs for all three.   And he is probably right, its fine to use the FPC tars, I use them, but you do then need to also manually install the FPC dependencies that are mentioned on the wiki page about installing that way. (You did read tthe wiki page ?)

If, as you say, you installed FPC as tars, they are unknown to the apt system and apt-get install -f will not help with dependencies.

Incidentally, I prefer to use apt to install, if you provide an explicit path to the debs you have downloaded, it will install them fine. And in all recent (two or three years ? ) versions of apt will also resolve your dependencies for you.

So, clarify was it fpc-3.2.0-x86_64-linux.tar and fpc-3.2.0.source.tar.gz OR  fpc-laz_3.2.0-1_amd64.deb and fpc-src_3.2.0-1_amd64.deb ?

Strong suggestion, get the debs, install the compiler, then the src then Lazarus with apt (or, better still, use gdebi).

Good luck.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

CVAlkan

  • New member
  • *
  • Posts: 9
Re: fpc/Lazarus on Linux Mint/Cinnamon 20
« Reply #7 on: November 14, 2020, 03:09:00 am »
I haven't had a chance to revisit this for a week or so, but thanks for all the comments and suggestions.

To answer the most recent questions:

I have indeed read the wiki pages as well as everything else I could find, and I've done all of the things suggested (including using the deb files), but still no luck on my primary machine. As I mentioned I used fpc and lazarus quite some years ago with no issues, and also installed them both successfully on another machine with a new Mint 20 install, so this isn't uncharted territory.

So my suspicion is that either a) I've still got some miscellaneous junk from the tar file install hanging around that's interfering, or b) there's some gotcha with the NVidia graphics card or its drivers that don't care for the new Mint (I've already run into other issues that I've fortunately discovered work-arounds for, though I can't imagine why fpc or lazarus be affected).

Hopefully I'll find some time to play with this over the weekend - maybe even do a fresh install on a new VM on the same machine just to see what happens  ... Thanks again, though.

dbannon

  • Hero Member
  • *****
  • Posts: 2794
    • tomboy-ng, a rewrite of the classic Tomboy
Re: fpc/Lazarus on Linux Mint/Cinnamon 20
« Reply #8 on: November 14, 2020, 03:40:06 am »
OK, so, we now should assume you are using (just) the debs from source forge ?

Firstly, and quite importantly, you should not have to run as root.  In fact, you should never run something like a compiler as root, ever !

So, please report what happens if you run as an ordinary user. Only.

Trying out a cli compile of just fpc code is a great idea, you mentioned you were forced to run as root ?  Exactly what happens when you run as you please ?

Running and compiling under Lazarus is more complicated. Because you have installed from debs, all the lazarus content is in root space, not writable.  So, the 'startlazarus' (? check name) command does some clever things and keeps its working files in a directory you can write to, $HOME/.lazarus or similar.   If you start lazarus with the 'lazarus' command, non of that redirection will work, and, assuming you are running as you, things don't work.  (If you are running as root, very, very bad things can happen!).

So, please tell us what happens when you do these tests as you.

Davo

Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018