Runtime Systems on UNIX Target Machines

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.11.2/
     +--- libsprt311.so
     +--- sicstus-3.11.2/
          +--- bin/
          |    +--- sprt.sav
          +--- library/
               +--- <files from $SP_PATH/library>
     

If support for multiple SICStus instances is needed, then the run-times named e.g. libsprt311_instance_01_.so, need to be available as well, in the same place as libsprt311.so.

If SICStus Prolog is installed on the target machine, a symbolic link named sp-3.11.2 can be used, in which case it should point at the directory of the SICStus installation that contains the libsprt311.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., libsprt311.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.11.2. 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 libsprt311.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.11.2:

../*.{a,so,sl,dylib}

bin/sprt.sav

bin/spre.sav

bin/jasper.jar

library/*.{tcl,po,pl}
Except license.pl!
library/*/*.{s.o,so,sl,dylib}

library/*/*.{po,pl}

sp_platform
(Located with InstallSICStus)