SWI-Prolog on Android

216 views
Skip to first unread message

Mikhail Zemlyanukha

unread,
Oct 7, 2014, 5:06:29 PM10/7/14
to swi-p...@googlegroups.com
Hello all,

Will you please let me know current status of this port? I read at stackoverflow that there was some work in that direction: http://stackoverflow.com/a/18360924/1028256 but the link there is broken now ((

Thanks in advance,
Mike

Mikhail Zemlyanukha

unread,
Oct 7, 2014, 5:36:22 PM10/7/14
to swi-p...@googlegroups.com
OK, I have found that info: http://www.swi-prolog.org/build/linuxonandroid.txt

I'd like to call SWIPL from Java code via JNI, and I think SWIPL should be compiled with NDK, Linux-On-Android solutions won't do. Am I correct?

Regards,
Mike

--
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.
Visit this group at http://groups.google.com/group/swi-prolog.
For more options, visit https://groups.google.com/d/optout.

Jan Wielemaker

unread,
Oct 8, 2014, 3:19:29 AM10/8/14
to Mikhail Zemlyanukha, swi-p...@googlegroups.com
On 10/07/2014 11:36 PM, Mikhail Zemlyanukha wrote:
> OK, I have found that
> info: http://www.swi-prolog.org/build/linuxonandroid.txt
>
> I'd like to call SWIPL from Java code via JNI, and I think SWIPL should
> be compiled with NDK, Linux-On-Android solutions won't do. Am I correct?

I'm not an Android expert, but I think you are right. Compiling with
NDK is probably quite feasible though. I assume it is mainly fiddling
with the build environment. I'm don't know what C library is present
for NDK. A quick search reveals
http://en.wikipedia.org/wiki/Bionic_%28software%29,
which contains a few alarming remarks:

- "Bionic does not include wide character support"
- "Some functions within Bionic's POSIX and system call headers are stubs
or wrappers for Android-specific behavior, causing unintended behavior
in some instances."

I think you can get away with a few stubs to get enough wide character
support to make the system compile. SWI-Prolog has its own support for
UTF-8. It uses the wide-character copy, compare, strlen, etc. routines,
but it is easy to provide these. It uses multibyte<->unicode routines
for dealing with the current locale and the character classification
routines for char_type/2. The parser is based on internal classification
tables.

I don't know what the second point is. SWI-Prolog doesn't use anything
fancy from the C library. The only critical area is the thread support,
notably the interaction between threads and signals is sometimes a bummer
(happened on NetBSD. Don't know the current status).

That said, JPL (the Java interface) is also problematic on many platforms,
both to get configured right and to avoid signal interaction issues. It
is often possible to get a specific JVM on a specific OS configured
correctly, but it requires some work.

Cheers --- Jan

Jan Wielemaker

unread,
Oct 8, 2014, 3:21:58 AM10/8/14
to Mikhail Zemlyanukha, swi-p...@googlegroups.com
Bummer. I deleted the old mailinglist. There was an option to keep
or delete the archives. I selected to keep it, but apparently that
didn't happen :-(

Cheers --- Jan
Reply all
Reply to author
Forward
0 new messages