Installation on Android/Termux

Hi, one of the six people who use swipl on Android, here. When installing through apt or pkg, I get the following errors:

ERROR: /data/data/com.termux/files/usr/lib/swipl/library/editline.pl:66:
ERROR:    /data/data/com.termux/files/usr/lib/swipl/library/editline.pl:66: Initialization goal raised exception:
ERROR:    dlopen failed: library "libedit.so" not found
ERROR:    In:
ERROR:      [43] throw(error(shared_object(open,'dlopen failed: library "libedit.so" not found'),context(...,_7634)))
ERROR:      [41] <meta call>
ERROR:      [40] with_mutex('$foreign',load_foreign_library(foreign(libedit4pl),editline,default(install))) <foreign>
ERROR:      [37] '$run_init_goal'(shlib:load_foreign_library(...)) at /home/builder/.termux-build/swi-prolog/build/home/boot/init.pl:686
ERROR:      [36] catch(system:'$run_init_goal'(...),_7772,system:'$initialization_error'(_7794,...,...)) at /home/builder/.termux-build/swi-prolog/build/home/boot/init.pl:457
ERROR:      [35] catch_with_backtrace(system:'$run_init_goal'(...),_7830,system:'$initialization_error'(_7852,...,...)) at /home/builder/.termux-build/swi-prolog/build/home/boot/init.pl:506
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.
ERROR: Exported procedure editline:el_read_history/2 is not defined
ERROR: Exported procedure editline:el_write_history/2 is not defined
ERROR: Exported procedure editline:el_add_history/2 is not defined
ERROR: Exported procedure editline:el_addfn/4 is not defined
ERROR: Exported procedure editline:el_history/2 is not defined
ERROR: Exported procedure editline:el_deletestr/2 is not defined
ERROR: Exported procedure editline:el_insertstr/2 is not defined
ERROR: Exported procedure editline:el_line/2 is not defined
ERROR: Exported procedure editline:el_cursor/2 is not defined
ERROR: Exported procedure editline:el_history_events/2 is not defined
ERROR: Exported procedure editline:el_wrapped/1 is not defined
ERROR: Exported procedure editline:el_unwrap/1 is not defined
ERROR: Exported procedure editline:el_wrap/4 is not defined
ERROR: Exported procedure editline:el_source/2 is not defined
ERROR: Exported procedure editline:el_bind/2 is not defined
ERROR: [Thread 1]: exception handler failed to define editline:el_wrapped/1
   Exception: (27) editline:el_wrapped(user_input) ? abort
Warning: Execution Aborted
% Execution Aborted

When installing from the curl command on the website, I get this:

CANNOT LINK EXECUTABLE "swipl": library "libswipl.so" not found

Any way to fix this from my end? And could we get a fix pushed?

Hello, I have the same problem when When installing from the curl command on the website. My session follows, in case it helps. Thanks.

$ curl  https://raw.githubusercontent.com/erlanger/swipl-termux/master/install -sSf | sh
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'ossp-uuid' instead of './ossp-uuid_1.6.2-2_aarch64.deb'
The following NEW packages will be installed:
  ossp-uuid
0 upgraded, 1 newly installed, 0 to remove and 24 not upgraded.
Need to get 0 B/22.2 kB of archives.
After this operation, 106 kB of additional disk space will be used.
Get:1 /data/data/com.termux/files/home/deb.24730/ossp-uuid_1.6.2-2_aarch64.deb ossp-uuid aarch64 1.6.2-2 [22.2 kB]
Selecting previously unselected package ossp-uuid.
(Reading database ... 3469 files and directories currently installed.)
Preparing to unpack .../ossp-uuid_1.6.2-2_aarch64.deb ...
Unpacking ossp-uuid (1.6.2-2) ...
Setting up ossp-uuid (1.6.2-2) ...
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'swi-prolog' instead of './swi-prolog_8.1.3-1_aarch64.deb'
The following additional packages will be installed:
  libarchive libjpeg-turbo libxml2 libyaml ncurses-ui-libs
The following NEW packages will be installed:
  libarchive libjpeg-turbo libxml2 libyaml ncurses-ui-libs swi-prolog
0 upgraded, 6 newly installed, 0 to remove and 25 not upgraded.
Need to get 1527 kB/4181 kB of archives.
After this operation, 29.7 MB of additional disk space will be used.
Get:1 /data/data/com.termux/files/home/deb.24730/swi-prolog_8.1.3-1_aarch64.deb swi-prolog aarch64 8.1.3-1 [2654 kB]
Get:2 https://termux.mentality.rip/termux-packages-24 stable/main aarch64 libxml2 aarch64 2.9.10-4 [827 kB]
Get:3 https://termux.mentality.rip/termux-packages-24 stable/main aarch64 libarchive aarch64 3.5.0 [364 kB]
Get:4 https://termux.mentality.rip/termux-packages-24 stable/main aarch64 libjpeg-turbo aarch64 2.0.6 [262 kB]
Get:5 https://termux.mentality.rip/termux-packages-24 stable/main aarch64 libyaml aarch64 0.2.5-4 [43.8 kB]
Get:6 https://termux.mentality.rip/termux-packages-24 stable/main aarch64 ncurses-ui-libs aarch64 6.2.20200725 [29.2 kB]
Fetched 1527 kB in 1s (1005 kB/s)
Selecting previously unselected package libxml2.
(Reading database ... 3474 files and directories currently installed.)
Preparing to unpack .../0-libxml2_2.9.10-4_aarch64.deb ...
Unpacking libxml2 (2.9.10-4) ...
Selecting previously unselected package libarchive.
Preparing to unpack .../1-libarchive_3.5.0_aarch64.deb ...
Unpacking libarchive (3.5.0) ...
Selecting previously unselected package libjpeg-turbo.
Preparing to unpack .../2-libjpeg-turbo_2.0.6_aarch64.deb ...
Unpacking libjpeg-turbo (2.0.6) ...
Selecting previously unselected package libyaml.
Preparing to unpack .../3-libyaml_0.2.5-4_aarch64.deb ...
Unpacking libyaml (0.2.5-4) ...
Selecting previously unselected package ncurses-ui-libs.
Preparing to unpack .../4-ncurses-ui-libs_6.2.20200725_aarch64.deb ...
Unpacking ncurses-ui-libs (6.2.20200725) ...
Selecting previously unselected package swi-prolog.
Preparing to unpack .../5-swi-prolog_8.1.3-1_aarch64.deb ...
Unpacking swi-prolog (8.1.3-1) ...
Setting up libyaml (0.2.5-4) ...
Setting up ncurses-ui-libs (6.2.20200725) ...
Setting up libjpeg-turbo (2.0.6) ...
Setting up libxml2 (2.9.10-4) ...
Setting up libarchive (3.5.0) ...
Setting up swi-prolog (8.1.3-1) ...
$ swipl
CANNOT LINK EXECUTABLE "swipl": library "libswipl.so" not found

The information at SWI-Prolog on Android Termux seems to be outdated. Termux now provides SWI-Prolog in the official package repositories, so there’s no need to use a custom install script - you can just run apt install swi-prolog (or pkg install swi-prolog, makes no difference). This will also give you a more up-to-date version than the install script from the GitHub page.

Thank you. Someone kindly put 3 code-fences bash. in the front of the session and 3 code-fences at the end so now it looks nice. I have now read When posting using mail, please use markdown, although I think examples, such as for inline code, would help in that post. Hard to exactly understand without examples.

I updated the noted post.

For those not reading the updated post for markdown examples for code see Language highlighting

Thanks, that will help everybody.

Great- thank you! With SWIPL now being in the termux package repositories, it is easy for a beginner like me to run it on Android. On the Google Play Store could there be an app, or at least a “documentation” page to inform people that SWIPL runs on Android?

And do you think we should post an issue at https://github.com/SWI-Prolog/swipl/issues to request the documentation be updated? For example,

  1. at https://www.swi-prolog.org/build/Termux.md the instructions using curl apparently fail. It currently says "Hopefully SWI-Prolog for Android will be officially added to the termux package repositories…When that is done, you can simply run

pkg install swi-prolog"

but of course now that has been done.

  1. At https://www.swi-prolog.org/Download.html and https://www.swi-prolog.org/ it would be nice to clearly point to both the above termux page and the https://www.swi-prolog.org/build/linuxonandroid.html page.

By the way, if you install Linux alongside Android you can “run the HTTP services and thus develop HTML5 apps that run entirely on your Android”. I guess there is no way to do that if using the termux interpreter, is there?

1 Like

I guess markdown is by now so widely used everywhere on the internet that there is an expectation that naming it is enough. Not very beginner friendly.

Thanks. Updated the termux page and added some links to make finding it easier.

1 Like

Thank you sir. When you have time, you might want to modify the “future” section at https://www.swi-prolog.org/build/Termux.html , which still says "Hopefully SWI-Prolog for Android will be officially added to the termux package repositories…When that is done, you can simply run

pkg install swi-prolog".

Missed the future section. Removed as the start already states how to install the pack. Hope it is what you want. If not, please may a PR for the plweb-www repo. That is were the static pages of the website are stored.

Yes, that’s good, thanks. Learning how to use github is on my list :slight_smile: