I’m currently trying to commit swipl-8.2.3 to freebsd ports, but my patch gets rejected due to the creation of a directory (/usr/local/share/swi-prolog) during build. I run:
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -G Ninja ..
… and the directory appears during ninja. If I add:
… to cmake the problem disappears. I have searched high and low in cmakefiles and some .pl files w/out spotting the reason. I would appreciate some pointers as to what I might do to avoid this directory while keeping INSTALL_DOCUMENTATION=ON.
It is not entirely clear to me what is happening. What I do know is that quite a few of the packages are directly or indirectly needed to build the documentation. To create a normal default build make sure to have the dependencies installed. Just run cmake .. in the build dir again to see what is missing.
It should be investigated exactly which packages are required to build the docs. At the same time it is probably possible to significantly reduce the dependencies for the docs.
As is, install the dependencies or do not build the docs. Note that most of the dependencies are also needed to get version that works as advertised. Building a reduced system typically only makes sense if you want a minimal Prolog system for embedding into some application.
I ran ctest and it still segfaults on pengines as reported earlier this year by some other user. All other tests run fine when I build “on my own” (simply using cmake/ninja).
When “clean room building” by the freebsd build servers at least one test fails because it accesses files outside of the local build environment established by these servers, so I have diabled tests in official builds.
I looked into tcmalloc, and some guy “out there” reported good performance using jemalloc (default on freebsd) compared to tcmalloc. This seemed speed performance oriented, so I can’t attest to the difference between the two regarding memory usage. At this point I haven’t discovered a freebsd/tcmalloc port, so I might choose to keep it like this at first.
I switched to tcmalloc when possible after observing an ever growing amount of wasted (freed and not reused) memory using ptmalloc on SWISH and the swi-prolog.org webserver. For more info see Poor memory reuse (tcmalloc?)
Yeah, I think I spotted that one at one point. I wont pretend to be an expert on the matter. In some thread on the web, jemalloc was praised for releasing memory back to the system instead of keeping it hanging around forever. I will run some tests to see if jemalloc behaves more like tcmalloc than malloc/Linux version.
I already pushed another commit to get a new patch officially approved, but that wont stop me from improving the port further both when it comes documentation and malloc-implementation.
Ah, Now I got it. It creates the XDG directory for common data because it seems the build is executed by root and /usr/local/share exists and is owned by root. I pushed a fix that ensures this directory is only created if absolute_file_name/3 is asked to find a location for a writable file.
So, the current git version should not show this behavior any longer. For old versions you can hack around by setting the environment variable XDG_DATA_DIRS to a non-existing directory.