I am trying to use the Google Protocol Buffer library for SWI-Prolog by following this tutorial: ('packages/protobufs.html').
At first, I was doing everything wrong and installed the protocol for Windows and tried to compile the proto file with the built-in SWI-Prolog packages. After a few hours of various errors, I checked the developer’s documentation and found out that it could not be processed on Windows.
So, I created a Docker image with this Dockerfile:
FROM debian:buster
RUN apt-get update && apt-get install -y \
swi-prolog
RUN apt-get install -y wget
WORKDIR /tmp
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v27.0/protoc-27.0-linux-x86_64.zip
RUN unzip protoc-27.0-linux-x86_64.zip -d protoc
RUN mv protoc/include /usr/local/include && \
mv protoc/bin/* /usr/local/bin
RUN rm -rf /tmp/*
WORKDIR /app
CMD ["bash"]
Now I am not sure about windows. I found addressbook.proto in my swipl files in windows and I read in docs that I need make run_addressbook. May I run it on Windows? And how?
Therefore, I need some advice from someone who has already gone through the entire process.
It appears that there are some missing pieces in the documentation – I’ll try to update these soon. (I think that the plugin needs to be specified when using protoc, for example)
I’m unable to help with docker or Windows; hopefully when I fix the documentation for using protoc it’ll be obvious how to do things with docker.
Here’s a partial answer; the protobuf package seems to have become out of date, so I need to make some changes to it. Also, there are some typos in the documentation.
The following worked on Debian and should also work on Ubuntu (after installing swi-prolog, protobuf-compiler, pkg-config). It is possible that it would also work on Windows; there is a comment with commit 01e748fa3bac23e15830b978af9fbc14ab191146 that it has cleaned up float32 and int32 for MSVC.
@jan - Can this indexing be fixed, please? (Also, the author’s info and maybe it needs a copyright?).
The file is swipl-devel/packages/protobufs/protobufs.doc.
There ought to be a section describing the various directories, such as /usr/share/swi-prolog/doc/packages/examples/protobufs (which includes demo, interop and bootstrap). Where should this be added?
There are a lot of hits in the search. protobuf is only used for the library name though. The docs talk about Google Protocol Buffers and you find that using “protocol”. I guess we can add a tag “protobufs”. I see the tagging interface is a bit broken after the website migration though
I don’t know. You’re guess is most likely better than mine