Problems compiling Rocksdb

Hi, I am having trouble compiling the rocksdb-module on Linux.

I get pretty many of these errors: error: conversion from ‘PlTerm’ to ‘bool’ is ambiguous

Swipl version is 8.4.3 and gcc version is 12.1.1 - any clues?



On 07/10/2022 was able to build RocksDB pack with rocks-predicates and recorded the exact commits.

See this post and click triangle to expand personal notes to see the commits.
(Duplicated below)

OS: Ubuntu 22.04 LTS
SWI-Prolog: Install via PPA development version 8.5.14
RocksDB pack commit: e253458
RocksDB commit: a9565ccb2
rocks-predicates commit: 3071007

So when you build it you will be pulling the exact commits possibly over writing the code you currently have.

Hi, and thanks quick answer and sorry for being slow here :slight_smile:

If I do a “git log” in the pack-directory the last commit is e253458069c7608e8d10a416c79c7e5ed5fac1d9

Should I checkout an earlier version?

If it were me I would start from those exact commits because I know they worked. If you read the many posts related to RocksDB pack a few weeks before 7/10/2022 you see that RockDB pack was not building and then after a few commits it would build with those commits loaded and using pack_rebuild/0,1.

Okay, will give it a try. Thx!

I use SWI-Prolog version 8.5.13 but with an older versions of gcc (9.4.0 on Ubuntu, 10.2.1 on Debian/Chromebook) … not sure if the older version of SWI-Prolog that you’re using (8.4.3) has the same version of SWI-cpp.h.

Note that a new version of SWI-cpp.h is under review and hopefully will go into the next release of SWI-Prolog; I have modified Rocksdb for the new version and have built/tested it (this update is also awaiting review).
The new version of SWI-cpp.h is because of problems like the ambiguous conversions that has affected you.

I wonder why Ubuntu and Debian have such old versions of gcc, and what’s the best way to get newer versions? …

This StackOverflow answer seems plausible.

Kernel updates may need to rebuild proprietary video modules from vendor supplied binary blobs, and this process is tested with the default compiler.

Yes, still having same problem - even on the versions you did mention. But I am however on 8.4.3 still, so this is probably the problem.

Ps, I had to add the flag: -Wno-error on this verison of gcc to get to this point.

I can probably wait for the new version and then hopefully it will be fixed with the new version of the header-file.

Yes, that is really an old gcc, but guess many are moving towards clang these days.

I would try and recreate your problem but having a working version of RocksDB with rocks-predicates for SWI-Prolog was so hard to get I don’t want to ruin it and then be without. :slightly_frowning_face:

FYI - When I did the build it was on Ubuntu on WSL 2 on Windows 10. That should not make a difference but I have seen odder.

I’ve installed gcc version 11 (using the instructions at … I’ll try to rebuild using both the older version of SWI-cpp.h and the new version and see how that goes. But it might be a few days before I can do this (I have everything currently set up to use the new version of SWI-cpp.h).
gcc version 12 seems to be “bleeding edge” – it doesn’t show in the PPA that I added (ppa:ubuntu-toolchain-r/test) – so you might want to try version 11.

Great, I am on Manjaro Linux, so guess I will just follow the dist version to make life simple :slight_smile:

If we are moving towards the new header-file I am fully happy waiting for this also!

Here is the topic with my recent endeavor to get the RocksDB pack for SWI-Prolog building.

Pack RocksDB, build fails on Ubuntu 22.04 LTS on WSL on Windows (reproducible)

Thanks for info, but still having the same issue :slight_smile:

The new header file can be used right now, although you’d have to replace it in lib/swipl/include (or modify the “-I” parameter to g++). If you want to wait until it’s in the “development” version of SWI-Prolog, that’s up to @jan . I doubt that it’d be back-ported to the “stable” version.

I tried compiling the “development” version with gcc version 11, and didn’t get any errors. So, I suspect your problem is with the “stable” version of SWI-cpp.h. You could try replacing just the current (8.5.15) “development” version of SWI-cpp.h and see what happens – it’s independent of everything else and merely calls functions that are defined in SWI-Prolog.h, so it should work with the “stable” API.

1 Like

Hi, checked out the 5-version of swi prolog and changed the -I include parameter to point to the new header files.

But still same problem - which is strange as I now have pretty much same setup as you. Now the only diff should be the version of the gcc, maybe.

commit c723033a96b1e6649e2b2f0c481adaf1db1e7539 (tag: V8.5.15)
Author: Jan Wielemaker
Date: Thu Jul 28 14:06:16 2022 +0200

Preparing version 8.5.15

Hi, happy to say it works fine now. I did copy the latest version of SWI-cpp.h from the packages-cpp repo and it solved it, after tuning the gcc-flags a little.

Thanks for really nice help!


1 Like

Care to share the details.

Sure. I checked out latest version of swi and the same with packages-cpp.

Then I updated the include flags in the to point to the new header locations. Also added -Wnoerror in the cflags to be able to compile rocks itself.

Then I did a make and after this I was able to load the library and run some tests from swi. Looking forward to have rocksdb write speed from prolog :slight_smile:

Please give me the gcc flags information so that I can update the build options. And if you have the error messages from rebuilding, please email them to me. (You might want to open a bug report with rocksdb – it seems to be under active development)

I didn’t need to do anything to get things to compile with gcc version 11 [*], so I suspect your problems have to do with enhancements with gcc version 12. I had come across problems with implicit conversions to bool while I was modifying SWI-cpp.h (and some even weirder ones with double), so it wouldn’t surprise me if there are some latent problems there. The new version of SWI-cpp.h takes a more conservative approach to implicit conversions, but is a bit more verbose because of that.

One other question: which language standard of C++ are you using? I needed to set the flag -std=c++17 to get rocksdb to build (this is in the Makefile for the pack) and it’s possible that a newer language standard might cause other problems. (I think that SWI-Prolog uses -std=c++11 by default.)

[*] I haven’t rebuilt the rocksdb library recently, so there might be some things there that don’t work with gcc version 11. I’ll try to check that out soon, because installing the rocksdb pack rebuilds the library.