ashwinkapur opened a new issue #6311: The C++ Client distribution is basically 
borked.
URL: https://github.com/apache/pulsar/issues/6311
 
 
   It does not seem possible to build the C++ client except possibly by using 
your docker image which uses mystery binaries. 
   
   1) Your Cmake files seem to use old style Cmake which specifies each 
directory and file etc as opposed to just specifying dependencies of groups of 
objects of libraries and letting Cmake figure it out. I'd be happy to submit a 
patch fixing this and using Modern Cmake (see 
https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1)
   
   2) You seem to be using a patched version of google protobuf version 2 to 
avoid needless memory allocations. Why not use google flatbuffers instead. 
Designed for precisely this purpose and they have other benefits like vastly 
more serialization and deserialization. When using C++, there is essentially no 
serialization or deserialization, it's just writing to a memory location and 
dereferencing a pointer. With Java you don't have quite the same low level 
access available  so it's close but not quite that efficient.
   
   3) In the current head on github and the source distribution v 2.5.0 in 
protobuf/README.md at the bottom of the file you state:
   
   ### For C++ Client:
   
   The pre-generated C++ code is at `pulsar-client-cpp/lib/PulsarApi.pb.cc` and 
`pulsar-client-cpp/lib/PulsarApi.pb.h`.
   
   You don't need to manually generate C++ code. The C++ code is automatically 
generated by `cmake`.
   
   **_However, these files aren't there in either github or the source 
distribution._**
   
   4) Also in protobuf/README you state:
   
   We are currently using a modified version of the Google Protocol Buffer code 
generator, to generate code that can serialize/deserialize messages with no 
memory allocations (caching already instantiated objects) and also to be able 
to directly use Netty pooled ByteBuf with direct memory.
   
   To re-generate the `PulsarApi.java` code you need to apply a patch to the 
protobuf generator. Patch is found in `build/docker/protobuf.patch`.
   
   #### Commands for creating the pre-generated Java code
   
   ```shell
   export PULSAR_HOME=<Path where you cloned the pulsar repo>
   
   cd $HOME
   git clone https://github.com/google/protobuf.git
   
   cd ${HOME}/protobuf
   git checkout v2.4.1
   
   ### Apply patch
   patch -p1 < ${PULSAR_HOME}/build/docker/protobuf.patch
   
   ### Compile protobuf
   autoreconf --install
   ./configure
   make
   
   ### Re-generate PulsarApi
   cd ${PULSAR_HOME}/pulsar-common/
   export PROTOC=${HOME}/protobuf/src/protoc
   ./generate_protobuf.sh
   ```
   
   **_There is no directory called build in the source distribution. In the 
source distribution find . -name protobuf.patch finds no file. There is a 
build/docker/protobuf.patch on github on head but now I'm not sure if this is 
the same patch._**

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to