Building OSRM on Ubuntu, CMake fails with "Intel TBB NOT found!" message - cmake

I am following this tutorial to build OSRM-backend from source.
When it says:
cd build
cmake /srv/osrm/osrm-backend/
I got this error message:
ERROR: Intel TBB NOT found!
-- Looked for Threading Building Blocks in /usr
CMake Error at cmake/FindTBB.cmake:274 (message):
Could NOT find TBB library.
Call Stack (most recent call first):
CMakeLists.txt:533 (find_package)
I have installed TBB:
sudo apt install -y libtbb
And it looks good:
/usr/lib/x86_64-linux-gnu/libtbb.so
/usr/lib/x86_64-linux-gnu/libtbb.so.2
(...)
But cmake fails.

I'd go to the file from the error message and see that it can't find the library at some default paths.
It means we have to help cmake a bit. At the beginning we can see that this module respects TBB_INSTALL_DIR. So I'd try setting it while configuring the project.

It's hard to find the solution, althought, it says, there're duplications:
This is a duplicate of #6248 and #6253. Building with
cmake -DENABLE_MASON=ON will fix it.
Surprisingly, on MacOS, there's a simple workaround:
brew install osrm-backend

Related

Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR)

I am trying to catkin_make in my catkin workspace, but I get the following error
CMake Deprecation Warning at gazebo_ros_demos/gazebo_tutorials/CMakeLists.txt:1
(cmake_minimum_required): Compatibility with CMake < 2.8.12 will be
removed from a future version of CMake.
Update the VERSION argument value or use a ... suffix to
tell CMake that the project does not need compatibility with older
versions.
-- Using these message generators: gencpp;geneus;genlisp;gennodejs;genpy
-- Found Boost: /usr/include (found suitable version "1.58.0", minimum required is "1.40.0") found components: thread signals system
filesystem program_options regex iostreams date_time chrono atomic
CMake Error at
/usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:230
(message): Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/share/cmake-3.20/Modules/FindPackageHandleStandardArgs.cmake:594
(_FPHSA_FAILURE_MESSAGE)
/usr/share/cmake-3.20/Modules/FindProtobuf.cmake:646
(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
/usr/lib/x86_64-linux-gnu/cmake/gazebo/gazebo-config.cmake:114
(FIND_PACKAGE) gazebo_ros_demos/gazebo_tutorials/CMakeLists.txt:11
(find_package)
-- Configuring incomplete, errors occurred! See also "/home/ashwin/catkin_ws/build/CMakeFiles/CMakeOutput.log". See also
"/home/ashwin/catkin_ws/build/CMakeFiles/CMakeError.log".
Makefile:5582: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1 Invoking "make
cmake_check_build_system" failed
This issue came up when I tried to update my cmake to 3.20. I am fairly new to Ubuntu. Would appreciate any help.
I have encountered the same issue (on ubuntu 18.04). Installing the following packages resolved the issue for me:
sudo apt-get install libprotobuf-dev protobuf-compiler
These are similar to the packages mentioned by K.S., but with those packages I got the same error as Ashwin mentioned in the comments on K.S.'s answer.

CMake 3.18.0 not finding libopenjpeg2

Please forgive my ignorance when is comes to Cmake. I'm trying to install Poppler 0.86.1 on Centos 7 but I am stuck with an error that says CMake Error at CMakeLists.txt:208 (message): Install libopenjpeg2 before trying to build poppler. I have installed libopenjpeg2 including the dev package by running the following:
sudo yum install openjpeg2-devel
I am taking the following steps to install poppler:
wget https://poppler.freedesktop.org/poppler-0.86.1.tar.xz
tar xf poppler-0.86.1.tar.xz
cd poppler-0.86.1/
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release ..
Which results in the following error
CMake Error at CMakeLists.txt:208 (message):
Install libopenjpeg2 before trying to build poppler. You can also decide
to use the internal unmaintained JPX decoder or none at all.
-- Configuring incomplete, errors occurred!
This is where the failure occurs in the CMakeLists.txt
if(ENABLE_LIBOPENJPEG STREQUAL "openjpeg2")
find_package(OpenJPEG)
set(WITH_OPENJPEG ${OpenJPEG_FOUND})
if(NOT OpenJPEG_FOUND OR OPENJPEG_MAJOR_VERSION VERSION_LESS 2)
message(FATAL_ERROR "Install libopenjpeg2 before trying to build poppler. You can also decide to use the internal unmaintained JPX decoder or none at all.")
endif()
...
Can anyone point me in the right direction in figuring out how to get Poppler 0.86.1 to successfully install on Centos 7?
If I remember correctly, I had the same problem when I was trying to use the latest version of the Poppler in my Docker image. I fixed it by installing libopenjp2-7-dev. Please check my answer, specifically, the second row of my Dockerfile where you can see what I installed before running cmake.
I hit this and it was due to https://github.com/uclouvain/openjpeg/issues/1174. I modified my local copy of /lib64/openjpeg-2.3/OpenJPEGConfig.cmake to work around this.

CMake io2d error missing CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES

I'm trying to follow the steps on this link:https://github.com/cpp-io2d/P0267_RefImpl/blob/master/BUILDING.md
to install io2d.
However I get an error message after I write the cmake ..:
C:\Users\walid\Desktop\Udacity_Nanodegree\RoutePlanningProject\build>cmake ..
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
CMake Error at CMakeLists.txt:15 (find_package):
By not providing "Findio2d.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "io2d", but
CMake did not find one.
Could not find a package configuration file provided by "io2d" with any of
the following names:
io2dConfig.cmake
io2d-config.cmake
Add the installation prefix of "io2d" to CMAKE_PREFIX_PATH or set
"io2d_DIR" to a directory containing one of the above files. If "io2d"
provides a separate development package or SDK, be sure it has been
installed.
-- Configuring incomplete, errors occurred!
See also "C:/Users/walid/Desktop/Udacity_Nanodegree/RoutePlanningProject/build/CMakeFiles/CMakeOutput.log".
Therefore I found this suggestion On StackOverflow:
CMake third-party library installation
But I get a new error message here it is:
cmake --config Debug "-DCMAKE_BUILD_TYPE=Debug" ..
-- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.18362.
Default IO2D backend was not specified, choosing automatically...
Found Windows, using CAIRO_WIN32.
-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
CMake Error at C:/CMake/cmake-3.17.3-win64-x64/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:164 (message):
Could NOT find Cairo (missing: CAIRO_INCLUDE_DIRS CAIRO_LIBRARIES)
Call Stack (most recent call first):
C:/CMake/cmake-3.17.3-win64-x64/share/cmake-3.17/Modules/FindPackageHandleStandardArgs.cmake:445 (_FPHSA_FAILURE_MESSAGE)
cmake/FindCairo.cmake:102 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
P0267_RefImpl/P0267_RefImpl/cairo/CMakeLists.txt:5 (find_package)
PS: I'm using Windows, I have CMake,Make,g++ and gcc installed.
Here is a screenshot demonstrating that I have Cairo already installed:

"Could not find triehash executable" error

I was trying to build the apt repository, but ran into the following error when running cmake ..:
CMake Error at CMakeLists.txt:44 (message):
Could not find triehash executable
How do I fix this?
This cmake tries to find triehash utility in your system. Is it installed? If no use sudo apt install triehash

Error:Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)

I am using Point cloud library 1.5.1. When I run CMake 3.4.0-rc2 to build my project, it has error:
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
How do I fix this error?
This error is raised because the pkg-config utility is not available on your system.
Using PkgConfig with CMake is not a truly cross-platform solution, as Windows does not come with the pkg-config utility installed. (The PCL developers should instead use find_package() in their CMake. Perhaps, this is worth opening up a bug report on their Github.) On Linux, this is an easy fix; you can install pkg-config like this:
sudo apt-get install pkg-config
However, on Windows, the process is more involved. There are several solutions for installing pkg-config on Windows documented here. I'm not sure which most directly applies to your situation, so I suggest reading through some of those. After successfully installing the pkg-config utility on your Windows machine, clear your CMake cache, and re-run CMake. This should remove the error, and allow your build to proceed.
Install vcpkg: https://vcpkg.io/en/getting-started.html
Install pkgconf:
.\vcpkg install pkgconf
If use CMake, delete the Cache files/folders: CMakeCache.txt and CMakeFiles. After that, run the command
cmake .. -DCMAKE_TOOLCHAIN_FILE=C:\dev\vcpkg\scripts\buildsystems\vcpkg.cmake
On Fedora 34, it was because of multiple pkg-config
/home/sapillai/go/bin/pkg-config
/home/sapillai/go/bin/pkg-config
/usr/bin/pkg-config
/home/sapillai/go/bin/pkg-config
I deleted the others and kept /usr/bin/pkg-config. Error was gone.