Recent

Author Topic: FPC-LLVM installer ?  (Read 4372 times)

Fred vS

  • Hero Member
  • *****
  • Posts: 3475
    • StrumPract is the musicians best friend
Re: FPC-LLVM installer ?
« Reply #30 on: November 07, 2022, 02:34:05 pm »
Hello everybody.

Coming back to the initial title of the topic and following all the advices from previous posts, here all the steps to compile fpc-llvm on Debian 11 64 bit.
Those steps should be the same for all Debian childs like Ubuntu, Mint, ...

-1) Install last stable LLVM version (with Debian 11 it is LLVM 13):
Code: Bash  [Select][+][-]
  1.  ~>  sudo apt install llvm-13

-2) Install clang-13:
Code: Bash  [Select][+][-]
  1.  ~>  sudo apt install clang-13

-3) Download fpc main source and unzip it.
    https://gitlab.com/freepascal.org/fpc/source/-/archive/main/source-main.zip

-4) Edit your /etc/fpc.cfg and add this line (it is gcc 10 on Debian 11) :
Code: Bash  [Select][+][-]
  1. -Fl/usr/lib/gcc/x86_64-linux-gnu/10/

-5) Script to build fpc (buildfpcllvm.sh) :
Code: Bash  [Select][+][-]
  1.   #!/bin/sh
  2.  COMPILER=/usr/lib/fpc/3.2.2/ppcx64
  3.  make clean
  4.  make all FPC=$COMPILER OPT="-Fl/usr/local/lib" OPTNEW="-Clv13.0 -XlS-13" FPCMAKEOPT="-Clv13.0 -XlS-13" LLVM=1

-6) Run the script in fpc root source directory:
Code: Bash  [Select][+][-]
  1.  > buildfpcllvm.sh

-7) Cross your fingers and do something fun. (compilation of fpc-llvm takes much more time than "classical" fpc.)

-8) When all is done, you may try fpc-llvm with this:
Code: Bash  [Select][+][-]
  1.  > /directory_of_fpc_source-main/compiler/ppcx64 -il
If you get this the compilation was OK:
Quote
7.0
7.1
8.0
Xcode-11.0
9.0
Xcode-11.4
10.0
Xcode-12.0
11.0
11.1
Xcode-12.5
12.0
Xcode-13.0
13.0
Xcode-13.3
14.0
15.0

-9) Installation of fpc-llvm (warning it will remove all previous install of fpc 3.3.1., so make a backup or change the directory target):

The install script (installfpcllvm.sh)  ( Note: it uses the new compiler ):
Code: Bash  [Select][+][-]
  1. #!/bin/sh
  2. COMPILER=/directory_of_fp_source-main/compiler/ppcx64
  3. make FPC=$COMPILER install OPT="-Clv13.0 -XlS-13" INSTALL_PREFIX=/usr/
  4.  

Run the script with root permission:
Code: Bash  [Select][+][-]
  1.  > sudo installfpcllvm.sh
 

-10) Test fpc-llvm:
Code: Bash  [Select][+][-]
  1. > /usr/lib/fpc/3.3.1/ppcx64 -il

If all was ok, you should have the same result as step 8 ).

-11) Using fpc-llvm for your application:
       Just add those fpc parameters: -Clv13.0 -XlS-13 for compilation.

-12) Enjoy.

Fre;D
« Last Edit: November 27, 2022, 01:21:11 pm by Fred vS »
I use Lazarus 2.2.0 32/64 and FPC 3.2.2 32/64 on Debian 11 64 bit, Windows 10, Windows 7 32/64, Windows XP 32,  FreeBSD 64.
Widgetset: fpGUI, MSEgui, Win32, GTK2, Qt.

https://github.com/fredvs
https://gitlab.com/fredvs
https://codeberg.org/fredvs

 

TinyPortal © 2005-2018