Could NOT find Protobuf (missing: Protobuf_PROTOC_EXECUTABLE) - c++

When I am doing a cmake in the build directory of the project I am getting this error. Initially I got a
protobuf-config.cmake not found
error. So I gave a path of the protobuf-config.cmake file to Protobuf_DIR. Later it started to show this new error:
CMake Error at
/opt/cmake/share/cmake-3.13/Modules/FindPackageHandleStandardArgs.cmake:137
(message): Could NOT find Protobuf (missing:
Protobuf_PROTOC_EXECUTABLE)
(found suitable version "3.6.1", minimum required is "3.0.0")
I am also attaching the error log file:
https://drive.google.com/open?id=1y7BZ6lDBtxvla7r-o188xM_FjwLqwhCx
I am doing this on Ubuntu-18 with cmake version: 3.13 and protobuf version: 3.6.1

You probably don't have the Protobuf compiler and development files installed. To fix that, run this command:
sudo apt-get install protobuf-compiler libprotobuf-dev
Alternatively, if you're building Protobuf by hand, you can't build it with the build type as RelWithDebInfo because that causes issues with the library and CMake.

Installed from apt on Ubuntu 20.04, dont have permissions to /usr/include/google
To fix: sudo chmod +Xr -R /usr/include/google

Default repositories usually contain outdated protobuf version. It is best to install it manually, from sources:
git clone --progress -b v3.10.0 https://github.com/protocolbuffers/protobuf && \
( \
cd protobuf; \
mkdir build; \
cd build; \
cmake ../cmake \
-DCMAKE_BUILD_TYPE=Release \
-Dprotobuf_BUILD_SHARED_LIBS=ON \
-Dprotobuf_BUILD_TESTS=OFF; \
make -j4 install; \
) && \
rm -rf protobuf

Quickly adding here that after installing Protobuf following this answer, I had to delete the build folder in my workspace to get cmake to run without this error :)

Hy,
list your protobuf libraries with sudo apt list | grep protobuf it should tell you what it will install by default. Run protoc --version so that you see what is recognized by default now. And after that get a version from github if needed build it and install it (this should not take to long). Then run protoc --version again.

Related

After make install via cmake - grpc forlders is empty

I try to installing GRPC from sources.
I have Oracle Linux 7.9, GCC 10.2.1 from devtoolset-10 and cmake version 3.21.0-rc1 built from sources.
The way i used:
git clone --recurse-submodules -b v1.37.0 https://github.com/grpc/grpc
cd grpc
mkdir -p cmake/build
pushd cmake/build
cmake -DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF \
-DCMAKE_INSTALL_PREFIX=$/usr/local/bin \
../..
make
make install
After this i see that files from /root/grpc/cmake/build$/usr/local/bin/lib/....files been created in /usr/local/....
Ok. But when i change directory to /usr/local - this directory does`t content files from make install.
What i doing wrong?
BTW, when i try to built 1.38 version of GRPS i return building error:
/root/grpc/src/core/lib/gpr/log_linux.cc: In function ‘void gpr_default_log(gpr_log_func_args*)’:
/root/grpc/src/core/lib/gpr/log_linux.cc:97:62: error: no matching function for call to ‘StrFormat(const char [22], const char*, char [64], int32_t&, long int&, const char*&, int&)’
time_buffer, now.tv_nsec, tid, display_file, args->line);
The following worked for me:
$ git clone --recurse-submodules -b v1.37.0 https://github.com/grpc/grpc
$ cmake -G Ninja -S grpc/ -B grpc-build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr/local \
-DgRPC_INSTALL=ON \
-DgRPC_BUILD_TESTS=OFF
$ cmake --build grpc-build --target install
The relevant differences here are that my install prefix doesn't have a stray $ in it and that I set the build type (which you must always do).
I'm on Ubuntu 20.04 LTS using CMake 3.20.5 (the latest release) and GCC 10.3.0. Please try the above commands and see if anything changes.

Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)

I am trying to install openpose in Ubuntu 20.04 using CMAKE and I get the following error:
Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
I am following the instructions here (unfortunately, the screenshots are not available but I just followed the textual commands):
https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/doc/installation/README.md
I made a build folder in openpose folder and then ran the cmake-gui .. command.
A GUI opens with all these checked (I don't change anything):
and the error is:
GCC detected, adding compile flags
GCC detected, adding compile flags
Building with CUDA.
CUDA detected: 10.1
Added CUDA NVCC flags for: sm_75
cuDNN not found
Found gflags (include: /usr/include, library: /usr/lib/x86_64-linux-gnu/libgflags.so)
Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
CMake Warning at /usr/share/cmake-3.16/Modules/FindProtobuf.cmake:499 (message):
Protobuf compiler version 3.13.0 doesn't match library version 3.6.1
Call Stack (most recent call first):
CMakeLists.txt:429 (find_package)
Found Protobuf: /usr/lib/x86_64-linux-gnu/libprotobuf.so;-lpthread (found version "3.6.1")
Found OpenCV: /usr (found version "4.2.0")
cuDNN not found.
#!/bin/bash
echo "This script assumes Ubuntu 16 or 14 and Nvidia Graphics card up to 10XX. Otherwise, it will fail."
# Install cuDNN 5.1
if [[ $UBUNTU_VERSION == *"14."* ]] || [[ $UBUNTU_VERSION == *"15."* ]] || [[ $UBUNTU_VERSION == *"16."* ]]; then
CUDNN_URL="http://developer.download.nvidia.com/compute/redist/cudnn/v5.1/cudnn-8.0-linux-x64-v5.1.tgz"
wget -c ${CUDNN_URL}
sudo tar -xzf cudnn-8.0-linux-x64-v5.1.tgz -C /usr/local
rm cudnn-8.0-linux-x64-v5.1.tgz && sudo ldconfig
else
echo "cuDNN NOT INSTALLED! Ubuntu 16 or 14 not found. Install cuDNN manually from 'https://developer.nvidia.com/cudnn'."
fi
CMake Error at CMakeLists.txt:520 (message):
Install cuDNN using the above commands. or turn off cuDNN by setting
USE_CUDNN to OFF.
Configuring incomplete, errors occurred!
See also "/home/mona/research/code/openpose/build/CMakeFiles/CMakeOutput.log".
See also "/home/mona/research/code/openpose/build/CMakeFiles/CMakeError.log".
Then, I installed gflags using sudo apt-get install libgflags-dev command but I still get the same error. How could I fix this problem?
This is the git log to see which version of repo I am at for reproducing the error:
$ git log
commit a255747af22116ad76004437456bb531dc5d0b23 (HEAD -> master, origin/master, origin/HEAD)
Author: Wlad Meixner <9556979+gosticks#users.noreply.github.com>
Date: Mon Dec 21 22:01:10 2020 +0100
Fix possible typo (#1802)
The CMakeOutput.log and CMakeError.log can be found here https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/1814
$ sudo apt install libgoogle-glog-dev
Also,
$ sudo apt-get install libgflags-dev
$ sudo apt install libgoogle-glog-dev
$ sudo apt-get install protobuf-compiler libprotobuf-dev
since initially I didn't have any of them installed.
If you have run it from the command line you should have see them...
if (NOT GLOG_FOUND)
message(FATAL_ERROR "Glog not found. Install Glog from the command line using the command(s) -\
sudo apt-get install libgoogle-glog-dev")
endif (NOT GLOG_FOUND)
if (NOT GFLAGS_FOUND)
message(FATAL_ERROR "GFlags not found. Install GFlags from the command line using the command(s) --\
sudo apt-get install libgflags-dev")
endif (NOT GFLAGS_FOUND)
if (NOT OpenCV_FOUND)
message(FATAL_ERROR "OpenCV not found. Install OpenCV from the command line using the command(s) --\
sudo apt-get install libopencv-dev")
endif (NOT OpenCV_FOUND)
ref: https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/5a9acc730915f2171badcf10076aef9213f38e01/CMakeLists.txt#L523-L537
note: A better way, would be to use FetchContent() when third parties are missing (since they provide a CMake based build), also the command provided is ubuntu only...

How to install Boost from source

I am trying to install the Boost C++ from source.
I first tried using yum to install them in (Amazon Linux AMI) but it installed a version that is too old. I need at least version 1.54
So I tried to follow the instructions here:
https://www.boost.org/doc/libs/1_70_0/more/getting_started/unix-variants.html
Once I downloaded the source, I tried symlinking the header files to /usr/include:
ln -s /root/boost_1_70_0/boost /usr/include/boost
Then I followed the instructions to try to build:
cd /root/boost_1_70_0
./bootstrap.sh
./b2 install
Then when I try to compile my program that needs boost libraries (happens to be OSRM), I get this error:
make[2]: *** No rule to make target `/usr/lib64/libboost_date_time-mt.so', needed by `osrm-components'. Stop.
So it seems somehow I need to build the boost .so files to go in /usr/lib64. But how do I do that?
I believe that you've already built the boost .so files but I don't know where. It normally tries to install them in /usr/local, see section 5.1 of the instructions you referenced.
You may be able to find them with locate, e.g.:
locate boost
Otherwise, you can call ./bootstrap.sh with a prefix indicating where you want it to build the libraries, e.g.:
./bootstrap.sh --prefix=/root/boost_1_70_0/stage
./b2 install
You can then copy the .so files together with with their symbolic links to /usr/lib64, e.g.:
cd /usr/lib64
rm -fr libboost*
cp -a /root/boost_1_70_0/stage/lib/libboost* .
chmod a+x libboost*
Note: the line rm -fr libboost* in /usr/lib64 is to remove the very old version of boost that you installed with yum.

fatal error: hdf5.h: No such file or directory [duplicate]

I am having trouble when installing Caffe Deep Learning Framework on Python:
When I run make command at caffe directory, it says
hdf5.h:no such directory
The steps I have done:
Update and upgrade my Ubuntu Server
Install Python 2.7
Having all of the dependencies base on http://caffe.berkeleyvision.org/install_apt.html
Run cp cp Makefile.config.example Makefile.config
Uncomment cpu_only = 1 in Makefile.config
I will be grateful if someone can help me.
Error message:
CXX src/caffe/util/hdf5.cpp
in file include from src/caffe/util/hdf5.cpp:1:0:
./include/caffe/util/hdf5.hpp:6:18: fatal error: hdf5.h: No such file or directory
compilation terminated
Makefile:572 recipe for target '.build_release/src/caffe/util/hdf5.o'
failed Make:*** [.build_release/src/caffe/util/hdf5.o] Error 1
What is the version of your Ubuntu install? Try this. In your Makefile.config try to append /usr/include/hdf5/serial/ to INCLUDE_DIRS:
--- INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include
+++ INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include /usr/include/hdf5/serial/
and rename hdf5_hl and hdf5 to hdf5_serial_hl and hdf5_serial in the Makefile:
--- LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_hl hdf5
+++ LIBRARIES += glog gflags protobuf boost_system boost_filesystem m hdf5_serial_hl hdf5_serial
More about the bug fix here.
This solution worked for me on the Ubuntu16.04LTS
sudo apt-get install libhdf5-10
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-cpp-11
find /usr -iname "*hdf5.h*"
/usr/include/hdf5/serial/hdf5.h
export CPATH="/usr/include/hdf5/serial/"
Another case I've experienced with:
I was using Ubuntu 14.04 and installing hdf5-1.10.0.
I found hdf5.h was located in /usr/local/hdf5/include. Thus, I modified Makefile.config file by adding that location to INCLUDE_DIRS.
# Whatever else you find you need goes here.
INCLUDE_DIRS := $(PYTHON_INCLUDE) /usr/local/include \
/usr/local/hdf5/include
I didn't rename anything in Makefile. It worked fine.
It did not work for me on Ubuntu16.04 LTS.
So I had to
sudo apt-get install libhdf5-10
sudo apt-get install libhdf5-serial-dev
sudo apt-get install libhdf5-dev
sudo apt-get install libhdf5-cpp-11
find /usr -iname "*hdf5.h*"
/usr/include/hdf5/serial/hdf5.h
Now do this
export CPATH="/usr/include/hdf5/serial/"
On RHEL7, I got tired of hunting for specific hdf5 RPMs and ran:
sudo yum install *hdf5*
and these are what I have:
hdf5-openmpi3-static-1.8.12-11.el7.x86_64
hdf5-1.8.12-11.el7.x86_64
hdf5-openmpi-static-1.8.12-11.el7.x86_64
hdf5-openmpi3-devel-1.8.12-11.el7.x86_64
hdf5-openmpi3-1.8.12-11.el7.x86_64
hdf5-mpich-devel-1.8.12-11.el7.x86_64
hdf5-devel-1.8.12-11.el7.x86_64
hdf5-openmpi-devel-1.8.12-11.el7.x86_64
hdf5-mpich-static-1.8.12-11.el7.x86_64
hdf5-mpich-1.8.12-11.el7.x86_64
hdf5-openmpi-1.8.12-11.el7.x86_64
Thanks to #loretoparisi, I was able to figure out where I had the header file I was missing and the problem went away.
$ find /usr -iname "*hdf5.h*"
/usr/include/openmpi-x86_64/hdf5.h
/usr/include/hdf5.h
/usr/include/mpich-x86_64/hdf5.h
/usr/include/openmpi3-x86_64/hdf5.h

How to recover default boost installation on ubuntu?

I was trying to compile boost 1.62 from source on ubuntu 12.04 where the default version is 1.48. During the course of trying everything, I removed boost from /usr/include/boost and libboost* from /usr/lib using the following commands
sudo rm -r /usr/include/boost
sudo rm -r /usr/include/libboost*
I have realized that now I need the default version (1.48) for my program to work. But when I use the following command
sudo apt-get install libboost-dev-all
it seems to install the libboost, but I am not able to see any boost directory in /usr/include. Moreover, I tried compiling a few programs with cmake and it also doesn't seem to find any boost library on the system.
Is it not possible to reinstall libboost if the libraries and headers have been removed manually ?
from the ubuntu forums :
choices:
sudo apt-get install --reinstall mypackage
sudo dpkg-reconfigure mypackage
( or if the other solutions have failed:
sudo apt-get purge mypackage && sudo apt-get install mypackage
and logout/in )
give it a shot !
also if you don't see any librarie after installing one you can run :
sudo ldconfig
The above command will make ld (the dynamic libraries loader) aware of the new libraries.