Gtest_main _dir not found while installing libqi for ros-nao - ros

I am trying to install libqi for nao-ros and it gives me error: I already have gtest package but gtest_main is missing.
CMake Error at /home/shruti/d-prefix/share/cmake/qibuild/internal/uselib.cmake:80 (find_package): By not providing "FindGTEST_MAIN.cmake" in CMAKE_MODULE_PATH this project has asked CMake to find a package configuration file provided by "GTEST_MAIN", but CMake did not find one.
Could not find a package configuration file provided by "GTEST_MAIN" with any of the following names:
GTEST_MAINConfig.cmake
gtest_main-config.cmake
Add the installation prefix of "GTEST_MAIN" to CMAKE_PREFIX_PATH or set "GTEST_MAIN_DIR" to a directory containing one of the above files. If "GTEST_MAIN" provides a separate development package or SDK, be sure it has been installed.
Any one knows about it?

I had the same problem when trying to build libqi and fixed it by:
cd /usr/share/cmake-3.0/Modules
ln -s FindGTest.cmake FindGTEST_MAIN.cmake

Related

install MongoDB C++ Driver problem in ubuntu 16.04

I want to install MongoDB C++ Driver, so first is mongocxx
I follow this installation:
http://mongocxx.org/mongocxx-v3/installation/
but I can not pass step 4
when I run this in mongo-cxx-driver/build
sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
it shows
-- Auto-configuring bsoncxx to use MNMLSTC for polyfills since C++17 is inactive
CMake Error at src/mongocxx/CMakeLists.txt:37 (find_package):
By not providing "Findlibmongoc-1.0.cmake" in CMAKE_MODULE_PATH this
project has asked CMake to find a package configuration file provided by
"libmongoc-1.0", but CMake did not find one.
Could not find a package configuration file provided by "libmongoc-1.0"
(requested version 1.13.0) with any of the following names:
[![enter image description here][1]][1]
libmongoc-1.0Config.cmake
libmongoc-1.0-config.cmake
Add the installation prefix of "libmongoc-1.0" to CMAKE_PREFIX_PATH or set
"libmongoc-1.0_DIR" to a directory containing one of the above files. If
"libmongoc-1.0" provides a separate development package or SDK, be sure it
has been installed.
second question,
Step 2: Choose a C++17 polyfill how can I set MNMLSTC/core?
does anyone can help me,I already trap here for a long time ?
my env:
mongo-c-driver 1.15.1
libmongoc-1.0
mongocxx-3.4.x
Cmake is complaining about not finding a package configuration file (xxx.cmake), probably because you didn't build libmongoc/libbson.
I've tried to reproduce your issue and hit the same problem when I only installed them (apt-get install), so my suggestion is that you get the sources and build them as described at: http://mongoc.org/libmongoc/current/installing.html
Here's the list of commands (with the latest version of mongo-c-driver=1.15.1) which I just tried and worked fine:
wget https://github.com/mongodb/mongo-c-driver/releases/download/1.15.1/mongo-c-driver-1.15.1.tar.gz
tar xzf mongo-c-driver-1.15.1.tar.gz
cd mongo-c-driver-1.15.1
mkdir cmake-build
cd cmake-build
cmake -DENABLE_AUTOMATIC_INIT_AND_CLEANUP=OFF ..
make
sudo make install
At this point you can go back into mongocxx/build and run again the command you were stuck at:
cd ../../mongo-cxx-driver/build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..

Trying to build OpenSfm but my OpenCv build doesn't have the proper Cmake file

I tried running 'python setup.py build' to build Open SfM. I had used the instructions off the OpenCV website to build OpenCV using gitbash and Cmake in my lib folde without any errors.
However the OpenSfM build error says: Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
I can't for the life of me find these files. I tried downloading the OpenCv package again and running it through a Cmake GUI but I get an error saying there's no CmakeLists.txt files.
Help?
You need to not just generate the files using CMake but also use either an application like VisualStudio or command line to build the files.
Once you build the files, the OpenCVConfig.cmake files are generated, which you use to point to the OpenSFM compilation.

How do i include opencv into my catkin_workspace?

I am currently having issues with the find_package(opencv) which give me the error message:
-- Could not find the required component 'OpenCV'. The following CMake error indicates that you either need to install the package with the same name or change your environment so that it can be found.
CMake Error at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:83 (find_package):
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
So.. Yeah, a solution would add the prefix_path, but how do i make it work with find_package() without explicitly stating the path it has to look for.. why can't it find it in the first place, the problem by doing this is that the CMakelist is shared amongst a group a people, in which I am the only one having this issue despite, having the .cmake file at the same location..
I am running it on a ubuntu machine.
OpenCV v2.4.8
And the .cmake files are located at
/usr/local/share/OpenCV/OpenCVConfig.cmake
/usr/share/OpenCV/OpenCVConfig.cmake
opencv is installed as sudo apt-get install libopencv-dev

Compiling using cmake with dependencies installed using macport

I'm trying to build project that has dependency to OpenCV. I installed Opencv using macports and when I try to build project, cmake gives the following output:
CMake Error at CMakeLists.txt:47 (FIND_PACKAGE):
By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "OpenCV", but
CMake did not find one.
Could not find a package configuration file provided by "OpenCV" with any
of the following names:
OpenCVConfig.cmake
opencv-config.cmake
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files. If "OpenCV"
provides a separate development package or SDK, be sure it has been
installed.
I searched a little bit about this problem and added the following env. variables to my $HOME/.profile file
export DYLD_LIBRARY_PATH=/opt/local/lib:$DYLD_LIBRARY_PATH
export CMAKE_PREFIX_PATH=/opt/local
without success. I checked and I have all opencv files istalled in /opt/local/lib and /opt/local/include/opencv directories. There is also OpenCVConfig.cmake in the following path:
/opt/local/lib/cmake/OpenCVConfig.cmake
How to make cmake know the path where opencv is installed? Previously I've build OpenCV on my own using cmake and installed into /usr/local and then it worked fine without any other fix. However I had some problems with ffmpeg and right now I switched to using macports.
Another option that works for me was set the env value OpenCV_DIR at the cmake opencv dir:
export OpenCV_DIR=/opt/local/lib/cmake/
macports traditionally installs OpenCV to /opt/local/ instead of the standard /usr/local/.
The solution to your problem is stated at:
Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
"OpenCV_DIR" to a directory containing one of the above files.
When building your project in the command-line, make sure you execute:
export PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/opt/local/lib/pkgconfig
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/local/lib
And then set the flag CMAKE_PREFIX_PATH for cmake:
cmake -D CMAKE_PREFIX_PATH=/opt/local ../
Not a MACPORT problem, but someone may find this helpful. Followed #hugh-pearse 's and #leszek-hanusz 's answers in this question, with a little tweak. I had installed opencv from ubuntu 12.10 repository (libopencv-)* and had the same problem. Couldn't solve it with export OpenCV_DIR=/usr/share/OpenCV/ (since my OpenCVConfig.cmake whas there). It was solved when I changed some lines on the OpenCVConfig.cmake file:
# ======================================================
# Include directories to add to the user project:
# ======================================================
# Provide the include directories to the caller
#SET(OpenCV_INCLUDE_DIRS "${OpenCV_INSTALL_PATH}/include/opencv;${OpenCV_INSTALL_PATH}/include")
SET(OpenCV_INCLUDE_DIRS "/usr/include/opencv;/usr/include/opencv2")
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
# ======================================================
# Link directories to add to the user project:
# ======================================================
# Provide the libs directory anyway, it may be needed in some cases.
#SET(OpenCV_LIB_DIR "${OpenCV_INSTALL_PATH}/lib")
SET(OpenCV_LIB_DIR "/usr/lib")
LINK_DIRECTORIES(${OpenCV_LIB_DIR})
And that worked on my Ubuntu 12.10. Remember to add the target_link_libraries(yourprojectname ${OpenCV_LIBS}) in your CMakeLists.txt.
I finally read the header of the OpenCVConfig.cmake file.
It instructs to include these lines to use from an external project:
find_package(OpenCV REQUIRED)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(MY_TARGET_NAME ${OpenCV_LIBS})
(adding include_directories to CMakeLists.txt fixed it for me)
Make sure you have compiled OpenCV, once you compiled, OpenCVConfig.cmake will be generated in build directory.
follow these steps to compile
then , export OpenCV_DIR=<path to build directory with OpenCVConfig.cmake>
It should work now !
I tried all the above ideas in vain.
I eventually found a way to have the compilation work: Besides using #kengregson steps, I simply renamed the folder /usr/local/include/opencv2 so that it is not chosen when compiling my cpp file.
Since I compile my own OpenCV in a multiple-users server, so I can't install the OpenCV libs in /usr/local directly, but in my home folder instead, then exactly the same issue occurs to me.
Below is how I fix it:
Flowing the steps in OpenCV official doc: Using OpenCV with gcc and CMake
Add displayImage test program, and use this CMake file
cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV)
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
The same error happened, so add one environment variable in my .tcshrc
setenv OpenCV_DIR "${folder where contains OpenCVConfig.cmake }"
\# mine is:
setenv OpenCV_DIR "~/local/OpenCV2.4.13/share/OpenCV"

CMake can't find FFMPEG in custom install path

I am compiling a dependency for a project on Ubuntu 10.10, and instead of having it install to /usr/local by default, I am instead installing it to /tmp/stage/usr/local. How do I go about informing CMake of the location of this custom installed dependency when I call it to generate the build files for said project.
I am running CMake 2.8.1, and I have tried to set CMAKE_PREFIX_PATH on the cmake command line, like so
cmake -D CMAKE_PREFIX_PATH=/tmp/stage/usr/local
but this doesn't seem to make a difference - the project doesn't seem to detect the dependency.
Also, if it matters, the project in question is OpenCV 2.2, and the dependency in question is FFMPEG...
I figured out how to fix my problem, and trying to point CMake at the appropriate install location isn't the issue.
Apparently, CMake is unable to find the pkg-config files for FFMPEG (i.e. libavcodec.pc, libavdevice.pc, etc.) that tell it where the FFMPEG headers and libraries are located. In a typical install scenario, these files would be located at /usr/lib/pkgconfig. However because of the custom install location, they are instead located at /tmp/stage/usr/local/lib/pkgconfig.
So that CMake could find these files, I had to add the following environment variable:
export PKG_CONFIG_PATH=/tmp/stage/usr/local/lib/pkgconfig
After which point, OpenCV built against FFMPEG as expected.

Resources