6

I just installed FPC 3.2.0 (on Linux Mint 19.3) and trying to use FPC IDE. I launched the IDE from the bin installation subfolder as ./fp, written a simplest program in IDE

program hello;

begin
  writeln('hello');
end.

saved the program as hello.pas and when I compile it I get

(3,1) Fatal: Can't find unit system used by hello
(0) Fatal: Compilation aborted

This is strange because system is the compiler's unit, not a user's unit.

I tried to google the issue, found several posts in different forums, one question was dated back to 2007 year, and none of the questions was answered.

Is where a way to solve the issue or FPC IDE is dead for about 15 years?

kludg
  • 27,213
  • 5
  • 67
  • 118

4 Answers4

5

Check the unit directories in options->directories -> unit directories.

The package configuration should have put a line like

/usr/lib/fpc/$FPCVERSION/units/$FPCTARGET/*

The dollar values are builtins (respectively 3.2.0 and i386-linux or x86_64-linux). Please verify that the directories with prebuilt .ppu .o are there.

Marco van de Voort
  • 25,628
  • 5
  • 56
  • 89
  • Thanks, but I removed FPC already and installed Lazarus 2.0.10 which is built on the same FPC 3.2.0, and FPC IDE works on Lazarus installation as expected. How to make FPC IDE work on a clean FPC installation remained a mystery to me. – kludg Jul 14 '20 at 15:07
  • It works fine on Windows where the circumstances are pretty constant, and the FPC team does the packaging. On Linux we depend on the distribution maintainers to do this, and IMHO (Linux) distribution packages of FPC are much less ready to run. – Marco van de Voort Jul 16 '20 at 11:09
  • 1
    Paths may differ on different systems. On Ubuntu 20.04 it is /usr/lib/x86_64-linux-gnu/fpc/$fpcversion/units/$fpctarget/* – unxed Nov 01 '20 at 21:33
  • That's an ubuntu/debian invention then. – Marco van de Voort Nov 01 '20 at 22:32
1

Try to fix your installation of FPC or you can fix it manually by calling fpcmkcfg

fpcmkcfg -d "basepath=path/to/fpc/3.3" -o path/to/fpc.cfg

For instance, if the compiler is in /usr/local/bin, it will look in /usr/local/etc.

  • This worked for me, once I realized that 'fpcmkcfg' on Debian, for example, is '/usr/bin/x86_64-linux-gnu-fpcmkcfg-3.2.0'. I used the system fpc.cfg: /etc/fpc.cfg – Lester Buck Oct 17 '20 at 05:08
0

Had the same problem on Ubuntu 20.04. To solve it, I had to create the file fp.cfg in my project's folder with the following content:

-Fu/usr/lib/x86_64-linux-gnu/fpc/$fpcversion/units/$fpctarget
-Fu/usr/lib/x86_64-linux-gnu/fpc/$fpcversion/units/$fpctarget/*

If this will not work, it means unit path on your system is different. You may use something like

dpkg -L fp-units-base-3.0.4 | grep .ppu

to find out where units are actually stored. Replace 3.0.4 with your actual Free Pascal version. If you do not know exact version, use

sudo apt install apt-show-versions
apt-show-versions fpc

It will show something like

fpc:all/focal 3.0.4+dfsg-23 uptodate

3.0.4 is the version number you need.

Another way of getting needed paths is running this command:

cat /etc/fpc.cfg | grep -- -Fu | head -2

So you may just run

cat /etc/fpc.cfg | grep -- -Fu | head -2 > fp.cfg

in your project's folder to have the problem solved.

unxed
  • 196
  • 1
  • 3
  • 6
0
  • How to use Free Pascal (Lazarus) on Linux - no install solution:
  1. If not already installed, install "GNU binutils" (sudo apt-get install binutils)

  2. Dowload the latest version of Free Pascal (Lazarus): from the Downloads section of the Lazarus Home page (Lazarus is a professional open-source cross platform IDE powered by Free Pascal):
    2.1. In case of a Debian based Linux system (such as Ubuntu): the .deb package could be downloaded ("fpc-laz_<version> ... .deb" (replace <version> with an actual version number))
    2.2. In case of a RPM based Linux system (such as Fedora): the .rpm package could be downloaded ("fpc-<version> ... .rpm" (replace <version> with an actual version number))

  3. Extract the downloaded package:
    3.1. Place the downloaded .deb / .rpm package in the folder where you are going to extract it
    3.2. Extract the downloaded .deb / .rpm package by Right-Click-ing it and then choosing Extract Here
    3.3. Rename the extracted folder, as you desire, for example "fpc"; Further we denote this folder as "<BASEFOLDER>" and its path as - "<BASEFOLDER_PATH>"

  4. In the case of a .deb package: Open the extracted <BASEFOLDER> and then, extract "data.tar.xz" - by Right-Click-ing it and then choosing Extract Here

  5. Launch the Free Pascal window by typing the next command in the terminal - this command may vary according to the terminal used - replace <terminal> with the terminal used (by default: for Gnome based Desktop Environments -> gnome-terminal; for KDE based Desktop Environments -> konsole; for Xfce based Desktop Environments -> xfce4-terminal; for the MATE Desktop Environment -> mate-terminal; ...):

    <terminal> -e '<BASEFOLDER_PATH>/usr/bin/fp'

    OR:

    <terminal> -- '<BASEFOLDER_PATH>/usr/bin/fp'

  6. To add the units folders: From the Free Pascal Menu, access: Options -> Directories -> and copy (CTRL + C to Copy from outside the IDE, and (FN + )SHIFT + Insert to Paste inside the IDE) to the "Units" tab, the next three lines, each on a new line (replace <BASEFOLDER_PATH> with its corresponding value, and replace <LIB_FOLDER> with: lib in case of a .deb package or lib64 in case of a .rpm package):

    <BASEFOLDER_PATH>/usr/<LIB_FOLDER>/fpc/$fpcversion\units\$fpctarget

    <BASEFOLDER_PATH>/usr/<LIB_FOLDER>/fpc/$fpcversion\units\$fpctarget\*

    <BASEFOLDER_PATH>/usr/<LIB_FOLDER>/fpc/$fpcversion\units\$fpctarget\rtl

  7. Please note that by moving the files from the <BASEFOLDER> directory to other <BASEFOLDER_PATH>, you'll have to update the above three lines so that they contain the new <BASEFOLDER_PATH>, otherwise you might get errors like:

    "Fatal: Can't find unit ..."

  8. For navigation inside the IDE using keyboard - the following shortcuts can be used: Alt + Highlighted-letter, Highlighted-letter(s), Tab / Shift + Tab, Arrows, Enter, Esc

  9. For Official Online Documentation see:

    Online Documentation

I. Marin
  • 1
  • 2