I have a project requiring the use of Cap'n Proto for Java. I have a Linux system and I've successfully installed the Cap'n Proto schema compiler as described here:
https://capnproto.org/install.html
Now following the installation instructions as described here: https://dwrensha.github.io/capnproto-java/index.html, I can't seem to figure out how to generate the capnpc-java
plugin. The instructions here seem unclear:
You will need to install the latest release of the Cap’n Proto schema compiler. Then, running make should build capnpc-java.
Running make from where? I did that from the $WORKDIR/capnproto-java
directory but that doesn't work.
The other approach I did was to follow the cmake
instructions from from $WORKDIR/capnproto-java/cmake/README.md
but that didn't work either. According to that README.md:
mkdir build
cd build
cmake -DCAPNP_PKG_PATH=[path of Capnproto pkgconfig directory (with capnp.pc)] [path of CMakeLists.txt]
Where I set CAPNP_PKG_PATH
to be the path of the $WORKDIR/capnproto/c++/pkgconfig
directory, and the [path of CMakeLists.txt]
to $WORKDIR/capnproto
, where $WORKDIR
is a directory on my system.
Can anyone help? I'm not an expert on make system, Makefiles, or cmake. Where does the capnpc-java
created? When I do a which capnpc-java
, nothing is showing up (I do however, can successfully which capnp
, which is located in /usr/local/bin/
)
Looks like I figured it out after some trial and error. It's not straightforward from the README, but at the end of the day, I got the capnpc-java
built. This is the approach I did:
$WORKDIR/capnproto-java/cmake
. Follow the instructions in the README.md
inside that cmake
directory, under Using cmake.-DCAPNP_PKG_PATH
, specify the path from Step 1, but make sure to include capnp.pc
. For example: cmake -DCAPNP_PKG_PATH=$WORKDIR/capnproto/c++/pkgconfig/capnp.pc $WORKDIR/capnproto/CMakeLists.txt
cd
to $WORKDIR/capnproto
and run make -j6
cd
to $WORKDIR/capnproto-java
and run make
capnpc-java
is generated in $WORKDIR/capnproto-java
. Copy this to /usr/local/bin
I'm assuming this works. I haven't run the capnp compile
yet, but at least this answered my original question.