Forum > FPC development
FPC-LLVM installer ?
Fred vS:
Ooops, I did not yet finish the first cup of coffee anf fpc-llvm is alreaded compiled + installed!
So, on Debian 11 64 bit, following this https://wiki.freepascal.org/LLVM
- Install LLVM from Debian package (it will install llvm 11):
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$ sudo apt install llvm
- Install CLang from Debian package:
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---$ sudo apt install clang
- Download fpc main source and unzip it.
- Edit /etc/fpc.cfg and add this line (it is gcc 10 on Debian 11) :
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- -Fl/usr/lib/gcc/x86_64-linux-gnu/10/
- Script to build fpc (buildfpcllvm.sh):
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- #!/bin/sh COMPILER=/usr/lib/fpc/3.2.2/ppcx64 make clean make all FPC=$COMPILER OPT="-Fl/usr/local/lib" OPTNEW="-Clv11.0" FPCMAKEOPT="-Clv11.0" LLVM=1 make FPC=$COMPILER install INSTALL_PREFIX=/usr/ - Run the script in fpc root source:
--- Code: Bash [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} --- $ sudo buildfpcllvm.sh
- Cross your fingers.
- Yes, it is done.
Compilation and installation went out-of-the-box. ;D
There is the compiler in /usr/lib/fpc/3.3.1/ppcx64.
But now I have some doubt.
Do I really have a fpc-llvm version?
In doc, it is said:
--- Quote ---Use FPC's -il command line parameter to list all supported LLVM and Xcode versions. These can be selected using the -Clv command line parameter.
--- End quote ---
But if I add those -il or -Clv parameter to usr/lib/fpc/3.3.1/ppcx64 there is a error message "Illegal parameter".
How to know if that ppcx64 has llvm feature?
[EDIT M]aybe I miss something but after compilation of some test-source, I dont see any .ll assembly bitcode produced and the binary seems the same as compiled with "normal" fpc.
Fre;D
Jonas Maebe:
--- Quote from: Fred vS on October 30, 2022, 10:27:29 pm ---There is the compiler in /usr/lib/fpc/3.3.1/ppcx64.
But now I have some doubt.
Do I really have a fpc-llvm version?
In doc, it is said:
--- Quote ---Use FPC's -il command line parameter to list all supported LLVM and Xcode versions. These can be selected using the -Clv command line parameter.
--- End quote ---
But if I add those -il or -Clv parameter to usr/lib/fpc/3.3.1/ppcx64 there is a error message "Illegal parameter".
How to know if that ppcx64 has llvm feature?
--- End quote ---
If the above command lines return errors, it's not an LLVM-based compiler. Can you try the same with the compiler/ppcx64 binary in your source tree? If that one also returns an error, it was indeed not built with LLVM support. Can you post the full compilation log?
Fred vS:
--- Quote from: Jonas Maebe on October 31, 2022, 12:11:12 pm ---Can you try the same with the compiler/ppcx64 binary in your source tree?
--- End quote ---
Not sure to understand.
The source are in /home/fred/Downloads/source-main/
After compilation, ppcx64 is created in /compiler:
--- Code: ---fred@fred-pc ~> /home/fred/Downloads/source-main/compiler/ppcx64 -il
Error: Illegal parameter: -il
--- End code ---
--- Quote from: Jonas Maebe on October 31, 2022, 12:11:12 pm ---Can you post the full compilation log?
--- End quote ---
With pleasure (if you tell me where is the compilation log :-[ )
Fred vS:
Re-hello Jonas.
Maybe one cup of coffee was not enough.
Because I did not find the log.txt file, I decided to recompile fpc-llvm with the same script of my previous post.
And to copy the messages from console to have the log of messages.
But this time, the compilation fails with that message (why not yesterday, mystery):
--- Quote ---/home/fred/Downloads/source-main/compiler/ppc1 -Ur -Xs -O2 -n -Fux86_64 -Fusystems -Fu/home/fred/Downloads/source-main/rtl/units/x86_64-linux -Fix86_64 -FEx86_64/bin/x86_64-linux -FUx86_64/units/x86_64-linux -Cg -Fl/usr/lib/gcc/x86_64-linux-gnu/10 -dRELEASE -Fl/usr/local/lib -Clv11.0 -Clflto -dx86_64 -dGDB -dllvm -Fullvm -Fux86 -Fix86 -Sew -o/home/fred/Downloads/source-main/compiler/ppc2 pp.pas
/home/fred/Downloads/source-main/rtl/units/x86_64-linux/si_c.bc: file not recognized: file format not recognized
pp.pas(302,1) Error: Error while linking
pp.pas(302,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[5]: *** [Makefile:5119: ppcx64] Error 1
make[5]: Leaving directory '/home/fred/Downloads/source-main/compiler'
make[4]: *** [Makefile:5171: next] Error 2
make[4]: Leaving directory '/home/fred/Downloads/source-main/compiler'
make[3]: *** [Makefile:5177: ppc2] Error 2
make[3]: Leaving directory '/home/fred/Downloads/source-main/compiler'
make[2]: *** [Makefile:5187: cycle] Error 2
make[2]: Leaving directory '/home/fred/Downloads/source-main/compiler'
make[1]: *** [Makefile:3184: compiler_cycle] Error 2
make[1]: Leaving directory '/home/fred/Downloads/source-main'
make: *** [Makefile:3216: build-stamp.x86_64-linux] Error 2
fred@fred-pc ~/D/source-main [2]>
--- End quote ---
So this time it seems that the fpc-llvm was trying to compile but without luck.
How can I fix this ? :
--- Quote ---/home/fred/Downloads/source-main/rtl/units/x86_64-linux/si_c.bc: file not recognized: file format not recognized
--- End quote ---
Fre;D
marcov:
Maybe normal linker selected instead of llvm linker?
Navigation
[0] Message Index
[#] Next page
[*] Previous page