There is a problem bundling dynamic libraries with stand alone binaries since 8.1.24 (8.1.25 also fails). I’ve reduced it to this sample:
$ cat /tmp/s.pl
#!/usr/sbin/swipl
:- use_module(library(main)).
:- use_module(library(inotify)).
:- initialization(main, main).
main(_) :-
format('test',[]).
Running it from source is fine:
$ /tmp/s.pl
test
The stand-alone version fails:
$ /usr/sbin/swipl --stand_alone=true --foreign=save -o /tmp/s -c /tmp/s.pl
$ /tmp/s
ERROR: /home/u/.local/share/swi-prolog/pack/inotify/prolog/inotify.pl:44: Initialization goal raised exception:
ERROR: inotify4pl: cannot open shared object file: No such file or directory
ERROR: In:
ERROR: [18] throw(error(shared_object(open,'inotify4pl: cannot open shared object file: No such file or directory'),context(...,_2872)))
ERROR: [16] <meta call>
ERROR: [15] with_mutex('$foreign',load_foreign_library(foreign(inotify4pl),inotify,default(install))) <foreign>
ERROR: [12] '$run_init_goal'(shlib:load_foreign_library(...)) at /usr/lib/swipl/boot/init.pl:714
ERROR: [11] catch(system:'$run_init_goal'(...),_3010,system:'$initialization_error'(_3032,...,...)) at /usr/lib/swipl/boot/init.pl:482
ERROR: [10] catch_with_backtrace(system:'$run_init_goal'(...),_3068,system:'$initialization_error'(_3090,...,...)) at /usr/lib/swipl/boot/init.pl:532
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
test%
Looks like --foreign=save
is not saving the inotify4pl.so
.