Sunday, October 9, 2016

How to compile Prolog with GProlog and SWI-Prolog (Linux)


Application must contain such piece of code

 Then executable file can be built with
gplc --min-size
To decrease size of resulted file just use upx utlity
upx --all-methods exeFile


Add some main goal into Prolog application
main :- Goal, Goal, Goal.
Compile with string
swipl -O --foreign=save --toplevel=halt --goal=main --stand_alone=true -o exeFile -c
Check usage of system libraries with
ldd exeFile
It will show something like =>  (0x00007ffcdc3f8000) => /usr/lib/ (0x00007febe1ec8000) => /lib/x86_64-linux-gnu/ (0x00007febe1cab000) is used by the executable file and must be bundled together with compiled file