ompl icon indicating copy to clipboard operation
ompl copied to clipboard

cmake PYTHON_EXEC points to python2 when building from source

Open nikhilprakash99 opened this issue 5 years ago • 3 comments

following the build instructions given in readme, cmake fails to find python modules

ompl/build/Release on  master 
➜ cmake ../..                               
-- The CXX compiler identification is GNU 9.3.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Build type: Release
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Checking for module 'ode'
--   No package 'ode' found
-- Checking for module 'flann'
--   No package 'flann' found
-- Checking for module 'libspot'
--   No package 'libspot' found
-- Could NOT find spot (missing: SPOT_LIBRARIES SPOT_INCLUDE_DIRS) 
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.17") found components: doxygen dot 
-- Could NOT find PY_pyplusplus (missing: PY_PYPLUSPLUS) 
-- Could NOT find PY_pygccxml (missing: PY_PYGCCXML) 
-- Found castxml: /usr/bin/castxml  
-- Checking for module 'yaml-cpp'
--   Found yaml-cpp, version 0.6.2
-- Found yaml-cpp: yaml-cpp  
-- The following features have been enabled:

 * OMPL_VERSIONED_INSTALL, Whether to install header files in
   <prefix>/include/ompl-X.Y/ompl, where X and Y are the major and minor
   version numbers
 * OMPL_BUILD_TESTS, Whether to build the unit tests.
 * OMPL_BUILD_DEMOS, Whether to build the OMPL demo programs.

-- The following OPTIONAL packages have been found:

 * Threads, <https://en.wikipedia.org/wiki/POSIX_Threads>
   Pthreads is sometimes needed, depending on OS / compiler.
 * Doxygen, <http://doxygen.org>
   Used to create the OMPL documentation (i.e., https://ompl.kavrakilab.org).
 * castxml, <https://github.com/CastXML/CastXML>
   Used to generate Python bindings.
 * PkgConfig, <https://www.freedesktop.org/wiki/Software/pkg-config/>
   Used to find (compilation flags for) dependencies.
 * yaml-cpp, <https://github.com/jbeder/yaml-cpp>
   Used for parsing input data for the PlanarManipulator demo.

-- The following REQUIRED packages have been found:

 * Eigen3, <http://eigen.tuxfamily.org>
   A linear algebra library used throughout OMPL.
 * Boost (required version >= 1.58), <https://www.boost.org>
   Used throughout OMPL for data serialization, graphs, etc.

-- The following features have been disabled:

 * OMPL_BUILD_PYBINDINGS, Whether to build the Python bindings.
 * OMPL_BUILD_PYTESTS, Whether to build/run the python binding unit tests.

-- The following OPTIONAL packages have not been found:

 * MORSE, <https://www.openrobots.org/wiki/morse>
   OMPL includes a plugin for the MORSE Robot Simulation engine.
 * ODE, <http://ode.org>
   The Open Dynamics Engine can be used as a "black box" for kinodynamic planning.
 * Triangle, <http://www.cs.cmu.edu/~quake/triangle.html>
   Used to create triangular decompositions of polygonal 2D environments.
 * flann (required version >= 1.8.3), <https://github.com/mariusmuja/flann>
   If detetected, FLANN can be used for nearest neighbor queries by OMPL.
 * spot, <http://spot.lrde.epita.fr>
   Used for constructing finite automata from LTL formulae.
 * Python, <https://www.python.org>
   Used for python bindings.

-- The following Python modules were NOT found:

 * pyplusplus pygccxml

-- Configuring done
-- Generating done
-- Build files have been written to: /home/nikhilprakash99/dev/B.Tech Project/ompl/build/Release

after a bit of digging in the make file, i was able to locate the error being caused due to a mismatch in python paths

adding a print statement at the beginning of the CMakeLists.txt file

image

gives the following output

image

I am unable to figure out what exactly sets the PYTHON_EXEC variable. From what i can see, this variable is set even before the script runs

a simple quick fix which worked for me was by running

cmake ../.. -DPYTHON_EXEC=/usr/bin/python3

though i am not facing problems now, it would be much appreciated if the build process works out of the box. it will especially be useful for people from the scientific community who might not have much experience with build tools

nikhilprakash99 avatar Dec 22 '20 15:12 nikhilprakash99

The build system will use whatever version of python corresponds to the python binary in the path. To use a specific version you need to run cmake ../.. -DPYTHON_EXEC=/path/to/python-X.Y. What should the expected behavior be instead?

mamoll avatar Dec 28 '20 00:12 mamoll

How did you install pyplusplus and pygccxml?

mamoll avatar Jan 23 '21 01:01 mamoll

I also had the same issue as OP.

For pyplusplus and pygccxml (don't forget castxml too), I followed the instructions here. Hope this helps others

Kchour avatar Apr 17 '21 05:04 Kchour