Current status of SWI-Prolog with RocksDB packages installed using MSYS2

This works, thank you very much. :clap:


When I orginally did this I did not follow the insturctions correctly and entered y for Yes when asked to build SWI-Prolog RocksDB package which resulted in an error.

pack_install(rocksdb). resulted in ERROR: Unknown platform!

What was interesting was that the location of the SWI-Prolog packages for MSYS2 were /c/users/groot/appdata/local/swi-prolog/pack/rocksdb (which is a Windows directory and not a MSYS2 specific directory), I would have expected a subdirectory of C:\msys64\home\groot (which is a MSYS2 specific directory) which in MSYS2 would be ~.


Details (Click triangle to expand)

Using MSYS2

image

start

image

Change to working directory

Groot@Galaxy MINGW64 ~
$ cd ~/Projects/SWI-Prolog with RocksDB

Update SWI-Prolog and RocksDB packages using pacman

Groot@Galaxy MINGW64 ~/Projects/SWI-Prolog with RocksDB
$ pacman -S mingw-w64-x86_64-rocksdb mingw-w64-x86_64-swi-prolog
Click triangle for console ouptut
warning: mingw-w64-x86_64-rocksdb-7.9.2-1 is up to date -- reinstalling
warning: mingw-w64-x86_64-swi-prolog-9.0.4-1 is up to date -- reinstalling
resolving dependencies...
looking for conflicting packages...

Packages (2) mingw-w64-x86_64-rocksdb-7.9.2-1  mingw-w64-x86_64-swi-prolog-9.0.4-1

Total Installed Size:  55.42 MiB
Net Upgrade Size:       0.00 MiB

:: Proceed with installation? [Y/n] Y
(2/2) checking keys in keyring                                                                                                                                     [####################################################################################################] 100%
(2/2) checking package integrity                                                                                                                                   [####################################################################################################] 100%
(2/2) loading package files                                                                                                                                        [####################################################################################################] 100%
(2/2) checking for file conflicts                                                                                                                                  [####################################################################################################] 100%
(2/2) checking available disk space                                                                                                                                [####################################################################################################] 100%
:: Processing package changes...
(1/2) reinstalling mingw-w64-x86_64-rocksdb                                                                                                                        [####################################################################################################] 100%
(2/2) reinstalling mingw-w64-x86_64-swi-prolog                                                                                                                     [####################################################################################################] 100%

Verify installation directory of SWI-Prolog

Groot@Galaxy MINGW64 ~/Projects/SWI-Prolog with RocksDB
$ which swipl
/mingw64/bin/swipl

Verify that SWI-Prolog runs

Groot@Galaxy MINGW64 ~/Projects/SWI-Prolog with RocksDB
$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.4)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

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

1 ?-

Uninstall SWI-Prolog RocksDB package.

1 ?- pack_remove(rocksdb).
% Removing 'c:/users/groot/appdata/local/swi-prolog/pack/rocksdb' and contents
true.

Install SWi-Prolog RocksDB package.

2 ?- pack_install(rocksdb).
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
Install rocksdb@0.12.0 from GIT at https://github.com/JanWielemaker/rocksdb.git Y/n? Y
% Cloning into '/c/users/groot/appdata/local/swi-prolog/pack/rocksdb'...
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
% "rocksdb.git" was downloaded 5 times
Package:                rocksdb
Title:                  SWI-Prolog interface to RocksDB
Installed version:      0.12.0
Author:                 Jan Wielemaker <jan@swi-prolog.org>
Maintainer:             Jan Wielemaker <jan@swi-prolog.org>
Packager:               Jan Wielemaker <jan@swi-prolog.org>
Home page:              https://github.com/JanWielemaker/rocksdb
Download URL:           https://github.com/JanWielemaker/rocksdb.git
Run post installation scripts for pack "rocksdb" Y/n?
ERROR: Submodule 'rocksdb' (https://github.com/facebook/rocksdb) registered for path 'rocksdb'
ERROR: Cloning into '/c/users/groot/appdata/local/swi-prolog/pack/rocksdb/rocksdb'...
ERROR: Unknown platform!
ERROR: Unknown platform!
Click triangle for rest of ouptut
ERROR: In file included from ./cache/lru_cache.h:14,
ERROR:                  from cache/cache.cc:12:
ERROR: ./cache/sharded_cache.h:125:11: error: 'port' does not name a type
ERROR:   125 |   mutable port::Mutex capacity_mutex_;
ERROR:       |           ^~~~
ERROR: In file included from ./cache/lru_cache.h:20:
ERROR: ./util/distributed_mutex.h:43:16: error: 'port' does not name a type
ERROR:    43 | using DMutex = port::Mutex;
ERROR:       |                ^~~~
ERROR: ./util/distributed_mutex.h:44:25: error: 'lock_guard' in namespace 'std' does not name a template type
ERROR:    44 | using DMutexLock = std::lock_guard<DMutex>;
ERROR:       |                         ^~~~~~~~~~
ERROR: ./util/distributed_mutex.h:1:1: note: 'std::lock_guard' is defined in header '<mutex>'; did you forget to '#include <mutex>'?
ERROR:   +++ |+#include <mutex>
ERROR:     1 | //  Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
ERROR: ./cache/lru_cache.h:334:33: error: expected initializer before 'LRUCacheShard'
ERROR:   334 | class ALIGN_AS(CACHE_LINE_SIZE) LRUCacheShard final : public CacheShard {
ERROR:       |                                 ^~~~~~~~~~~~~
ERROR: ./cache/lru_cache.h:555:3: error: 'LRUCacheShard' does not name a type; did you mean 'CacheShard'?
ERROR:   555 |   LRUCacheShard* shards_ = nullptr;
ERROR:       |   ^~~~~~~~~~~~~
ERROR:       |   CacheShard
ERROR: ./cache/lru_cache.h:564:34: error: 'LRUCacheShard' in namespace 'rocksdb::lru_cache' does not name a type; did you mean 'LRUCache'?
ERROR:   564 | using LRUCacheShard = lru_cache::LRUCacheShard;
ERROR:       |                                  ^~~~~~~~~~~~~
ERROR:       |                                  LRUCache
ERROR: In file included from ./util/coding.h:24,
ERROR:                  from ./cache/cache_reservation_manager.h:24,
ERROR:                  from cache/cache_reservation_manager.cc:9:
ERROR: ./util/coding_lean.h: In function 'void rocksdb::EncodeFixed16(char*, uint16_t)':
ERROR: ./util/coding_lean.h:25:7: error: 'port' has not been declared
ERROR:    25 |   if (port::kLittleEndian) {
ERROR:       |       ^~~~
ERROR: ./util/coding_lean.h: In function 'void rocksdb::EncodeFixed32(char*, uint32_t)':
ERROR: ./util/coding_lean.h:34:7: error: 'port' has not been declared
ERROR:    34 |   if (port::kLittleEndian) {
ERROR:       |       ^~~~
ERROR: ./util/coding_lean.h: In function 'void rocksdb::EncodeFixed64(char*, uint64_t)':
ERROR: ./util/coding_lean.h:45:7: error: 'port' has not been declared
ERROR:    45 |   if (port::kLittleEndian) {
ERROR:       |       ^~~~
ERROR: ./util/coding_lean.h: In function 'uint16_t rocksdb::DecodeFixed16(const char*)':
ERROR: ./util/coding_lean.h:63:7: error: 'port' has not been declared
ERROR:    63 |   if (port::kLittleEndian) {
ERROR:       |       ^~~~
ERROR: ./util/coding_lean.h: In function 'uint32_t rocksdb::DecodeFixed32(const char*)':
ERROR: ./util/coding_lean.h:75:7: error: 'port' has not been declared
ERROR:    75 |   if (port::kLittleEndian) {
ERROR:       |       ^~~~
ERROR: ./util/coding_lean.h: In function 'uint64_t rocksdb::DecodeFixed64(const char*)':
ERROR: ./util/coding_lean.h:89:7: error: 'port' has not been declared
ERROR:    89 |   if (port::kLittleEndian) {
ERROR:       |       ^~~~
ERROR: ./util/coding.h: In function 'void rocksdb::PutFixed16(std::string*, uint16_t)':
ERROR: ./util/coding.h:123:7: error: 'port' has not been declared
ERROR:   123 |   if (port::kLittleEndian) {
ERROR:       |       ^~~~
ERROR: ./util/coding.h: In function 'void rocksdb::PutFixed32(std::string*, uint32_t)':
ERROR: ./util/coding.h:134:7: error: 'port' has not been declared
ERROR:   134 |   if (port::kLittleEndian) {
ERROR:       |       ^~~~
ERROR: ./util/coding.h: In function 'void rocksdb::PutFixed64(std::string*, uint64_t)':
ERROR: ./util/coding.h:145:7: error: 'port' has not been declared
ERROR:   145 |   if (port::kLittleEndian) {
ERROR:       |       ^~~~
ERROR: make[1]: *** [Makefile:2529: cache/cache_reservation_manager.o] Error 1
ERROR: make[1]: *** Waiting for unfinished jobs....
ERROR: make[1]: *** [Makefile:2529: cache/cache.o] Error 1
ERROR: make: *** [Makefile:30: rocksdb/librocksdb.a] Error 2
% git submodule update --init rocksdb
% Submodule path 'rocksdb': checked out 'eb9a80fe1f18017b4d7f4084e8f2554f12234822'
% ROCKSDB_DISABLE_JEMALLOC=1 ROCKSDB_DISABLE_TCMALLOC=1 /usr/bin/make -j4 -C rocksdb static_lib EXTRA_CXXFLAGS=-fPIC EXTRA_CFLAGS=-fPIC USE_RTTI=1 DEBUG_LEVEL=0
% make[1]: Entering directory '/c/users/groot/appdata/local/swi-prolog/pack/rocksdb/rocksdb'
% $DEBUG_LEVEL is 0
% $DEBUG_LEVEL is 0
%   CC       cache/cache.o
%   CC       cache/cache_entry_roles.o
%   CC       cache/cache_key.o
%   CC       cache/cache_reservation_manager.o
% make[1]: Leaving directory '/c/users/groot/appdata/local/swi-prolog/pack/rocksdb/rocksdb'
ERROR: Process "process(c:/msys64/usr/bin/make.exe,[])": exit status: 2
ERROR: In:
ERROR:   [25] throw(error(process_error(...,...),_91686))
ERROR:   [21] build_tools:build_step(build,_91730{env:[...|...],git:true,inquiry:true,pack:rocksdb,pack_version:1,src_dir:'c:/users/groot/appdata/local/swi-prolog/pack/rocksdb',url:'https://github.com/JanWielemaker/rocksdb.git'},_91730{bin_dir:'c:/users/groot/appdata/local
/swi-prolog/pack/rocksdb',env:[...|...],git:true,inquiry:true,pack:rocksdb,pack_version:1,src_dir:'c:/users/groot/appdata/local/swi-prolog/pack/rocksdb',url:'https://github.com/JanWielemaker/rocksdb.git'}) at c:/msys64/mingw64/lib/swipl/library/build/tools.pl:110
ERROR:   [20] apply:foldl_([build,...|...],build_tools:build_step,_91730{env:[...|...],git:true,inquiry:true,pack:rocksdb,pack_version:1,src_dir:'c:/users/groot/appdata/local/swi-prolog/pack/rocksdb',url:'https://github.com/JanWielemaker/rocksdb.git'},_91842) at c:/msys64
/mingw64/lib/swipl/library/apply.pl:316
ERROR:   [16] build_tools:build_steps([[dependencies],...|...],'c:/users/groot/appdata/local/swi-prolog/pack/rocksdb',[pack_version(1),...|...]) at c:/msys64/mingw64/lib/swipl/library/build/tools.pl:103
ERROR:   [15] prolog_pack:post_install_foreign(rocksdb,'c:/users/groot/appdata/local/swi-prolog/pack/rocksdb','<garbage_collected>') at c:/msys64/mingw64/lib/swipl/library/prolog_pack.pl:1173
ERROR:   [14] prolog_pack:pack_post_install(rocksdb,'c:/users/groot/appdata/local/swi-prolog/pack/rocksdb',[git(true),...|...]) at c:/msys64/mingw64/lib/swipl/library/prolog_pack.pl:1111
ERROR:    [9] toplevel_call('<garbage_collected>') at c:/msys64/mingw64/lib/swipl/boot/toplevel.pl:1173
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.
   Exception: (21) build_tools:build_step(build, _130{env:['PATH'='.;C:\\msys64\\mingw64\\bin;C:\\msys64\\usr\\local\\bin;C:\\msys64\\usr\\bin;C:\\msys64\\usr\\bin;C:\\Windows\\System32;C:\\Windows;C:\\Windows\\System32\\Wbem;C:\\Windows\\System32\\WindowsPowerShell\\v1.
0\\;C:\\msys64\\usr\\bin\\site_perl;C:\\msys64\\usr\\bin\\vendor_perl;C:\\msys64\\usr\\bin\\core_perl', 'SWIPL'='C:\\msys64\\mingw64\\lib\\swipl\\bin\\x64-win64\\swipl.exe', 'SWIPL_PACK_VERSION'=1, 'SWIPLVERSION'=90004, 'SWIHOME'='c:/msys64/mingw64/lib/swipl', ... = ...|
...], git:true, inquiry:true, pack:rocksdb, pack_version:1, src_dir:'c:/users/groot/appdata/local/swi-prolog/pack/rocksdb', url:'https://github.com/JanWielemaker/rocksdb.git'}, _6794) ?

I am not surprised by this result. A few years ago when I first started using SWI-Prolog packages, many that were not pure Prolog and relied on the OS in some form only worked for Linux, thus my journey into using WSL with SWI-Prolog to run such packages.


Answering with n for No this time.

Details (Click triangle to expand)
1 ?- pack_remove(rocksdb).
% Removing 'c:/users/groot/appdata/local/swi-prolog/pack/rocksdb' and contents
true.

2 ?- pack_install(rocksdb).
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
Install rocksdb@0.12.0 from GIT at https://github.com/JanWielemaker/rocksdb.git Y/n?
% Cloning into '/c/users/groot/appdata/local/swi-prolog/pack/rocksdb'...
% Contacting server at https://www.swi-prolog.org/pack/query ... ok
% "rocksdb.git" was downloaded 7 times
Package:                rocksdb
Title:                  SWI-Prolog interface to RocksDB
Installed version:      0.12.0
Author:                 Jan Wielemaker <jan@swi-prolog.org>
Maintainer:             Jan Wielemaker <jan@swi-prolog.org>
Packager:               Jan Wielemaker <jan@swi-prolog.org>
Home page:              https://github.com/JanWielemaker/rocksdb
Download URL:           https://github.com/JanWielemaker/rocksdb.git
Run post installation scripts for pack "rocksdb" Y/n?   <===  Press n for No here.
false.

3 ?- halt.
Groot@Galaxy MINGW64 ~
$ cd "/c/Users/Groot/AppData/Local/swi-prolog/pack/rocksdb"

Groot@Galaxy MINGW64 /c/Users/Groot/AppData/Local/swi-prolog/pack/rocksdb
$ tree
.
β”œβ”€β”€ Makefile
β”œβ”€β”€ README.md
β”œβ”€β”€ cpp
β”‚   └── rocksdb4pl.cpp
β”œβ”€β”€ demo
β”‚   └── merge.pl
β”œβ”€β”€ pack.pl
β”œβ”€β”€ prolog
β”‚   └── rocksdb.pl
β”œβ”€β”€ rocksdb
└── test
    └── test_rocksdb.pl

5 directories, 7 files

Groot@Galaxy MINGW64 /c/Users/Groot/AppData/Local/swi-prolog/pack/rocksdb
$ g++ -shared -D__SWI_PROLOG__ -I/mingw64/lib/swipl/include cpp/rocksdb4pl.cpp /mingw64/lib/librocksdb.a -L/mingw64/lib/swipl/lib/x64-win64 -lswipl -lsnappy -lzstd -lz -llz4 -lbz2 -lshlwapi -lrpcrt4 -o lib/x64-win64/rocksdb4pl.dll

Groot@Galaxy MINGW64 /c/Users/Groot/AppData/Local/swi-prolog/pack/rocksdb
$ tree
.
β”œβ”€β”€ Makefile
β”œβ”€β”€ README.md
β”œβ”€β”€ cpp
β”‚   └── rocksdb4pl.cpp
β”œβ”€β”€ demo
β”‚   └── merge.pl
β”œβ”€β”€ lib
β”‚   └── x64-win64
β”‚       └── rocksdb4pl.dll
β”œβ”€β”€ pack.pl
β”œβ”€β”€ prolog
β”‚   └── rocksdb.pl
β”œβ”€β”€ rocksdb
└── test
    └── test_rocksdb.pl

7 directories, 8 files
Groot@Galaxy MINGW64 /c/Users/Groot/AppData/Local/swi-prolog/pack/rocksdb
$ swipl
...

1 ?- use_module(library(rocksdb)).
true.

2 ?- rocks_open(".", R, []), rocks_put(R, app, noot), rocks_get(R, app, Noot), rocks_close(R).
R = <rocksdb>(0000026ad2bba590),
Noot = noot.

Actually, I wrote to respond with β€œno” to this particular step, see above. Then,

?- halt.
$ cd /c/Users/matth/AppData/Local/swi-prolog/pack/rocksdb

[or whereever the rocksdb sources are located. This location needs to fixed at some point, you’re right. Maybe I’ll use something similar to the Linux place.]

Moving on,

$ mkdir lib
$ mkdir lib/x64-win64
$ g++ -shared -D__SWI_PROLOG__ -I/mingw64/lib/swipl/include cpp/rocksdb4pl.cpp /mingw64/lib/librocksdb.a -L/mingw64/lib/swipl/lib/x64-win64 -lswipl -lsnappy -lzstd -lz -llz4 -lbz2 -lshlwapi -lrpcrt4 -o lib/x64-win64/rocksdb4pl.dll
$ swipl
?- use_module(library(rocksdb)).
true.
?- rocks_open(".", R, []), rocks_put(R, aap, noot), rocks_get(R, aap, Noot), rocks_close(R).
R = <rocksdb>(000001d01ada5c50),
Noot = noot.
```
1 Like

My mistake, thanks for noting.


Completed correctly following instructions and noted in earlier post. :slightly_smiling_face:

I am wondering if one should β€œfork” the rocksdb pack for a light version without rocksdb sources. From the MSYS2 sources of rocksdb, I can see that RTTI information is included, but I don’t know about PIC.

It is a git submodule. The build process can decide whether or not to checkout the submodule. I thought Windows doesn’t do PIC, but possibly that has changed. Surely old Windows loads DLL files into memory per process and relocates them in the process. As opposed to POSIX systems that map a fully read-only file into memory, where each process using the library map the same file, but possibly to different locations. As a result, multiple processes run from the same physical memory but mapped at different locations in virtual memory and thus the code must run regardless of the absolute memory addresses (Position Independent Code).

If it is a DLL and uses RTTI it should work.

Now that the package rocksdb is working with MSYS2, the next step is to get the package library rocks-preds working. However it is proving to be quite a challenge as some of the code needs to work only for prolog flags for msys2, some of the code works for windows and setting the package up for use with use_module/2 and file_search_path/2 are not working as expected.

From what I understand the test for the Windows version are done using Wine so are not done on Windows and then MSYS2 running on Windows is more of a streach, so it seems logical that testing for MSYS2 is more of hope it works and let us know when it doesn’t, is this correct?

Also the trick of just putting gtrace into the code and running does not work as MSYS2 has no GUI attached. :frowning_face:

That is the modified Makefile (specific for MSYS2)

CPPFLAGS=-Wall -Wextra -Wsign-compare -Wshadow -Wunused-parameter -Woverloaded-virtual -Wnon-virtual-dtor -Wno-missing-field-initializers -Wno-invalid-offsetof $(ADDED_CPPFLAGS) -std=c++17 -O2 $(CFLAGS) $(COFLAGS)

SOBJ=   $(PACKSODIR)/rocksdb.$(SOEXT)

all:    $(SOBJ)

OBJ=    cpp/rocksdb4pl.o

$(SOBJ): $(OBJ)
        mkdir -p $(PACKSODIR)
        $(CXX) $(LDSOFLAGS) -o $@ $(OBJ) $(SWISOLIB) -l:librocksdb.a -lsnappy -lzstd -lz -llz4 -lbz2 -lshlwapi -lrpcrt4

install::

clean:
        rm -f $(OBJ)

distclean: clean
        rm -f $(SOBJ)

check:
        $(SWIPL) $(PLPATHS) -g test_rocksdb -t halt test/test_rocksdb.pl

I am afraid I don’t know how to make it work across platforms.

What is rocks-preds mentioned above? It does not seem to be a prolog pack, for example, there isn’t any pack.pl

I seriously thought you knew about this. It is the icing on the cake, the final peice that makes all of the other work worth the effort.

It expands the heap storage past just memory to using file storage. In other words if you want to have a few terbytes of predicates active, which obviously don’t fit into memory, then with RocksDB, the SWI-Prolog rocksdb package and SWI-Prolog rocksdb-predictes package you can just start creating large amonts of predicates. AFAIK it has only been tested with facts, no clauses with bodies, but the ground work was put in place into rockdb-predicates to do this.

I pushed it to 60.01 GB (ref) which was way past the 16GB of memory on my machine. But that only worked on Ubuntu on WSL on Windows, it was not on Windows native which is what I am after because that is what many companies use at the user level.

It is not aviable via the normal means as it is currently a prototype created by Jan W and is located in his GitHub repository only.

The way it is suppose to load is with a Git URL but the - in the URL seems to be a problem.

pack_install('https://github.com/JanWielemaker/rocks-predicates.git').

Note: rocks-predicates is not a proper package so will not work with pack_install/1. In the future it might become a package but for now it is just a library.

I ran into a few other problems today because of it and just had to walk away out of frustraion to work on it more tommorow. However on the ChatGPT side of problem solving am making some really intresting progress but since it does not currenlty relate to SWI-Prolog it is not noted here, nor anywhere else at the moment.

No, sorry, I only have limited ideas on the package, I was just passing by and saw a problem lying around :slightly_smiling_face:

Maybe @jan can comment on this. To me it does not seem to be a typical pack, lacking a pack.pl

pack_install('https://github.com/JanWielemaker/rocks-predicates.git').

So this will probably not work.

The pack does work. As noted, it worked when used with Ubuntu, which I used on Ubuntu on WSL on Windows.

I don’t see anything stopping me from getting that pack to work with MSYS2, other than as I noted, there seem to be many places where subtle changes need to be made, such as:

current_prolog_flag(msys2, true)

Getting the pack to install correctly is something I plan to do by hand copying and modifying as needed, such as removing the - in the name and possibly adding a prolog.pl file.

Could you elaborate? I just installed rocksdb on Ubuntu, then

?- pack_install('https://github.com/JanWielemaker/rocks-predicates.git').
ERROR: Domain error: `pack_name' expected, found `'rocks-predicates''`

The last public detailed instructions for using the SWI-Prolog package library rocks-predicates on Ubuntu that I posted is here

This did not use
pack_install('https://github.com/JanWielemaker/rocks-predicates.git').
but instead
git clone https://github.com/JanWielemaker/rocks-predicates.git

Now that I just reread the posted instructions from many months ago I did not use that as it probably did not work then either as it is a library and not a package.

Here is where using pack_install/1 with a Git URL did work as expected.

?- pack_install('https://github.com/JanWielemaker/rocksdb.git').

With MSYS2, Ctrl-D and Ctrl-Z do not work as expected.

One not so common but useful use case with SWI-Prolog at the top level is to use the pseudo file user (ref) which is normally exited with Ctrl-D or Ctrl-Z, however on MSYS2 that does not work so one must use the predicate end_of_file/0. :slightly_smiling_face:

Groot@Galaxy MINGW64 ~
$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.4)
SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software.
Please run ?- license. for legal details.

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

1 ?- [user].
|: ^D
.

ERROR: user://1:8:3: Syntax error: illegal_character
|: ^Z
.

ERROR: user://1:12:3: Syntax error: illegal_character
|: end_of_file.

% user://1 compiled 0.00 sec, 0 clauses
true.

2 ?-

Maybe should rename the repo …

While I am not a SWI-Prolog package expert I suspect that as @mgondan1 is noting, it is missing prolog.pl and renaming will just lead to another error. At present I am only aware of the 4 of us working with it and we seem to know how to avoid the mines in the minefield so no real rush for only the name change.

Right. It is simply not a package in its current form. It was merely a proof of concept. @peter.ludemann has big plans with it :slight_smile:

1 Like

With that in mind I really need to stop refering to it as a SWI-Prolog package, does library or module make more sense? In the description you call it a library but I think of a library as something that can be found like

:- use_module(library(XYZ)).

and for that to work here the alias library needs to be amended

user:file_search_path(library, 'c:/users/groot/.../rocks-predicates').

:- use_module(library(rocks_preds)).

All right.

c7201178@PC105-C720 UCRT64 ~
$ git clone https://github.com/JanWielemaker/rocks-predicates.git
Cloning into 'rocks-predicates'...
...
Resolving deltas: 100% (49/49), done.

c7201178@PC105-C720 UCRT64 ~
$ swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 9.0.4)
...

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

?- assert(user:file_search_path(library, 'c:/msys64/home/c7201178/rocks-predicates')).
true.

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

It is, at least, not complaining. What is next?

The details are here.

Just like any other data base you have to use open and close predicates which are often best used with setup_call_cleanup/3.

    setup_call_cleanup(
        rdb_open(Rocksdb_directory,RocksDB),
        load_records,
        rdb_close(RocksDB)
    )

After that it is pretty much the same as regular Prolog. Just don’t abort out without using rdb_close/1 as it leaves the RocksDB in an inconsistent state. It can be fixed but I can’t recall the details off the top of my head any more but it is something you definatly want to avoid.

The code is only a proof of concept so much is missing and none of it is optimized.

If you get that working then you are at the same place as the other 3 of us (Jan, Peter and myslef).

All right, thanks! I’ll close this case now, concluding that it is possible to use the rocksdb under msys2. And maybe I can come back once I have a big knowledge base of predicates, looking forward to see it live.

To make the installation a bit more user-friendly,

  • we could add a little cmake file to rocksdb that distinguishes a bit between Windows and the Unix systems
  • we could add the rocks-predicates to rocksdb (?)