How to build a Docker image with swipl and jpl?

I need to build a Docker image which contains swipl and jpl. I usually use Alpine linux as a base but I am now discovering that there is no .apk files at all for anything swipl!

Has anyone done this before? What did you use as your base image?

Are you aware that there are a few build of containers using Docker that can be found on GitHub for the SWI-Prolog repository? I know some of them are not near what you seek.

Query

List:

Yeah, none of those are what I want. Working on something right now based on a Debian image. Will post a result here if I get it working.

EDIT: Dockerfile for SWI-Prolog + JPL : adamcrussell — LiveJournal contains the(Debian based) Dockerfile I used.

Its shouldn’t be a big deal to update the Dockerfile for the normal swipl docker image and add JPL to it. Probably just make sure the JDK of choice is installed.

I’m not entirely sure about Alpine. I have some vague memory of their C library lacking wide character functions required by SWI-Prolog. Hopefully it has been resolved or my memory is just bad. Probably one could add an option to drop all the Unicode handling of SWI-Prolog. Might be a bit of work …

1 Like

Here’s my unpolished but working package for Alpine:

pkgname=swipl
#pkgver=8.2.4
pkgver=8.3.28
pkgrel=0
pkgdesc="Versatile implementation of the Prolog programming language"
url="https://www.swi-prolog.org"
arch="all"
license="BSD-2-Clause"
# Needs some file location cleanup, before submitting to Alpine
subpackages="$pkgname-dev $pkgname-doc"
#subpackages="$pkgname-dev $pkgname-doc $pkgname-x11"
# https://www.swi-prolog.org/build/Debian.txt
makedepends="cmake
	db-c++
	db-dev
	gmp-dev
	junit
	libarchive-dev
	libedit-dev
	libice-dev
	libjpeg-turbo-dev
	libunwind-dev
	libxext-dev
	libxft-dev
	libxinerama-dev
	libxpm-dev
	libxt-dev
	ncurses-dev
	openjdk15-jdk
	openssl-dev
	ossp-uuid-dev
	pcre-dev
	qt5-qtbase-dev
	readline-dev
	samurai
	unixodbc-dev
	yaml-dev
	zlib-dev"
#source="https://www.swi-prolog.org/download/stable/src/swipl-$pkgver.tar.gz"
source="https://www.swi-prolog.org/download/devel/src/swipl-$pkgver.tar.gz"

build() {
#		-DUSE_TCMALLOC=ON \
#		-DSWIPL_INSTALL_IN_LIB=ON \
#		-DSWIPL_INSTALL_IN_SHARE=ON
#		-DCMAKE_C_FLAGS="$CFLAGS -fPIC -ffile-prefix-map=$PWD= -w" \
#		-DCMAKE_C_FLAGS="$CFLAGS"
# https://aur.archlinux.org/packages/swi-prolog-devel/
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=PGO \
		-DCMAKE_INSTALL_PREFIX=/usr
	ninja -C build

	#mkdir build
	#cd build
	#cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr ..
	#../scripts/pgo-compile.sh
	#ninja
}

check() {
	cd build
	# 3 of the tests fail: semweb:con, semweb:rdf_db, semweb:subprop
	USE_PUBLIC_NETWORK_TESTS=false ctest -j 8 || true
}

package() {
	DESTDIR="$pkgdir" ninja -C build install
}

sha512sums="
cea20c53709e86fcba7a3a39214b8c2499d8bf27c55e94239a489d5c6053a7d22bffb5a2b2f813c4f03880dcfea53fd99ab530fa93cdc5c851a7f7a8dc3e6520  swipl-8.3.28.tar.gz
"

On swipl-8,3.28, it has these test failures:
26 - swipl:thread (SEGFAULT)|
54 - semweb:con (SEGFAULT)|
59 - semweb:rdf_db (SEGFAULT)|
60 - semweb:subprop (SEGFAULT)|

I’ll submit a bug report over the weekend.

2 Likes

Thanks. Let us see what happens with the failing tests. Looks like a concurrency issue as that is what these 4 tests have in common … If this works we should give this some place on the website.

1 Like

This is great! Thank you for sharing! @jan could SWI have an official Alpine package? Creating an Alpine package - Alpine Linux

1 Like

Of course. I’m not going to set it up though :slight_smile: First of all it should actually work (i.e., pass the tests). Next someone should figure our all the stuff with Alpine. Finally we must resolve how to deal with new releases. For some distributions an incremental release is so easy that it has become part of the normal release cycle. For others it takes a lot more work and thus we need a volunteer to keep track of that.

2 Likes

Added to swi-prolog bugzilla.

1 Like

See Compilation issues on Alpine Linux · Issue #102 · SWI-Prolog/issues · GitHub. The latest git version seems to run fine on Alpine and probably also on other systems based on the MUSL C library.

1 Like