How to deploy the application?

how do you deploy your applications? It’s inconvenient to run from the command line. If you have packages, how do you download them when deploying the application? Are there ready-made solutions for building a release with launch scripts?

I use something like this:

swipl --stand_alone=true --no-pce --undefined=error --verbose=false \
		--on_error=status --on_warning=status \
		--foreign=save -o my_program.qlf -c my_program.pl

The resulting executable still require some .so files; on my system (the SWI-Prolog ones are libswipl.so.9 and libgmp.so.10):

	linux-vdso.so.1 (0x00007ffd54e81000)
	libtcmalloc_minimal.so.4 => /lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4 (0x00007aaa69445000)
	libswipl.so.9 => /home/peter/.local/lib/swipl/lib/x86_64-linux/libswipl.so.9 (0x00007aaa692a4000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007aaa690cf000)
	libstdc++.so.6 => /home/peter/.local/gcc-12/lib64/libstdc++.so.6 (0x00007aaa68eac000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007aaa68d68000)
	libgcc_s.so.1 => /home/peter/.local/gcc-12/lib64/libgcc_s.so.1 (0x00007aaa68d47000)
	libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007aaa68d16000)
	libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007aaa68c95000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007aaa68c78000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007aaa68c72000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007aaa68c50000)
	/lib64/ld-linux-x86-64.so.2 (0x00007aaa69642000)
1 Like

and then how do you run the qlf file?

It’s an ordinary executable – just run it.
If you wish, you can make its extension .exe (maybe that’s necessary on Windows, I don’t know) or no extension at all.

QLF was sensitive to Glibc. Perhaps in the unfolding, you need to include libraries

The executable contains the information about the shared objects. And it also contains the Prolog libraries that are used. It uses initialization/2 to specify the initial goal. If you wish a fully static executable, there’s separate thread that discusses the issue.

On my system (a Chromebook in developer mode with Debian Linux), slightly edited, and with verbose output (my swipl binary is in /home/peter/.local):

$ swipl --stand_alone=true --no-pce --undefined=error --verbose=true --on_error=status --on_warning=status --foreign=save -o my_program.qlf -c my_program.pl
% Disabled autoloading (loaded 110 files)
% autoloading prolog_pack:archive_extract/3 from /home/peter/.local/lib/swipl/library/archive
% autoloading archive:predicate_options/3 from /home/peter/.local/lib/swipl/library/predicate_options
% autoloading prolog_pack:archive_open/3 from /home/peter/.local/lib/swipl/library/archive
% autoloading prolog_pack:archive_next_header/2 from /home/peter/.local/lib/swipl/library/archive
% autoloading prolog_pack:archive_close/1 from /home/peter/.local/lib/swipl/library/archive
% autoloading prolog_pack:archive_open_entry/2 from /home/peter/.local/lib/swipl/library/archive
% autoloading build_tools:must_be/2 from /home/peter/.local/lib/swipl/library/error
% autoloading http_exception:current_setting/1 from /home/peter/.local/lib/swipl/library/settings
% autoloading http_exception:setting/2 from /home/peter/.local/lib/swipl/library/settings
% autoloading json:maplist/2 from /home/peter/.local/lib/swipl/library/apply
% autoloading http_open:maplist/3 from /home/peter/.local/lib/swipl/library/apply
% autoloading prolog_clause:nth1/3 from /home/peter/.local/lib/swipl/library/lists
% autoloading optparse:existence_error/2 from /home/peter/.local/lib/swipl/library/error
% autoloading archive:directory_file_path/3 from /home/peter/.local/lib/swipl/library/filesex.pl
% autoloading archive:option/2 from /home/peter/.local/lib/swipl/library/option.pl
% autoloading archive:member/2 from /home/peter/.local/lib/swipl/library/lists.pl
% autoloading archive:domain_error/2 from /home/peter/.local/lib/swipl/library/error.pl
% autoloading archive:must_be/2 from /home/peter/.local/lib/swipl/library/error.pl
% autoloading archive:option/3 from /home/peter/.local/lib/swipl/library/option.pl
% autoloading archive:make_directory_path/1 from /home/peter/.local/lib/swipl/library/filesex.pl
% autoloading archive:existence_error/2 from /home/peter/.local/lib/swipl/library/error.pl
% autoloading error:assertion/1 from /home/peter/.local/lib/swipl/library/debug
% autoloading build_cmake:directory_file_path/3 from /home/peter/.local/lib/swipl/library/filesex
% autoloading http_dispatch:gzopen/4 from /home/peter/.local/lib/swipl/library/zlib
% autoloading zlib:predicate_options/3 from /home/peter/.local/lib/swipl/library/predicate_options
% autoloading build_cmake:delete_directory_and_contents/1 from /home/peter/.local/lib/swipl/library/filesex
% autoloading build_cmake:member/2 from /home/peter/.local/lib/swipl/library/lists
% Found new meta-predicates in iteration 1 (0.292 sec)
% :- meta_predicate pykythe:must_once_symrej(2,?,?).
% Restarting analysis ...
% autoloading zlib:must_be/2 from /home/peter/.local/lib/swipl/library/error.pl
% autoloading zlib:partition/4 from /home/peter/.local/lib/swipl/library/apply.pl
% autoloading zlib:merge_options/3 from /home/peter/.local/lib/swipl/library/option.pl
% autoloading zlib:option/2 from /home/peter/.local/lib/swipl/library/option.pl
% autoloading zlib:[partition/4] from /home/peter/.local/lib/swipl/library/apply.pl
% autoloading zlib:[must_be/2] from /home/peter/.local/lib/swipl/library/error.pl
% autoloading zlib:[merge_options/3,option/2] from /home/peter/.local/lib/swipl/library/option.pl
% autoloading archive:[existence_error/2,domain_error/2,must_be/2] from /home/peter/.local/lib/swipl/library/error.pl
% autoloading archive:[directory_file_path/3,make_directory_path/1] from /home/peter/.local/lib/swipl/library/filesex.pl
% autoloading archive:[member/2] from /home/peter/.local/lib/swipl/library/lists.pl
% autoloading archive:[option/3,option/2] from /home/peter/.local/lib/swipl/library/option.pl
% Disabled autoloading (loaded 7 files)
% Autoloader: iteration 1 resolved 31 predicates and loaded 2 files in 0.544 seconds.  Restarting ...
% Disabled autoloading (loaded 0 files)
% Autoloader: loaded 2 files in 2 iterations in 0.787 seconds
[peter@penguin cpp (exceptions)]$ 

$ file my_program.qlf 
my_program.qlf: ELF 64-bit LSB pie executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=7a38fefb6c09bdeeec0fd834a59f9d97c9f66089, for GNU/Linux 3.2.0, with debug_info, not stripped

$ ldd my_file.qlf
	linux-vdso.so.1 (0x00007ffd54e81000)
	libtcmalloc_minimal.so.4 => /lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4 (0x00007aaa69445000)
	libswipl.so.9 => /home/peter/.local/lib/swipl/lib/x86_64-linux/libswipl.so.9 (0x00007aaa692a4000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007aaa690cf000)
	libstdc++.so.6 => /home/peter/.local/gcc-12/lib64/libstdc++.so.6 (0x00007aaa68eac000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007aaa68d68000)
	libgcc_s.so.1 => /home/peter/.local/gcc-12/lib64/libgcc_s.so.1 (0x00007aaa68d47000)
	libtinfo.so.6 => /lib/x86_64-linux-gnu/libtinfo.so.6 (0x00007aaa68d16000)
	libgmp.so.10 => /lib/x86_64-linux-gnu/libgmp.so.10 (0x00007aaa68c95000)
	libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007aaa68c78000)
	libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007aaa68c72000)
	libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007aaa68c50000)
	/lib64/ld-linux-x86-64.so.2 (0x00007aaa69642000)