Why source_sink 'library(tipc/tipc)' does not exist?

Hi all,
I’m trying to import tipc library but got error of ‘does not exist’. This occurs even in the latest stable release. Other libs seem ok.

Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.22)
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).

?- use_module(library(tipc/tipc)).
ERROR: source_sink `library(tipc/tipc)' does not exist
ERROR: In:
ERROR:   [19] throw(error(existence_error(source_sink,...),_3262))
ERROR:   [15] '$resolve_source_path'(library(tipc/tipc),_3294,[if(not_loaded),...]) at /usr/local/Cellar/swi-prolog/HEAD-0bd221e_1/libexec/lib/swipl/boot/init.pl:2259
ERROR:   [14] '$load_file'(library(tipc/tipc),user,[if(not_loaded),...]) at /usr/local/Cellar/swi-prolog/HEAD-0bd221e_1/libexec/lib/swipl/boot/init.pl:2236
ERROR:    [9] <user>
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
?- use_module(library(pengines)).
true.
___________________________________
I'm working on MacOS catalina.

The latest swipl-devel was installed via ‘brew install swi-prolog --HEAD’ successfully.

In fact I’ve tried to compile swipl from the git repository but failed in ctest.

Thanks in advance for any helps.

Arthur Wang

1 Like

I have not tested this out as I am using Windows 10 and I believe you are on a Mac, but I am sure Jan will correct me if I make a mistake.

tipc is not a library in the library directory by default, (GitHub), so it is not installed by default.

tipc is available for download at https://github.com/SWI-Prolog/contrib-tipc
This also has an install script install-sh

After this the use_module(library(tipc/tipc)). should work. If not check the physical path on the disk with the path given in use_module.

HTH


Side note

Missing from the list of packages in the documentation: Packs (add-ons) for SWI-Prolog

3 posts were split to a new topic: Library, packages and packs?

For me this would be a bad sign. What errors do you get?

tipc in particular is one of the submodules. If you follow the instructions for building from the sources, in theory, those should be available. If you use homebrew, the relevant instructions are here, for the dependencies:

brew install \
     cmake \
     ninja \
     gmp \
     openssl \
     libarchive \
     readline \
     ossp-uuid \
     libyaml \
     unixodbc \
     berkeley-db \
     pcre \
     jpeg

and then here.

Are you sure you did

git pull
git submodule update --init

?

I also notice that it says “Compatibility Linux only” in the docs. After I build (following the instructions available in CMAKE.md, linked above), inside the build directory, there is a file called CMakeCache.txt. In this file, I see:

//TIPC_networking
SWIPL_PACKAGES_TIPC:BOOL=ON

Thank you for response. I’ve found that tipc is in the list of ‘brew install swi-prolog --HEAD’:

% brew install swi-prolog --HEAD
Warning: A newer Command Line Tools release is available.
Update them from Software Update in System Preferences or
https://developer.apple.com/download/more/.

==> Cloning https://github.com/SWI-Prolog/swipl-devel.git
Updating /Users/laowang/Library/Caches/Homebrew/swi-prolog–git
From https://github.com/SWI-Prolog/swipl-devel
f40f32e…0bd221e master -> origin/master
==> Checking out branch master
Already on ‘master’
Your branch is behind ‘origin/master’ by 7 commits, and can be fast-forwarded.
(use “git pull” to update your local branch)
HEAD is now at 0bd221e Document the single NaN and fix nearest.
Entering ‘bench’
Entering ‘debian’
Entering ‘packages/PDT’

Entering ‘packages/sgml’
Entering ‘packages/ssl’
Entering ‘packages/swipl-win’
Entering ‘packages/table’
Entering 'packages/tipc’
Entering ‘packages/utf8proc’
Entering ‘packages/windows’
Entering ‘packages/xpce’

/Users/laowang/Library/Caches/Homebrew/swi-prolog–git/packages/swipl-win
/Users/laowang/Library/Caches/Homebrew/swi-prolog–git/packages/table
/Users/laowang/Library/Caches/Homebrew/swi-prolog–git/packages/tipc
/Users/laowang/Library/Caches/Homebrew/swi-prolog–git/packages/utf8proc
/Users/laowang/Library/Caches/Homebrew/swi-prolog–git/packages/windows

==> cmake … -DCMAKE_C_FLAGS_RELEASE=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE=-DNDEBUG -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/swi-pro
==> make install
:beer: /usr/local/Cellar/swi-prolog/HEAD-0bd221e_1: 906 files, 19.8MB, built in 2 minutes 10 seconds
Removing: /Users/laowang/Library/Caches/Homebrew/swi-prolog–8.0.3_1.catalina.bottle.tar.gz… (4.9MB)

It seems it is compiled and installed ok. But I haven’t found tipc.so and tipc.pl in the installed directories.

I did as the document guides:

laowang@bogon build % cmake -DCMAKE_INSTALL_PREFIX=/opt/swipl -DCMAKE_BUILD_TYPE=Debug -G Ninja …

– Looking for rl_event_hook
– Looking for rl_event_hook - found
– Configuring done
– Generating done
– Build files have been written to: /Users/laowang/Downloads/swipl-devel/build
laowang@bogon build % ninja
[1925/2359] Building Java objects for jpl_jar.jar
注: org/jpl7/fli/atom_t.java使用或覆盖了已过时的 API。
注: 有关详细信息, 请使用 -Xlint:deprecation 重新编译。
[2359/2359] Generating home/doc/manindex.db
laowang@bogon build % ctest -j 8
Test project /Users/laowang/Downloads/swipl-devel/build

61/61 Test #23: swipl:thread … Passed 18.66 sec

97% tests passed, 2 tests failed out of 61

Total Test time (real) = 24.13 sec

The following tests FAILED:
58 - bdb:bdb (SEGFAULT)
61 - ssl:ssl (Failed)
Errors while running CTest
laowang@bogon build % sudo ninja install
Password:
[3/4] Install the project…
– Install configuration: “Debug”


ctest doesn’t include tipc.

After installing, no tipc again.

Welcome to SWI-Prolog (threaded, 64 bits, version 8.1.22)
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).

?- use_module(library(tipc/tipc)).
ERROR: source_sink `library(tipc/tipc)’ does not exist
ERROR: In:
ERROR: [19] throw(error(existence_error(source_sink,…),_4054))
ERROR: [15] ‘$resolve_source_path’(library(tipc/tipc),_4086,[if(not_loaded),…]) at /usr/local/Cellar/swi-prolog/HEAD-0bd221e_1/libexec/lib/swipl/boot/init.pl:2259
ERROR: [14] ‘$load_file’(library(tipc/tipc),user,[if(not_loaded),…]) at /usr/local/Cellar/swi-prolog/HEAD-0bd221e_1/libexec/lib/swipl/boot/init.pl:2236
ERROR: [9]
ERROR:
ERROR: Note: some frames are missing due to last-call optimization.
ERROR: Re-run your program in debug mode (:- debug.) to get more detail.
?-


Then I entered packeges/tipc and tried to build there:
laowang@bogon build % pwd
/Users/laowang/Downloads/swipl-devel/packages/tipc/build
laowang@bogon build % cmake …
CMake Error at CMakeLists.txt:6 (AC_CHECK_HEADERS):
Unknown CMake command “AC_CHECK_HEADERS”.

– Configuring incomplete, errors occurred!
See also “/Users/laowang/Downloads/swipl-devel/packages/tipc/build/CMakeFiles/CMakeOutput.log”.
laowang@bogon build %

I did see install-sh script, but I don’t know how to use it to build the lib.

Further helps are appreciated!

After all, it seems that TIPC is indeed available on Linux only. It is documented, see here. Look for “compatibility”.

Jan said the same but the topic got split off so you probably didn’t see it.

I don’t know if you want to report the other test errors that you see. It could be caused by incorrectly installed dependencies, or maybe there are real problems.

PS: if tipc is not available on MacOS for sure, it should be removed from the Homebrew scripts I guess? @jan? I do not have a Mac at all so I don’t even know where to start.

PPS: The code for the Homebrew formula is here I guess? There isn’t a documented flag for not trying to install TIPC, but in CMAKE.md I read:

Note that packages for which the prerequisites cannot be found are dropped automatically, as are packages for which the sources are not installed.

Thank you all again. I didn’t notice the compatibility issue, since I found tipc is in the list of brew packages. I’d like to get a way to work around.

With regards,
Arthur Wang

From what I understand, the obvious work-around is to use Linux…

First I’ll try library(socket) for compatibility consideration. If it’s too much to do I’d resort to linux with sacrifying compatibility.

Boris Vassilev via SWI-Prolog swiprolog@discoursemail.com 于2020年2月21日周五 下午12:49写道:

This is a pure guess but something I have not seen you mention and something I would try if this were my problem.

A Docker container might work. See: SWI-Prolog Docker images

My concern would be that the C code for tipc might try to access some part of the system calls that the Docker container will not allow.

HTH

Also in Linux, you need a kernel module. Before using TIPC networking you need to do

 sudo modprobe tipc

I do not know how this works for Docker. Possibly you have to do the modprobe in the hosting Linux OS. If all this works the Docker virtual network also needs to forward the TIPC packages. Searching for “docker tipc” will probably give answers.

Yes, TIPC has some interesting properties when compared to UDP networking but it might be hard to use on anything except for a cluster of bare metal Linux machines connected in a LAN.

1 Like