Creating executables with shared library from a pack (linux).

42 views
Skip to first unread message

nicos.ang...@gmail.com

unread,
Jun 30, 2017, 7:52:20 AM6/30/17
to SWI-Prolog

Dear all,

Has anyone successfully created a stand alone executable that contains a shared
library object from a pack ?

On an ubuntu box with latest SWI Prolog development version, i get:

άμπελος;filters% swipl -f none
Welcome to SWI-Prolog (threaded, 64 bits, version 7.5.10-3-gf80d312)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit http://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- use_module(library(real)).
true.

?- [user].
example :-
|: x <- c(1,2,3),
|: <- x.
|: ^Dtrue.

?- example.
[1] 1 2 3
true.

?- qsave_program( filter, [foreign(save),stand_alone(true),goal(example)] ).
% autoloading prolog_codewalk:must_be/2 from /usr/local/users/na11/local/git/lib/swipl-7.5.10/library/error
....
% Autoloader: iteration 2 resolved 2 predicates and loaded 16 files in 0.045 seconds.  Restarting ...
% Autoloader: loaded 24 files in 3 iterations in 0.154 seconds
/usr/bin/strip: '/usr/local/users/na11/local/git/lib/swipl-7.5.10/lib/x86_64-linux/real.so': No such file
false.

?-

real.so exists at:
$PREFIX/lib/swipl-7.5.10/pack/real/lib/x86_64-linux

Regards,

Nicos Angelopoulos
---
http://stoics.org.uk/~nicos

rausm

unread,
Jun 30, 2017, 10:48:30 AM6/30/17
to SWI-Prolog
[just a guess] Would adding that dir to LD_LIBRARY_PATH help ?

Dne pátek 30. června 2017 13:52:20 UTC+2 nicos.ang...@gmail.com napsal(a):

rausm

unread,
Jun 30, 2017, 10:52:46 AM6/30/17
to SWI-Prolog
probably not, it's strip thats complaining, my dumb.

maybe just symlink it / copy it ?

Dne pátek 30. června 2017 16:48:30 UTC+2 rausm napsal(a):

Jan Wielemaker

unread,
Jun 30, 2017, 11:01:13 AM6/30/17
to rausm, SWI-Prolog
On 06/30/2017 04:52 PM, rausm wrote:
> probably not, it's strip thats complaining, my dumb.

And it complains because the file isn't at the place it is claimed to be
found. Pushed a fix to swipl-devel.git for the qsave library.

Cheers --- Jan

>
> maybe just symlink it / copy it ?
>
> Dne pátek 30. června 2017 16:48:30 UTC+2 rausm napsal(a):
>
> [just a guess] Would adding that dir to LD_LIBRARY_PATH help ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
> <mailto:swi-prolog+...@googlegroups.com>.
> Visit this group at https://groups.google.com/group/swi-prolog.
> For more options, visit https://groups.google.com/d/optout.

nicos.ang...@gmail.com

unread,
Jul 3, 2017, 7:06:40 AM7/3/17
to SWI-Prolog

Dear Jan,

Thanks for the quick reply.

The fix seems to load Real shared object fine (i need to fix restarting the connection property to be
certain everything is ok), but it appears to have problems with rocksdb:

% cat testo_rocks.pl

:- use_module( library(rocksdb) ).

testo_rocks_null :-
    true.
   
testo_rocks :-
    Cnps = '.../filters/data/common_snps_rocks',
    rocks_open( Cnps, Rdb, [] ),
    rocks_close( Rdb ),
    write( well(done) ), nl.

save_rocks :-
    qsave_program( testo_rocks, [foreign(save),stand_alone(true),goal(testo_rocks)] ).
save_rocks_null :-
    qsave_program( testo_rocks, [foreign(save),stand_alone(true),goal(testo_rocks_null)] ).


άμπελος;exec_with_shared% swipl -f testo_rocks.pl
Welcome to SWI-Prolog (threaded, 64 bits, version 7.5.10-20-g4e4a935-DIRTY)

SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

For online help and background, visit http://www.swi-prolog.org
For built-in help, use ?- help(Topic). or ?- apropos(Word).

?- testo_rocks.
well(done)
true.

?- save_rocks.
% autoloading prolog_codewalk:must_be/2 from .../local/git/lib/swipl-7.5.10/library/error
...
% Autoloader: loaded 23 files in 3 iterations in 0.135 seconds
true.

?- save_rocks_null.
% Autoloader: loaded 0 files in 1 iterations in 0.046 seconds
true.

?- ^D
% halt
άμπελος;exec_with_shared% ./test
testo*            testo_rocks*      testo_rocks_null*
άμπελος;reported/17.06.30-exec_with_shared% ./testo_ro
testo_rocks*      testo_rocks_null*
άμπελος;exec_with_shared% ./testo_rocks
ERROR: .../local/git/lib/swipl-7.5.10/pack/rocksdb/prolog/rocksdb.pl:48: Initialization goal raised exception:
ERROR: '$open_shared_object'/3: rocksdb4pl: cannot open shared object file: No such file or directory
ERROR: -g user:testo_rocks: false
άμπελος;reported/17.06.30-exec_with_shared% ./testo_rocks_null
ERROR: ...local/git/lib/swipl-7.5.10/pack/rocksdb/prolog/rocksdb.pl:48: Initialization goal raised exception:
ERROR: '$open_shared_object'/3: rocksdb4pl: cannot open shared object file: No such file or directory

Regards,

Nicos


On Friday, June 30, 2017 at 4:01:13 PM UTC+1, Jan Wielemaker wrote:
On 06/30/2017 04:52 PM, rausm wrote:
> probably not, it's strip thats complaining, my dumb.

And it complains because the file isn't at the place it is claimed to be
found.  Pushed a fix to swipl-devel.git for the qsave library.

        Cheers --- Jan

>
> maybe just symlink it / copy it ?
>
> Dne pátek 30. června 2017 16:48:30 UTC+2 rausm napsal(a):
>
>     [just a guess] Would adding that dir to LD_LIBRARY_PATH help ?
>
> --
> You received this message because you are subscribed to the Google
> Groups "SWI-Prolog" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swi-prolog+...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages