We use SWI-Prolog for the server-part of our ConceptBase system. The binary of the ConceptBase server is actually the swipl binary loaded with our Prolog program and linked to some of our own libraries to efficiently store data.
We have long been using SWI-Prolog 5.6 and though it is very old, it worked very well.
When moving to a newer version of SWI-Prolog, say SWI-Prolog 6.6, then it expects the SWI-Prolog installation directory to be where it was installed. Since we want to distribute the code, we need to let out linked ConceptBaser server program to find the SWI-Prolog libraries and other files.
I thought that I could use the SWI_HOME environment variable to do so. However, it is seemingly ignored. Do I have to set other variables like SWI_INCLUDE as well?
1. Here the binary does not match the version in SWI_HOME_DIR
matthias@hp:~/rolog$ SWI_HOME_DIR=/usr/local/lib/swipl /usr/bin/swipl
[FATAL ERROR: at Sun Feb 23 15:59:54 2025
/usr/local/lib/swipl/boot.prc: incompatible VM-signature (file: 0x6ed28fea; Prolog: 0x9fa44fc5)]
Aborted
2. Here they match
matthias@hp:~/rolog$ SWI_HOME_DIR=/usr/local/lib/swipl /usr/local/bin/swipl
Welcome to SWI-Prolog (threaded, 64 bits, version 9.3.17-28-g6f1f90eab-DIRTY)
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).
?- halt.
Hi! Turns out that the missing library was libswipl.so.6.6.6. I can address that but now I run into a different problem. The compiled program (that includes swipl) does not start properly because it want to load some libary *.pl programs:
initialization_error(shlib:load_foreign_library(files_ex:foreign(files),install_files),error(shared_object(open,files: cannot open shared object file: No such file or directory),context(system: $open_shared_object/3,_G197)),/home/jeusfeld/swipl66/lib/swipl-6.6.6/library/filesex.pl:57)
It seems that the path is hard-coded. Is there an environment variable that I can tell swipl where to find these *.pl files?
I wonder why you move to the still very old 6.6 release. Why not to 9.2.9? Most of us have forgotten about 6.6. My bet would be to first get the program running on 9.2.9 without deploying as a stand alone executable and then deal with the deployment issues in the current release. A lot of stuff has improved when it comes to deployment (as well as other things).
I would love to use a more recent version of SWI-Prolog. Problem is however some changes in the API, for example the “string” type. There are certainly solutions but a direct switch to 9.2.9 is difficult because of our own C/C++ legacy code.
Is the environment variable SWI_HOME specifying the prefix of its home? Will the runtime program use SWI_HOME to find the *.pl files?
Kind greetings, Manfred
PS: SWI-Prolog was a life safer for ConceptBase back in the days. So good to have a free and open-source Prolog! Thanks to you and your team!
To clarify: The problem arises only when I install ConceptBase on another computer. The computer on which I compile ConceptBase with SWI-Prolog has no issues. However, the computer on which I install it does not have SWI-Prolog. I need to have an installable package of ConceptBase that does not require to install SWI-Prolog.
It should have very few consequences. The entire old C API is still present AFAIK as deleting or modifying tends to result in unhappy users … Strings can happily be ignored, as can dicts. Some care may be needed when "..." is used in the Prolog flags, but a simple set_prolog_flag(double_quotes, codes) in affected modules should deal with that. I would be surprised if porting to 9.2 takes more than a few hours. You’ll get these back quickly as nobody can help you with version 6.6 unless someone is willing to check the ChangeLogs and sources.
The current version uses SWI_HOME_DIR. Dunno about 6.6. The Prolog library is found in a directory library below there. If you use a saved state though, you should not need the library in the deployed version. Using recent versions, it should be enough to have a directory with the exe and required DLLs (assuming Windows) and the saved state concatenated to the exe. It doesn’t even need to know its home.
Hi Jan, I shall further investigate the problem at hand. It is surely a fault on our side. Maybe, we can even upgrade to the latest SW-Prolog. It is just that we carry a lot of legacy code with us here. I was not the person who configured the SWI-Prolog makefile configurations for our software. I just need to dig depper into the settings.