Installing node js pulsar client on ubuntu - c++

I am trying to install the pulsar-client for node js client on ubuntu. I get the following error:
fatal error: pulsar/c/message.h: No such file or directory #include <pulsar/c/message.h>
compilation terminated.
Pulsar.target.mk:116: recipe for target 'Release/obj.target/Pulsar/src/addon.o' failed
make: *** [Release/obj.target/Pulsar/src/addon.o] Error 1
the documentation says
Pulsar Node.js client library is based on the C++ client library.
Follow the instructions for C++ library for installing the binaries
through RPM, Deb or Homebrew packages.
(Note: you will need to install not only the pulsar-client library but
also the pulsar-client-dev library)
However, the instructions for installing C++ library on Ubuntu are not very clear. It is also not clear how to install pulsar-client-dev library.

You are right that C++ library must be installed. One note is please make sure the compatible C++ library is installed.
https://github.com/apache/pulsar-client-node#compatibility
To install C++ library ubuntu, here is an example which is from our Docker image build on Ubuntu based.
https://github.com/kafkaesque-io/pulsar-beam/blob/master/Dockerfile#L29
wget --user-agent=Mozilla -O apache-pulsar-client.deb "https://archive.apache.org/dist/pulsar/pulsar-2.4.1/DEB/apache-pulsar-client.deb"
wget --user-agent=Mozilla -O apache-pulsar-client-dev.deb "https://archive.apache.org/dist/pulsar/pulsar-2.4.1/DEB/apache-pulsar-client-dev.deb"
apt install -y ./apache-pulsar-client.deb
apt install -y ./apache-pulsar-client-dev.deb

Related

“make: protoc: Command not found” while installing grpc from source

I have cloned this repository https://github.com/grpc/grpc.git for installing the grpc. I want to use the framework with C++ programming so I followed the instructions given in folder src/cpp.
To build grpc for C++ from the source (in OpenSUSE) there are some pre-requisites given in this link
$ [sudo] apt-get install build-essential autoconf libtool pkg-config
As mentioned, to build from source and run tests, one needs
$ [sudo] apt-get install libgflags-dev libgtest-dev
$ [sudo] apt-get install clang libc++-dev
I could not find any build-essential, libgflags-dev and libgtest-dev. I don't know whether this is the reason for not getting grpc installed.
Later,
I have manually installed protocol buffer compiler protoc before running the make.
When I run make in the grpc root directory. I get this error
[PROTOC] Generating protobuf CC file from src/proto/grpc/channelz/channelz.proto
make: protoc: Command not found
make: *** [Makefile:2601: /home/rohan/Downloads/grpc/gens/src/proto/grpc/channelz/channelz.pb.cc] Error 127
Unable to figure out why this error is showing as I already have installed protoc. Is some linking problem, then please share how to solve it. I am new to Linux so I really am a little bit hesitant to change and env file or some make file by my own.
Please suggest some help. Thanks for your time.
I have resolved this problem by installing protocol buffer compiler properly.
The important step which I forgot to do earlier is to update the submodules with git submodule update --init --recursive when you are building protoc with git repository.
The steps for C++ version are mentioned at this link.
Thanks,

upgrading protobuf tensorflow on jetson tx2

To give as much background as possible -
I have a machine learning model trained using keras i'm trying to embed on an nvidia jetson tx2.
I have set up tensorflow on there (a bit of a pain in itself) however when i run my script i'm hitting an error with protobuf.
Using TensorFlow backend.
[libprotobuf FATAL google/protobuf/stubs/common.cc:61] This program requires version 3.1.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf/src/google/protobuf/any.pb.cc".)
terminate called after throwing an instance of 'google::protobuf::FatalException'
what(): This program requires version 3.1.0 of the Protocol Buffer runtime library, but the installed version is 2.6.1. Please update your library. If you compiled the program yourself, make sure that your headers are from the same version of Protocol Buffers as your link-time library. (Version verification failed in "external/protobuf/src/google/protobuf/any.pb.cc".)
Aborted (core dumped)
So - i upgraded protobuf using pip at first but i thought the clash is because c++ version is taking priority and the version in linux was still stating 2.6.1 however after building in c++ the version is now shown as 3.1.0 however i am still getting the same error.
From the nvidia dev forums i received some feedback
"/usr/lib/aarch64-linux-gnu/libprotobuf.so.9.0.1
This means that C/C++ code will find version 2.6.
pip install protobuf-3.1.0-py2.py3-none-any.whl
This means that Python code will find version 3.1.
You need to upgrade the C++ (system) library to match version 3.1.
I don't think there's a default package on Ubuntu that does this, so you will have to either hack it by building your own and installing it on top of the system package, or you will have to find a deb package that has a newer version that will still install on your current system."
Ive really been struggling with this as i cant find a way to upgrade the system files. Any help would be much appreciated
Thanks
edit: i'm also wondering could this be a clash with GTK (i am also using openCV here so thats worth a mention!)
Please check your version of libprotobuf-dev.
Please try to uninstall your existing one on your PC with following commands:
apt-get remove --purge libprotobuf-dev
Then, build new version of libprotobuf-dev:
apt-get install autoconf automake libtool curl make g++ unzip
wget https://github.com/google/protobuf/releases/download/v3.5.0/protobuf-cpp-3.5.0.tar.gz
tar -xvf protobuf-cpp-3.5.0.tar.gz
cd protobuf-3.5.0
./autogen.sh
./configure
make
make check
sudo make install
sudo ldconfig
Good luck.
References:
https://github.com/BVLC/caffe/issues/5711
https://github.com/google/protobuf/issues/2979
step 1:
first, uninstall with purge protobuf
sudo apt-get remove --purge libprotobuf
step 2:
start a fresh one
$ wget https://raw.githubusercontent.com/jkjungavt/jetson_nano/master/install_protobuf-3.6.1.sh
sudo chmod +x install_protobuf-3.6.1.sh
./install_protobuf-3.6.1.sh #this time will take 30 min on my board.

Unable to locate package GLFW on Linux Mint

I have been trying to install GLFW and GLFW3, using Terminal to install
sudo apt-get install GLFW
sudo apt-get install GLFW3
Whenever I do so, I get results such as
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package glfw3
I have been trying to install GLFW for two hours now, and I'm getting a bit impatient. Also I'm very new to Linux (Mint), so I apologize if I'm doing something stupid...
EDIT:
No matter what I try, my program encounters
/home/myusername/Desktop/basic_window.cpp:11:21: fatal error: GL/glfw.h: No such file or directory
#include <GL/glfw.h>
^
compilation terminated.
Having a frustrating time with this, not sure why this is much more complicated than the other libraries I've installed so far.
I have been trying to install GLFW and GLFW3, using Terminal to install...
On Mint 17, it looks like you need to install libglfw2. So perform a sudo apt-get install libglfw2.
If you plan on developing against it, then install libglfw-dev instead. Notice the lack of a version number.
If interested, perform apt-cache search glfw
In Debian-based systems such as Ubuntu and Mint, library packages typically have names that begin with "lib", and development headers (for compiling new programs that use the library) are in a separate package whose name ends with "-dev".
Ubuntu 14.04 has GLFW 2 packaged as libglfw2 and libglfw-dev. Mint doesn't seem to have those packages, but you can probably use the Ubuntu ones since Mint 17 is based on Ubuntu 14.04.
GLFW 3 isn't in Ubuntu 14.04, but it looks like it'll be in 14.10 (as libglfw3 and libglfw3-dev).
Unless you really need GLFW 3 specifically, you're probably better off sticking with the packaged GLFW 2. Packages get easy automatic upgrades; compiling stuff "by hand" is a good way to end up with lots of cruft in your system with no automatic upgrade or uninstall.
Download GLFW source packages from their website.
Extract the folder glfw-3.0.4 from the tarball
Open console
Navigate to the folder you just extracted and go inside of it using cd
Type cmake . (be sure you include the dot)
If cmake . fails, then type the following as root:
apt-get install cmake
If you don't think you're root then type the following:
sudo apt-get install cmake
If that doesn't work then type the following as root, or add sudo if you're not root:
apt-get install build-essential cmake
Once you have cmake installed, navigate back to the folder and try cmake . again.

fatal error: yaml-cpp/yaml.h: No such file or directory

I am trying to compile my own c++/qt5.2 app which uses yaml-cpp under Ubuntu 14.04.
While issuing the make command I get the following error
fatal error: yaml-cpp/yaml.h: No such file or directory
on the line:
#include <yaml-cpp/yaml.h>
How can I fix this?
You need to install the yaml-cpp library.
Under Ubuntu 14.04 you can do this by simply running one of the following commands in a terminal window (depending one the API you use):
sudo apt-get install libyaml-cpp-dev
or
sudo apt-get install libyaml-cpp0.3-dev
See the yaml-cpp project page for other operating systems and differences between old (0.3) and new API.

How do I install the OpenSSL libraries on Ubuntu?

I'm trying to build some code on Ubuntu 10.04 LTS that uses OpenSSL 1.0.0. When I run make, it invokes g++ with the "-lssl" option. The source includes:
#include <openssl/bio.h>
#include <openssl/buffer.h>
#include <openssl/des.h>
#include <openssl/evp.h>
#include <openssl/pem.h>
#include <openssl/rsa.h>
I ran:
$ sudo apt-get install openssl
Reading package lists... Done
Building dependency tree
Reading state information... Done
openssl is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.
But I guess the openssl package doesn't include the library. I get these errors on make:
foo.cpp:21:25: error: openssl/bio.h: No such file or directory
foo.cpp:22:28: error: openssl/buffer.h: No such file or directory
foo.cpp:23:25: error: openssl/des.h: No such file or directory
foo.cpp:24:25: error: openssl/evp.h: No such file or directory
foo.cpp:25:25: error: openssl/pem.h: No such file or directory
foo.cpp:26:25: error: openssl/rsa.h: No such file or directory
How do I install the OpenSSL C++ library on Ubuntu 10.04 LTS?
I did a man g++ and (under "Options for Linking") for the -l option it states: " The linker searches a standard list of directories for the library..." and "The directories searched include several standard system directories..." What are those standard system directories?
You want to install the development package, which is libssl-dev:
sudo apt-get install libssl-dev
Run:
apt-get install libssl-dev
All of these answers are very outdated and from when the package was still being developed. You can now just use the "normal" command listed below:
sudo apt install openssl
Edit: OP's question is poorly worded... after all, OpenSSL is a library itself, so I read his question too quickly before answering. The command above installs "normal" OpenSSL.
Toward the bottom of his question he mentions that make fails, suggesting he is compiling the package manually. And yes, even if you download the TAR ball, it will include all of the openssl and libssl files, which you can then make from.
What OP is really asking for is the OpenSSL Development Library, in which case you can first install OpenSSL using the above command, and then run this afterwards:
sudo apt install libssl-dev
More info: https://linuxtect.com/how-to-install-openssl-libraries-on-ubuntu-debian-mint/
I found a detailed solution here: Install OpenSSL Manually On Linux
From the blog post...:
Steps to download, compile, and install are as follows (I'm installing version 1.0.1g below; please replace "1.0.1g" with your version number):
Step – 1 : Downloading OpenSSL:
Run the command as below :
$ wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz
Also, download the MD5 hash to verify the integrity of the downloaded file for just varifacation purpose. In the same folder where you have downloaded the OpenSSL file from the website :
$ wget http://www.openssl.org/source/openssl-1.0.1g.tar.gz.md5
$ md5sum openssl-1.0.1g.tar.gz
$ cat openssl-1.0.1g.tar.gz.md5
Step – 2 : Extract files from the downloaded package:
$ tar -xvzf openssl-1.0.1g.tar.gz
Now, enter the directory where the package is extracted like here is openssl-1.0.1g
$ cd openssl-1.0.1g
Step – 3 : Configuration OpenSSL
Run below command with optional condition to set prefix and directory where you want to copy files and folder.
$ ./config --prefix=/usr/local/openssl --openssldir=/usr/local/openssl
You can replace “/usr/local/openssl” with the directory path where you want to copy the files and folders. But make sure while doing this steps check for any error message on terminal.
Step – 4 : Compiling OpenSSL
To compile openssl you will need to run 2 command : make, make install as below :
$ make
Note: check for any error message for verification purpose.
Step -5 : Installing OpenSSL:
$ sudo make install
Or without sudo,
$ make install
That’s it. OpenSSL has been successfully installed. You can run the version command to see if it worked or not as below :
$ /usr/local/openssl/bin/openssl version
OpenSSL 1.0.1g 7 Apr 2014
How could I have figured that out for
myself (other than asking this
question here)? Can I somehow tell
apt-get to list all packages, and grep
for ssl? Or do I need to know the
"lib*-dev" naming convention?
If you're linking with -lfoo then the library is likely libfoo.so. The library itself is probably part of the libfoo package, and the headers are in the libfoo-dev package as you've discovered.
Some people use the GUI "synaptic" app (sudo synaptic) to (locate and) install packages, but I prefer to use the command line. One thing that makes it easier to find the right package from the command line is the fact that apt-get supports bash completion.
Try typing sudo apt-get install libssl and then hit tab to see a list of matching package names (which can help when you need to select the correct version of a package that has multiple versions or other variations available).
Bash completion is actually very useful... for example, you can also get a list of commands that apt-get supports by typing sudo apt-get and then hitting tab.
Another way to install openssl library from source code on Ubuntu, follows steps below, here WORKDIR is your working directory:
sudo apt-get install pkg-config
cd WORKDIR
git clone https://github.com/openssl/openssl.git
cd openssl
./config
make
sudo make install
# Open file /etc/ld.so.conf, add a new line: "/usr/local/lib" at EOF
sudo ldconfig
You want the openssl-devel package.
At least I think it's -devel on Ubuntu. Might be -dev. It's one of the two.
As a general rule, when on Debian or Ubuntu and you're missing a development file (or any other file for that matter), use apt-file to figure out which package provides that file:
~ apt-file search openssl/bio.h
android-libboringssl-dev: /usr/include/android/openssl/bio.h
libssl-dev: /usr/include/openssl/bio.h
libwolfssl-dev: /usr/include/cyassl/openssl/bio.h
libwolfssl-dev: /usr/include/wolfssl/openssl/bio.h
A quick glance at each of the packages that are returned by the command, using apt show will tell you which among the packages is the one you're looking for:
~ apt show libssl-dev
Package: libssl-dev
Version: 1.1.1d-2
Priority: optional
Section: libdevel
Source: openssl
Maintainer: Debian OpenSSL Team <pkg-openssl-devel#lists.alioth.debian.org>
Installed-Size: 8,095 kB
Depends: libssl1.1 (= 1.1.1d-2)
Suggests: libssl-doc
Conflicts: libssl1.0-dev
Homepage: https://www.openssl.org/
Tag: devel::lang:c, devel::library, implemented-in::TODO, implemented-in::c,
protocol::ssl, role::devel-lib, security::cryptography
Download-Size: 1,797 kB
APT-Sources: http://ftp.fr.debian.org/debian unstable/main amd64 Packages
Description: Secure Sockets Layer toolkit - development files
This package is part of the OpenSSL project's implementation of the SSL
and TLS cryptographic protocols for secure communication over the
Internet.
.
It contains development libraries, header files, and manpages for libssl
and libcrypto.
N: There is 1 additional record. Please use the '-a' switch to see it
Go to the official website and download the source code for the version you need
Then unzip the update package and execute the following command
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl -Wl,-rpath,/usr/local/ssl/lib shared
Because the default is to generate only static libraries, if you want dynamic libraries, add the "shared" option
make && make install
sudo apt-get install libcurl4-openssl-dev