-
Notifications
You must be signed in to change notification settings - Fork 102
Closed
Description
When reading files, I always get the following error:
python3: symbol lookup error: /usr/lib64/swipl-7.2.3/lib/x86_64-linux/readutil.so: undefined symbol: PL_new_atom
How to reproduce
-
Copy the following into
read.plread_file(Filename, Strings) :- setup_call_cleanup( open(Filename, read, Stream), read_stream_string(Stream, Strings), close(Stream) ). read_stream_string(Stream, Strings) :- read_line_to_string(Stream, String), ( String == end_of_file -> Strings = [] ; read_stream_string(Stream, RStrings), Strings = [String|RStrings] ). -
Copy the following to
read.py:from pyswip.prolog import Prolog from pyswip.core import * prolog = Prolog() prolog.consult('read.pl') list(prolog.query('read_file("read.pl", S)')) -
Run
python3 read.py, which will produce the output:python3: symbol lookup error: /usr/lib64/swipl-7.2.3/lib/x86_64-linux/readutil.so: undefined symbol: PL_new_atom
Workaround
PL_new_atom is defined in libswipl.so, but readutil.so is not linked against libswipl. As a workaround, libswipl.so can be LD_PRELOADed:
$ export LD_PRELOAD=/usr/lib64/swipl-7.2.3/lib/x86_64-linux/libswipl.so.7.2.3
$ python3 read.py
After preloading the shared lib, the error disappears (and #9 occurs). This show that this is indeed a problem with linking.
I'm not sure if this is an error on the pyswip side or the swipl side, but I assume if you always load libswipl.so, then the error will disappear.
This is on Fedora 25 with SWi-Prolog 7.2.3.
Metadata
Metadata
Assignees
Labels
No labels