question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pulsar C++ client compilation failed on Ubuntu 18.04

See original GitHub issue

Describe the bug Could not get c++ client built on my Ubuntu 18.04 To Reproduce Follwed steps from official tutorial

  1. git clone https://github.com/apache/pulsar
  2. apt-get install cmake libssl-dev libcurl4-openssl-dev liblog4cxx-dev \ libprotobuf-dev protobuf-compiler libboost-all-dev google-mock libgtest-dev libjsoncpp-dev
  3. # libgtest-dev version is 1.18.0 or above cd /usr/src/googletest sudo cmake . sudo make sudo cp ./googlemock/libgmock.a ./googlemock/gtest/libgtest.a /usr/lib/
  4. cd /usr/src/gmock sudo cmake . sudo make sudo cp libgmock.a /usr/lib
  5. cd pulsar-client-cpp cmake . make

Could not make, it says: error: ‘class google::protobuf::FileDescriptorSet’ has no member named ‘ByteSizeLong’; did you mean ‘ByteSize’? lib/CMakeFiles/PULSAR_OBJECT_LIB.dir/build.make:1605: recipe for target 'lib/CMakeFiles/PULSAR_OBJECT_LIB.dir/ProtobufNativeSchema.cc.o' failed

Error image

Try to fix the error As suggsted, changed ByteSizeLong to ByteSize in ./pulsar-client-cpp/lib/ProtobufNativeSchema.cc code, then got new error:

PaddingDemo.proto:25:12: Explicit 'optional' labels are disallowed in the Proto3 syntax. To define 'optional' fields in Proto3, simply remove the 'optional' label, as fields are 'optional' by default. tests/CMakeFiles/main.dir/build.make:68: recipe for target 'generated/tests/PaddingDemo.pb.cc' failed

image

Desktop (please complete the following information):

  • OS: [Ubuntu 18.04]

Additional context I guess it has to do with protobuf version, but could not find any more information. Thank you!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
BewareMyPowercommented, Mar 17, 2022

TL; DR the example code is wrong, we need to fix the doc. /cc @Anonymitaet

You should add a declaration before createProducer:

    Client client("pulsar://localhost:6650");

    Producer producer;  // **See here**
    Result result = client.createProducer("persistent://public/default/my-topic", producer);

there is a follow-up step called install Debian which I do not know what it is for (I am using Ubuntu)

It’s not a follow-up step. It’s a parallel step.

When you install a C++ SDK, it means following files need to be generated:

  • C++ headers (*.h)
  • C++ libraries, it can be either a dynamic library (*.so on Linux) or a static library (*.a on Linux).

A *.deb file is a pre-built Debian C++ package. (Ubuntu is derived from Debian) i.e. the apt install ./apache-pulsar-client.deb command will install the C++ headers and libraries to the target directory. Since the pre-built Debian C++ package doesn’t include a static library, you won’t see a *.a file.

However, if you have the source code of the C++ SDK, you can compile it by yourself, i.e. run cmake and make commands (or ./configure for C++ libraries that use GNU Autotools to build). At last, you need to run make install, which needs the superuser permission, to copy these files (*.h, *.so, *.a) to the target directory. You can also copy these files manually.

In short, you can choose to either compile from source or install from a pre-built package. The advantage of compiling from source is that you can get the latest library.

0reactions
github-actions[bot]commented, May 28, 2022

The issue had no activity for 30 days, mark with Stale label.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Ubuntu-Unable to install Node JS Pulsar Client - Stack Overflow
After all the research I get the below error which I am not able to fix when I do - npm install pulsar-client...
Read more >
[GitHub] [pulsar] ZW007 opened a new issue #14673
**Describe the bug** Could not get c++ client built on my Ubuntu ... ://pulsar.apache.org/docs/en/next/client-libraries-cpp/#compilation) 1.
Read more >
Set up a standalone Pulsar locally
For local development and testing, you can run Pulsar in standalone mode on your machine. The standalone mode includes a Pulsar broker, the...
Read more >
undefined reference to `log - C / C++ IDE (CDT) - Eclipse
BUT this gives an error on compilation ... src/test_fp.c:12: undefined reference to `log' ... cc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Read more >
Software Packages in "bionic" - Ubuntu
Binary; adminer (4.6.2-1) [universe]: Web-based database administration tool; adns-tools (1.5.0~rc1-1.1ubuntu1) [universe]: Asynchronous-capable DNS client ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found