In order to build a runtime system for distribution on a target machine, the option --moveable must be passed to spld. This option prevents spld from hardcoding any (absolute) paths into the executable.
Next, in order for SICStus to be able to locate all relevant files, the following directory structure should be used.
myapp.exe sp-3.12.11/ +--- libsprt312.so +--- sicstus-3.12.11/ +--- bin/ | +--- sprt.sav +--- library/ +--- <files from $SP_PATH/library>
If support for multiple SICStus instances is needed, then the run-times named e.g. libsprt312_instance_01_.so, need to be available as well, in the same place as libsprt312.so.
If SICStus Prolog is installed on the target machine, a symbolic link named sp-3.12.11 can be used, in which case it should point at the directory of the SICStus installation that contains the libsprt312.so (or equivalent).
myapp.exe is typically created by a call to spld:
% spld --main=user --moveable [...] -o ./myapp.exe
On most platforms, the above directory layout will enable the executable to find the SICStus run-time (e.q., libsprt312.so) as well as the boot file sprt.sav (spre.sav). In addition, application specific files, e.g. a .sav file, can be found using the automatically set environment variables SP_APP_DIR or SP_RT_DIR. On some platforms a wrapper script, generated by spld, is needed to ensure that the files are found.
On some platforms, the executable will not be able to locate sprt.sav (spre.sav) unless the environment variable SP_PATH is set. If the example above is rooted in /home/joe, then SP_PATH should be set to /home/joe/lib/sicstus-3.12.11. This is not needed on platforms where SP_APP_DIR or SP_RT_DIR can be used, e.g. on Linux, Solaris or Win32 and most others.
Unless the --static option is passed to spld, it might also be necessary to set LD_LIBRARY_PATH (or equivalent) to /home/joe/lib (in the example above) in order for the dynamic linker to find libsprt312.so. If the --static option is used, this is not necessary. Setting LD_LIBRARY_PATH is not needed, nor recommended, on Linux and Solaris (and Win32).
When a runtime system is redistributed to third parties, only the following files may be included in the distribution. All filenames are relative to <prefix>/lib/sicstus-3.12.11: