FPC IDE: Can't find unit system

Viewed 5431

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?

3 Answers

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.

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.

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.

Related