# Linked binary of swiprolog does not use SWI\_HOME

**URL:** <https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815>\
**Category:** General\
**Created:** [February 23, 2025, 10:38am UTC](https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815 "2025-02-23T10:38:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![mjeu](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mjeu/32/6972_2.png) [@mjeu](https://swi-prolog.discourse.group/u/mjeu)\
**Post date:** [February 23, 2025, 10:38am UTC](https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815/1 "2025-02-23T10:38:14Z")

</div>

Hi!

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?

Kind greetings, Manfred

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [February 23, 2025, 3:03pm UTC](https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815/2 "2025-02-23T15:03:32Z")

</div>

I think it is SWI\_HOME\_DIR.

```prolog
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.

```

---

<div class="post-metadata">

**Author:** ![mjeu](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mjeu/32/6972_2.png) [@mjeu](https://swi-prolog.discourse.group/u/mjeu)\
**Post date:** [February 24, 2025, 10:39am UTC](https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815/3 "2025-02-24T10:39:07Z")

</div>

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:

```prolog
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?

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [February 24, 2025, 10:56am UTC](https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815/4 "2025-02-24T10:56:44Z")

</div>

It finds the library files relative to its home.

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).

---

<div class="post-metadata">

**Author:** ![mjeu](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mjeu/32/6972_2.png) [@mjeu](https://swi-prolog.discourse.group/u/mjeu)\
**Post date:** [February 24, 2025, 11:17am UTC](https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815/5 "2025-02-24T11:17:08Z")

</div>

Hi Jan,

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!

---

<div class="post-metadata">

**Author:** ![mjeu](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mjeu/32/6972_2.png) [@mjeu](https://swi-prolog.discourse.group/u/mjeu)\
**Post date:** [February 24, 2025, 11:23am UTC](https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815/6 "2025-02-24T11:23:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mgondan1](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mgondan1/32/803_2.png) [@mgondan1](https://swi-prolog.discourse.group/u/mgondan1)\
**Post date:** [February 24, 2025, 1:38pm UTC](https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815/7 "2025-02-24T13:38:36Z")

</div>

So, I understand correctly that there is a variable SWI\_HOME, too? Or is it only used in older versions of swipl?

---

<div class="post-metadata">

**Author:** ![mjeu](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mjeu/32/6972_2.png) [@mjeu](https://swi-prolog.discourse.group/u/mjeu)\
**Post date:** [February 24, 2025, 1:54pm UTC](https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815/8 "2025-02-24T13:54:04Z")

</div>

I am not sure. I have used SWI\_HOME since a long time to compile our ConceptBase system. I guess that SWI\_HOME\_DIR is the official one … Will check…

---

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [February 24, 2025, 3:47pm UTC](https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815/9 "2025-02-24T15:47:34Z")

</div>

> [@mjeu](#):
>
> I would love to use a more recent version of [SWI-Prolog](https://www.swi-prolog.org/pldoc/doc_for?object=manual). 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.

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.

> [@mjeu](#):
>
> Is the environment variable SWI\_HOME specifying the prefix of its home? Will the runtime program use SWI\_HOME to find the \*.pl files?

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.

---

<div class="post-metadata">

**Author:** ![mjeu](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/mjeu/32/6972_2.png) [@mjeu](https://swi-prolog.discourse.group/u/mjeu)\
**Post date:** [February 24, 2025, 5:47pm UTC](https://swi-prolog.discourse.group/t/linked-binary-of-swiprolog-does-not-use-swi-home/8815/10 "2025-02-24T17:47:22Z")

</div>

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.
