I’m struggling to upgrade swipl 9.2.9 to 10.0.2 on FreeBSD 14.3. After a successful build and installation of the package, when I try to run swipl via CLI only (without GUI or X, which is how I normally use swipl).
# swipl
FATAL: could not find SWI-Prolog home
Tried source: environment $SWI_HOME_DIR or $SWIPL
Found /usr/local/lib/swipl/bin/amd64-freebsd/swipl: no such directory
Tried source: using “swipl.home” from “/usr/local/lib/swipl/bin/amd64-freebsd/swipl”
Found /usr/local/lib/swipl: no ABI file
Tried source: compiled in
Found /usr/local/lib/swipl: no ABI file
I’ve reduced swipl as much as possible but still obtain the original FATAL messages. I have: CMAKE_ARGS= -DSWIPL_PACKAGES_PYTHON=OFF -DSWIPL_PACKAGES_GUI=OFF -DSWIPL_PACKAGES_TIPC=OFF -DSWIPL_PACKAGES_JAVA=OFF -DSWIPL_PACKAGES_X=OFF -DUSE_GMP=OFF -DMULTI_THREADED=ON -DSWIPL_PACKAGES_ODBC=OFF -DCURSES_NEED_NCURSES=OFF -DCURSES_NEED_WIDE=OFF CMAKE_ARGS+= -DINSTALL_DOCUMENTATION=OFF -DBUILD_TESTING=OFF
After reviewing
the build installation notes for Debian, Redhat, Arch and “other systems”
Please disregard my earlier PR, as the solution was to:
swipl --abi-version > /usr/local/lib/swipl/ABI
The hints were in
Tried source: environment $SWI_HOME_DIR or $SWIPL Found /usr/local/lib/swipl: no ABI file Tried source: using “swipl.home” from “/usr/local/lib/swipl/bin/amd64-freebsd/swipl” Found /usr/local/lib/swipl: no ABI file Tried source: compiled in Found /usr/local/lib/swipl: no ABI file
Once the ABI file is created in the correct location, swipl starts correctly without needing to set any environment variables. So for those that come across a similar problem, at least for the FreeBSD package the necessary files are boot.prc and the new ABI file in /usr/local/lib/swipl.
I needed to refer to an earlier version of swipl to find what it thinks is the home, via
Finding the home has not changed AFAIK, except there is a verbose mode . Also, whether some dir is the home used to be simply checking for boot.prc, but now we check the ABI file to see whether the Prolog system and the home are compatible. This saves a lot of trouble we used to have where a new swipl found an old home, after which pretty much anything between completely functioning and an immediate hard crash could follow. Notably the “almost works” could be nasty to diagnose
Thanks Jan. Yes, you’re right the home didn’t change. I didn’t fully understand the message as I was sidetracked changing the environment files SWI_HOME_DIR and SWIPL. The only step that mattered was creating the ABI file, could be worth mentioning in the building page . I was also pleased to find that the ABI number only relied upon swipl information and not any operating system attributes (other than arch), as well.
But, that is simply created as part of the standard ninja install step, no? I guess you needed to supply a list of files for the package manager and missed to add this one?
Thank-you Jan. Yes, I can confirm that the ABI is created during the build process. Because I’m preceding the FreeBSD package, I didn’t find anything about this file in the usual build instructions. I’ll be sure to pass on my notes. I appreciate your patience
PS For any FreeBSD folk that find this note, its in both
I have swipl version 10.1.19-29-g9ce9f0f98-DIRTY installed in ~/.local and it works fine.
With the latest source (commit fde0211d39fd37b8b96406e82e20d3ca2b023f23), the executable in build.gcc/src/swipl fails with this output:
$ set | grep SWI
SWIPL_INSTALL_PREFIX=/home/peter/.local
$ ~/src/swipl-devel/build.gcc/src/swipl
FATAL: could not find SWI-Prolog home
Tried source: environment $SWI_HOME_DIR or $SWIPL
Tried source: using "swipl.home" from "/home/peter/src/swipl-devel/build.gcc/src/swipl"
Found /home/peter/src/swipl-devel/build.gcc/home: no ABI file
Tried source: compiled in
Found /home/peter/.local/lib/swipl: ABI mismatch
I noticed that build.gcc/src/swipl.home now contains ../home whereas in the installation (~/.local/bin/swipl which is a symbolic link to ../lib/swipl/bin/x86_64-linux/swipl), that file contains ..
Anyway, there’s no ABI file; all I could find were these, which are executables:
$ ls -l /home/peter/src/swipl-devel/build.gcc/src/libswipl*
lrwxrwxrwx 1 peter peter 14 Oct 28 22:41 /home/peter/src/swipl-devel/build.gcc/src/libswipl.so -> libswipl.so.10
lrwxrwxrwx 1 peter peter 19 Oct 28 22:41 /home/peter/src/swipl-devel/build.gcc/src/libswipl.so.10 -> libswipl.so.10.1.19
-rwxr-xr-x 1 peter peter 17092184 Oct 28 22:41 /home/peter/src/swipl-devel/build.gcc/src/libswipl.so.10.1.19
In my local installation /home/peter/.local/lib/swipl/ABI contains swipl-abi-2-68-de7f1d84-e5ee110c.
That should mean something in the build went wrong. The ABI file must be created during the build. Was the build directory clean? No warnings? The swipl.home is correct. The different values are because the layout of files differs between running in the build directory and outside. swipl.home should never be a symlink. When installing, swipl, swipl-ld and swipl-win are symlinks from your bin directory to the executables in the installed tree.
I think I’ve figured out the problem … this is for the bootstrap of the protobufs compiler (a plugin to protoc), for which I need the swipl executable … at the point where ninja is doing protobufs compiler bootstrap, the ABI file doesn’t exist. So, I need a way of specifying that I need both the swipl executable and the ABI file. My cmake skills are rudimentary, so any suggetions?
(I’m not 100% sure of this analysis, because I still get the error when I run ninja -j.)
(The bootstrap for the protobufs compiler was done by hand; I’m trying to automate it so that other people can maintain the package.)
Add DEPENDS core prolog_home. That implies the core system is build and the home directory in the build environment is populated. Grep for DEPENDS in the CMake file should give plenty of examples.
Yes. You should make sure the things you want to run during the build does not depend on autoloading. The autoload index is built as one of the last steps (because everything needs to be around).