Cmake is unable to find boost_pyhton libraries in Homebrew - homebrew

I am trying to build a C++ code on Mac. I am using CMake for my setup. This is my file (note, I get an error with python3.7, python37, python, but more on that below):
find_package(Boost COMPONENTS python3.7)
message("Includes: ${Boost_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}")
I get the following error:
-- Found Boost 1.71.0 at /usr/local/lib/cmake/Boost-1.71.0
-- Requested configuration: QUIET COMPONENTS python3.7
-- BoostConfig: find_package(boost_headers 1.71.0 EXACT CONFIG QUIET HINTS /usr/local/lib/cmake)
-- Found boost_headers 1.71.0 at /usr/local/lib/cmake/boost_headers-1.71.0
-- BoostConfig: find_package(boost_python3.7 1.71.0 EXACT CONFIG QUIET HINTS /usr/local/lib/cmake)
-- Could NOT find Boost: missing: python3.7 (found /usr/local/lib/cmake/Boost-1.71.0/BoostConfig.cmake (found version "1.71.0"))
Includes: /usr/local/include /usr/local/Cellar/python/3.7.4_1/Frameworks/Python.framework/Versions/3.7/include/python3.7m
I am using the latest Homebrew
brew --version
Homebrew 2.1.12
Homebrew/homebrew-core (git revision 5b0c; last commit 2019-10-06)
And have loaded the available boost formulae.
brew list | grep boost
boost
boost-python
boost-python3
Looking under /usr/local/lib/cmake/ I see most of the boost libraries mentioned, but boost_python and boost_numpy are missing. I checked the online formulae definitions and boost does indeed include all the cmake setups in that directory, but boost_python3 does not include any.
Am I missing some package? Is there a portable way to setup this so that it automatically finds the libboost_python37.* files?

Because there is no python3.7 component. This component is called python37, at least for CMake 3.16 and earlier:
Note that Boost Python components require a Python version suffix (Boost 1.67 and later), e.g. python36 or python27 for the versions built against Python 3.6 and 2.7, respectively. This also applies to additional components using Python including mpi_python and numpy. Earlier Boost releases may use distribution-specific suffixes such as 2, 3 or 2.7. These may also be used as suffixes, but note that they are not portable

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 ..

Installation of Torch not working

I have installed Torch by following the instructions here, which comes with Lua 5.1, but Lua 5.3 was installed previously on my system. Now when I try to run a program using Torch, I get the following error messages:
/Users/Marcel/torch/install/share/lua/5.1/trepl/init.lua:389: module 'Settings.arguments' not found:No LuaRocks module found for Settings.arguments
no field package.preload['Settings.arguments']
no file '/usr/local/share/lua/5.1/Settings/arguments.lua'
no file '/usr/local/share/lua/5.1/Settings/arguments/init.lua'
It would seem as if Torch is looking for its own version of Lua in the system directories, which only contain the previously installed version. Is there any way to fix this, or must I uninstall the Lua 5.3?
Thanks!
Simply change TORCH_LUA_VERSION value to LUAXX, as it is explain in installation instructions with 5.2 version. For 5.3 version, use LUA53:
git clone https://github.com/torch/distro.git ~/torch --recursive
cd ~/torch
# clean old torch installation
./clean.sh
# optional clean command (for older torch versions)
# curl -s https://raw.githubusercontent.com/torch/ezinstall/master/clean-old.sh | bash
# https://github.com/torch/distro : set env to use lua
TORCH_LUA_VERSION=LUA53 ./install.sh

Opencv headers different version and libraries different version: ubuntu

I am new to Ubuntu and OpenCV. Apologies for my amateurishness.
I think I messed up OpenCV installation.
I had installed OpenCV 2.4 months back. The installation was successful (built openCV from source using CMake)
Couple of days back I had also installed OpenCV 3.0 using the same procedure.
The problem began when one of my code gave a segmentation fault for seemingly no reason. On suggestion by a friend on Caffe Neural Network issues forum (https://github.com/BVLC/caffe/issues/3416), it seems that I am compiling with 3.0 headers but linking against the 2.4 libraries.
I checked /usr/local/include. It has the standard openCv header files ( I didn't understand what 'compiling with 3.0 header means' )
In /usr/local/lib I have OpenCV 3.0 libraries ( no 2.4.8 at all).
Now compilation was successful, but when I try to run it, I get the following error.
Program received signal SIGSEGV, Segmentation fault.
0x00007ffff76c49bc in cv::merge(cv::_InputArray const&,
cv::_OutputArray const&) ()
from /usr/lib/x86_64-linux-gnu/libopencv_core.so.2.4
Just to add
"pkg-config --modversion opencv"
3.0.0
whereas dpkg -l | grep libopencv
gave out
i libopencv-calib3d-dev:amd64 2.4.8+dfsg1-2ubuntu1 amd64 development files for libopencv-calib3d
ii libopencv-calib3d2.4:amd64 2.4.8+dfsg1-2ubuntu1 amd64 computer vision Camera Calibration library
ii libopencv-contrib-dev:amd64 2.4.8+dfsg1-2ubuntu1 amd64 development files for libopencv-contrib
.......
q.1> why does my code link to libopencv_core.so.2.4 instead of 3.0. I have checked in /usr/local/lib and did not see a single 2.4 library. I have tried manually defining links to header files and libraries in CMake but still same result.
q.2> Do OpenCV headers have a version number? I don't understand how they are called '2.4 headers'. I have checked the source code but did not see any specific requirement for a version of library. Then what dictates to link to 2.4 version libraries?
Sorry if this is theoretical but this would be highly beneficial to beginners like me. Please do comment for a suitable question title if the current one is not appropriate.
Thanks
Your opencv2.4 libraries are located in /usr/lib/x86_64-linux-gnu/ while the new opencv3 libraries are most likely located in /usr/local/lib. The linker is first looking in the /usr/lib/x86_64-linux-gnu/ directory, and thus finding the opencv2.4 libs first. To fix this you can tell the linker to look in /usr/local/lib first by adding the following to your ~/.bashrc file
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
Reload the bashrc file in the terminal as follows (or simply close and re-open the terminal):
source ~/.bashrc
And update the library database:
sudo ldconfig
To check the order in which the linker will search for libraries, you can use the following:
ld -lopencv_core --verbose | grep attempt

Unsupported HDF5 version

Trying to install Pytables, and I've installed almost all dependencies:
However, when I'm trying to install pytables:
* Found numpy 1.7.0b1 package installed.
* Found numexpr 2.0.1 package installed.
* Found Cython 0.16 package installed.
* Found HDF5 headers at ``/home/xug/pytables/hdf5/include``, library at ``/home/xug/pytables/hdf5/lib``.
.. ERROR:: Unsupported HDF5 version!
What does "unsupported HDF5 version" mean?
Although the author of the question has answered it in the comment, I think it is appropriate to have the (perhaps a bit more verbose) answer here too.
As mentioned, the problem is caused by a wrong (or lacking) systemwide version of HDF5 libraries. In my case, I solved it by compiling a newer version and installing it locally:
$ wget http://www.hdfgroup.org/ftp/HDF5/current/src/hdf5-1.8.11.tar.bz2
$ tar xjvf hdf5-1.8.11.tar.bz2
$ cd hdf5-1.8.11
$ configure --prefix=~/localroot
$ make -j 8
$ make install
It is then necessary to specify the path to this local installation before compiling package:
$ export HDF5_DIR=~/localroot
$ pip install tables
Finally, ~/localroot/lib must be in LD_LIBRARY_PATH for PyTables to work, so I added the line
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/localroot/lib
to ~/.bashrc

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