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-4.0.0/ +--- libsprt4-0-0.so +--- sicstus-4.0.0/ +--- bin/ | +--- sprt.sav +--- library/ +--- <files from $SP_PATH/library>
If support for multiple SICStus instances is needed, the run-times named e.g. libsprt4-0-0_instance_01_.so need to be available as well, in the same place as libsprt4-0-0.so.
If SICStus Prolog is installed on the target machine, a symbolic link named sp-4.0.0 can be used, in which case it should point to the directory of the SICStus installation that contains the libsprt4-0-0.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., libsprt4-0-0.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, SP_PATH should be set to /home/joe/lib/sicstus-4.0.0. 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 libsprt4-0-0.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-4.0.0:
InstallSICStus
)