Recent

Author Topic: NEW procedure and (old style) variant records (Initial ISO Pascal standard)  (Read 4804 times)

pahhur

  • Newbie
  • Posts: 5
According to the above, that problem should have been solved by parsing.

However, now, when I compile (on my new arch system) with
[0.004] Free Pascal Compiler version 3.2.2 [2022/03/02] for x86_64
[0.004] Copyright (c) 1993-2021 by Florian Klaempfl and others

I get the error message
Fatal: Syntax error, ";" expected but "identifier DISPOSE" found

Do I meanwhile have to use an additional compiler option to
enable "DISPOSE" ? -Miso doesn't seem to be enough ...



marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12572
  • FPC developer.
It compiles in the development version 3.3.1.  I don't have 3.2.2 here.

pahhur

  • Newbie
  • Posts: 5

Well, 3.2.2 is what Arch provided me (standard fpc package), and it was dated Mar 2, 2022 ... so I thought it was the latest.

(The AUR version (fpc-src-svn) is even older @3.1.1, and it relies on an SVN server
that apparently does not exist anymore, and the package maintainer
hasn't answered out of date requests for a while)

Can you give me the full git (or svn) address to use for 3.3.1, so that I can build it on my own ?

trev

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 2032
  • Former Delphi 1-7, 10.2 user
FPC 3.3.1

Code: Text  [Select][+][-]
  1. git clone -b main https://gitlab.com/freepascal.org/fpc/source.git fpc_main

Be aware: This is the development version of FPC and changes daily. It is not a release version.

pahhur

  • Newbie
  • Posts: 5

Well, there are some issues with building this package from scratch.

First, it claims, that fpcmake is missing. Usually compilers do bootstrap themselves. Here it seems, the fpcmake has to be provided by an existing fpc package, and only then the makefile is willing to work. Maybe there are other dependencies that are needed (instead of the existing fpc package), and someone can enlighten me wrt this point.

However, if I do

Code: Text  [Select][+][-]
  1. pacman -S fpc # old version providing fpcmake
  2. make all -j 16
  3. sudo make install

the resulting fpc (/usr/local/bin) still reports version 3.2.2

If I dare to
- deinstall the arch fpc-package, the installation in /usr/local/bin does not work anymore.
- deinstall the fpc-package before I do the make install, then the make insists on having an fpcmake in the path ...


A ppc3 in the just made compiler tree, however, reports version 3.3.1

And now it gets even stranger.

Considering the following program

Code: Pascal  [Select][+][-]
  1. (* FPC -Miso *)
  2. PROGRAM TRY(INPUT,OUTPUT);
  3. TYPE
  4.     R = RECORD
  5.             I : INTEGER;
  6.             CASE BOOLEAN OF
  7.                 TRUE: (J: INTEGER);
  8.                 FALSE: (F: REAL)
  9.          END;
  10.  
  11.      RP = ^R;
  12.  
  13. VAR
  14.    P : RP;
  15.  
  16. BEGIN
  17.     NEW(P,TRUE);
  18.     P^.I := 42;
  19.     P^.J := 7;
  20.     DISPOSE(P,TRUE);
  21.  
  22.     NEW(P,FALSE);
  23.     P^.I := 42;
  24.     P^.F := 7.0;
  25.     DISPOSE(P,FALSE)
  26. END.

the ppc3 sometimes reports

Fatal: Syntax error, ";" expected but "identifier DISPOSE" found

and sometimes, it compiles the unmodified program without any
problems. I will provide the offending line number the next time
it claims that something's wrong with the program.



marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12572
  • FPC developer.
Well, there are some issues with building this package from scratch.

Free pascal requires the previous release (now 3.2.2) to bootstrap.

Quote
However, if I do

Code: Text  [Select][+][-]
  1. pacman -S fpc # old version providing fpcmake
  2. make all -j 16
  3. sudo make install
[/code]

Note that -j 16 doesn't do much, there is no per compilation unit parallelism, only per package(directory) level, and there is parallelism that way for about  4-6 cores.  And to actually notice that if you need also pass FPMAKEOPT="-T 16" to instruct fpcmake to do so.  The script does so automatically.

Also, if install is separate (and that is better, long term) you need to pass the generated compiler, not let it search in the path. This script demonstrates some settings for a Athlon 200GE dual core processor. Most of the settings are in the first block, check them.

Quote
the resulting fpc (/usr/local/bin) still reports version 3.2.2

It searches for a ppcx64 in the same dir as the fpc binary ($prefix/bin) Usually this is a symlink to the real binary in $prefix/lib/fpc/<version>. Be careful though, the 3.2.2 installation might confuse things since packages often install /usr/lib

Also, the fpc.cfg (probably installed by 3.2.2) must point to the units (assume prefix is /usr/local) in  /usr/local/lib/fpc/$fpcversion/units/x86_64-linux/*

where $fpcversion is a macro that gets automatically substituted by the version.

Quote
If I dare to
- deinstall the arch fpc-package, the installation in /usr/local/bin does not work anymore.
- deinstall the fpc-package before I do the make install, then the make insists on having an fpcmake in the path ...

That could work after the install. But I think the kicker is the install going wrong, and maybe the fpc.cfg (in /etc or as ~/.fpc.cfg depending on a global or per user install of the package) . Make a copy of that file before the deinstall of the distro package.

Then
  • Restore the backed up fpc.cfg to /etc/fpc.cfg or ~/.fpc.cfg)
  • fix the -Fu line in the fpc.cfg to your "make install" prefix and version if necessary. See the script (INSTALL_PREFIX)
  • make sure /usr/local/bin (or whatever prefix) is in your $PATH
  • Make sure a symlink from  /usr/local/bin/ppcx64 to /usr/local/lib/fpc/3.3.1/ppcx64 exists

These are post install steps not done by the makefile install (to avoid messing up complex preexisting settings).

Quote
Code: Pascal  [Select][+][-]
  1. (* FPC -Miso *)
  2. PROGRAM TRY(INPUT,OUTPUT);
  3. TYPE
  4.     R = RECORD
  5.             I : INTEGER;
  6.             CASE BOOLEAN OF
  7.                 TRUE: (J: INTEGER);
  8.                 FALSE: (F: REAL)
  9.          END;
  10.  
  11.      RP = ^R;
  12.  
  13. VAR
  14.    P : RP;
  15.  
  16. BEGIN
  17.     NEW(P,TRUE);
  18.     P^.I := 42;
  19.     P^.J := 7;
  20.     DISPOSE(P,TRUE);
  21.  
  22.     NEW(P,FALSE);
  23.     P^.I := 42;
  24.     P^.F := 7.0;
  25.     DISPOSE(P,FALSE)
  26. END.

That also compiles fine here with -Miso , I assume it is some version mixup.

If you have any problems, report back here or check this old but largely still valid PDF http://www.stack.nl/~marcov/buildfaq.pdf for background info and more stepwise treatment

« Last Edit: April 30, 2022, 02:04:43 pm by marcov »

 

TinyPortal © 2005-2018