1

I'm trying to install the python bindings for yarp. YARP is already installed without any issues. I moved into my_yarp_root_dir/bindings/build and then ran:

cmake .. -DYARP_COMPILE_BINDINGS:BOOL=ON -DCREATE_PYTHON:BOOL=ON -DYARP_USE_PYTHON_VERSION=3.5 -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so -DCMAKE_INSTALL_PYTHONDIR=lib/python3.5/dist-packages -DPYTHON_EXECUTABLE=/usr/bin/python3.5

I got this without any problems:

 CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- The C compiler identification is Clang 3.8.1
-- The CXX compiler identification is Clang 3.8.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- 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
-- Found YARP: /usr/local/lib/cmake/YARP (found version "3.3.102+20200221.4+gita6fd00f6d")
-- Found SWIG: /usr/bin/swig3.0 (found suitable version "3.0.10", minimum required is "3.0") 
--  [x] Bindings (YARP_COMPILE_BINDINGS)
--  [ ]   Java bindings (CREATE_JAVA)
--  [x]   Python bindings (CREATE_PYTHON)
--  [ ]   Perl bindings (CREATE_PERL)
--  [ ]   CSharp bindings (CREATE_CSHARP)
--  [ ]   TCL bindings (CREATE_TCL)
--  [ ]   Ruby bindings (CREATE_RUBY)
--  [ ]   Lua bindings (CREATE_LUA)
--  [ ]   Octave bindings (CREATE_OCTAVE)
-- Found PythonInterp: /usr/bin/python3.5 (found suitable version "3.5.3", minimum required is "3.5") 
-- Found PythonLibs: /usr/lib/x86_64-linux-gnu/libpython3.5m.so (found suitable exact version "3.5.3") 
-- Configuring done
-- Generating done
-- Build files have been written to: /home/anthony/Documents/YARP/yarp/bindings/build

Then I did: sudo make install

Here are the errors I got:

/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:145999:3: error: use of undeclared identifier 'iterator'; did you mean '__gnu_cxx::iterator'?
  iterator result;
  ^~~~~~~~
  __gnu_cxx::iterator
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_iterator.h:755:14: note: '__gnu_cxx::iterator' declared here
  using std::iterator;
             ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:145999:3: error: no template named 'iterator'; did you mean '__gnu_cxx::iterator'?
  iterator result;
  ^~~~~~~~
  __gnu_cxx::iterator
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_iterator.h:755:14: note: '__gnu_cxx::iterator' declared here
  using std::iterator;
             ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:145999:3: error: use of class template 'iterator' requires template arguments
  iterator result;
  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_iterator_base_types.h:118:12: note: template is declared here
    struct iterator
           ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146012:39: error: no template named 'iterator'; did you mean '__gnu_cxx::iterator'?
  resultobj = SWIG_NewPointerObj((new iterator(static_cast< const iterator& >(result))), SWIGTYPE_p_iterator, SWIG_POINTER_OWN |  0 );
                                      ^~~~~~~~
                                      __gnu_cxx::iterator
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:1188:89: note: expanded from macro 'SWIG_NewPointerObj'
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
                                                                                        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_iterator.h:755:14: note: '__gnu_cxx::iterator' declared here
  using std::iterator;
             ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146012:39: error: use of class template 'iterator' requires template arguments
  resultobj = SWIG_NewPointerObj((new iterator(static_cast< const iterator& >(result))), SWIGTYPE_p_iterator, SWIG_POINTER_OWN |  0 );
                                      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_iterator_base_types.h:118:12: note: template is declared here
    struct iterator
           ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146025:3: error: use of undeclared identifier 'iterator'; did you mean '__gnu_cxx::iterator'?
  iterator result;
  ^~~~~~~~
  __gnu_cxx::iterator
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_iterator.h:755:14: note: '__gnu_cxx::iterator' declared here
  using std::iterator;
             ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146025:3: error: no template named 'iterator'; did you mean '__gnu_cxx::iterator'?
  iterator result;
  ^~~~~~~~
  __gnu_cxx::iterator
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_iterator.h:755:14: note: '__gnu_cxx::iterator' declared here
  using std::iterator;
             ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146025:3: error: use of class template 'iterator' requires template arguments
  iterator result;
  ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_iterator_base_types.h:118:12: note: template is declared here
    struct iterator
           ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146038:39: error: no template named 'iterator'; did you mean '__gnu_cxx::iterator'?
  resultobj = SWIG_NewPointerObj((new iterator(static_cast< const iterator& >(result))), SWIGTYPE_p_iterator, SWIG_POINTER_OWN |  0 );
                                      ^~~~~~~~
                                      __gnu_cxx::iterator
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:1188:89: note: expanded from macro 'SWIG_NewPointerObj'
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
                                                                                        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_iterator.h:755:14: note: '__gnu_cxx::iterator' declared here
  using std::iterator;
             ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146038:39: error: use of class template 'iterator' requires template arguments
  resultobj = SWIG_NewPointerObj((new iterator(static_cast< const iterator& >(result))), SWIGTYPE_p_iterator, SWIG_POINTER_OWN |  0 );
                                      ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_iterator_base_types.h:118:12: note: template is declared here
    struct iterator
           ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146051:3: error: unknown type name 'const_iterator'; did you mean 'std::_Bit_const_iterator::const_iterator'?
  const_iterator result;
  ^~~~~~~~~~~~~~
  std::_Bit_const_iterator::const_iterator
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:305:34: note: 'std::_Bit_const_iterator::const_iterator' declared here
    typedef _Bit_const_iterator  const_iterator;
                                 ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146061:12: error: no viable overloaded '='
    result = ((yarp::sig::VectorOf< double > const *)arg1)->begin();
    ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:300:10: note: candidate function (the implicit copy assignment operator) not viable: no known conversion from
      'const_iterator' (aka '__normal_iterator<const double *, std::vector<double, std::allocator<double> > >') to 'const std::_Bit_const_iterator' for 1st argument
  struct _Bit_const_iterator : public _Bit_iterator_base
         ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:300:10: note: candidate function (the implicit move assignment operator) not viable: no known conversion from
      'const_iterator' (aka '__normal_iterator<const double *, std::vector<double, std::allocator<double> > >') to 'std::_Bit_const_iterator' for 1st argument
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146064:39: error: unknown type name 'const_iterator'; did you mean 'std::_Bit_const_iterator::const_iterator'?
  resultobj = SWIG_NewPointerObj((new const_iterator(static_cast< const const_iterator& >(result))), SWIGTYPE_p_const_iterator, SWIG_POINTER_OWN |  0 );
                                      ^~~~~~~~~~~~~~
                                      std::_Bit_const_iterator::const_iterator
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:1188:89: note: expanded from macro 'SWIG_NewPointerObj'
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
                                                                                        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:305:34: note: 'std::_Bit_const_iterator::const_iterator' declared here
    typedef _Bit_const_iterator  const_iterator;
                                 ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146064:73: error: unknown type name 'const_iterator'; did you mean 'std::_Bit_const_iterator::const_iterator'?
  resultobj = SWIG_NewPointerObj((new const_iterator(static_cast< const const_iterator& >(result))), SWIGTYPE_p_const_iterator, SWIG_POINTER_OWN |  0 );
                                                                        ^~~~~~~~~~~~~~
                                                                        std::_Bit_const_iterator::const_iterator
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:1188:89: note: expanded from macro 'SWIG_NewPointerObj'
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
                                                                                        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:305:34: note: 'std::_Bit_const_iterator::const_iterator' declared here
    typedef _Bit_const_iterator  const_iterator;
                                 ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146117:3: error: unknown type name 'const_iterator'; did you mean 'std::_Bit_const_iterator::const_iterator'?
  const_iterator result;
  ^~~~~~~~~~~~~~
  std::_Bit_const_iterator::const_iterator
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:305:34: note: 'std::_Bit_const_iterator::const_iterator' declared here
    typedef _Bit_const_iterator  const_iterator;
                                 ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146127:12: error: no viable overloaded '='
    result = ((yarp::sig::VectorOf< double > const *)arg1)->end();
    ~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:300:10: note: candidate function (the implicit copy assignment operator) not viable: no known conversion from
      'const_iterator' (aka '__normal_iterator<const double *, std::vector<double, std::allocator<double> > >') to 'const std::_Bit_const_iterator' for 1st argument
  struct _Bit_const_iterator : public _Bit_iterator_base
         ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:300:10: note: candidate function (the implicit move assignment operator) not viable: no known conversion from
      'const_iterator' (aka '__normal_iterator<const double *, std::vector<double, std::allocator<double> > >') to 'std::_Bit_const_iterator' for 1st argument
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146130:39: error: unknown type name 'const_iterator'; did you mean 'std::_Bit_const_iterator::const_iterator'?
  resultobj = SWIG_NewPointerObj((new const_iterator(static_cast< const const_iterator& >(result))), SWIGTYPE_p_const_iterator, SWIG_POINTER_OWN |  0 );
                                      ^~~~~~~~~~~~~~
                                      std::_Bit_const_iterator::const_iterator
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:1188:89: note: expanded from macro 'SWIG_NewPointerObj'
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
                                                                                        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:305:34: note: 'std::_Bit_const_iterator::const_iterator' declared here
    typedef _Bit_const_iterator  const_iterator;
                                 ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146130:73: error: unknown type name 'const_iterator'; did you mean 'std::_Bit_const_iterator::const_iterator'?
  resultobj = SWIG_NewPointerObj((new const_iterator(static_cast< const const_iterator& >(result))), SWIGTYPE_p_const_iterator, SWIG_POINTER_OWN |  0 );
                                                                        ^~~~~~~~~~~~~~
                                                                        std::_Bit_const_iterator::const_iterator
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:1188:89: note: expanded from macro 'SWIG_NewPointerObj'
#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(NULL, ptr, type, flags)
                                                                                        ^
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:305:34: note: 'std::_Bit_const_iterator::const_iterator' declared here
    typedef _Bit_const_iterator  const_iterator;
                                 ^
/home/anthony/Documents/YARP/yarp/bindings/build/lib/python/yarpPYTHON_wrap.cxx:146183:3: error: unknown type name 'const_iterator'; did you mean 'std::_Bit_const_iterator::const_iterator'?
  const_iterator result;
  ^~~~~~~~~~~~~~
  std::_Bit_const_iterator::const_iterator
/usr/bin/../lib/gcc/x86_64-linux-gnu/6.3.0/../../../../include/c++/6.3.0/bits/stl_bvector.h:305:34: note: 'std::_Bit_const_iterator::const_iterator' declared here
    typedef _Bit_const_iterator  const_iterator;
                                 ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]

Does anyone know how to fix it, because I guess I'm not supposed to edit the yarp files?!

Kevin
  • 16,549
  • 8
  • 60
  • 74
mhzar
  • 31
  • 4

2 Answers2

0

The warning you get when running CMake indicates that something is not quite right:

CMake Warning (dev) in CMakeLists.txt:
  No project() command is present.  The top-level CMakeLists.txt file must
  contain a literal, direct call to the project() command.  Add a line of
  code such as

    project(ProjectName)

  near the top of the file, but after cmake_minimum_required().

  CMake is pretending there is a "project(Project)" command on the first
  line.

Every CMake-based project should start with a project() command near the beginning of the top-level CMake file; in this case, yours did not. This indicates you may be running cmake from the wrong directory.

The documentation for building the YARP bindings explicitly states:

Note: all the cmake and make commands are referring to the main YARP build directory.

So, you should try configuring CMake from the root YARP directory, not the bindings directory.

cd my_yarp_root_dir/build
cmake .. -DYARP_COMPILE_BINDINGS:BOOL=ON -DCREATE_PYTHON:BOOL=ON -DYARP_USE_PYTHON_VERSION=3.5 -DPYTHON_INCLUDE_DIR=/usr/include/python3.5m -DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.5m.so -DCMAKE_INSTALL_PYTHONDIR=lib/python3.5/dist-packages -DPYTHON_EXECUTABLE=/usr/bin/python3.5
Kevin
  • 16,549
  • 8
  • 60
  • 74
  • Ok thank you i'll look into it but do you think it is related to the errors ? I thought it was more related to C++ – mhzar Mar 05 '20 at 08:50
  • @mhzar Yes, it could be. There is a lot of other code (and potentially compiler settings) in that repository that you exclude from your build by calling CMake from an interior sub-directory. – Kevin Mar 05 '20 at 12:37
0

The problem might be Swig 3.0.10, which does not support some parts of C++11. I suggest to try with a newer version of Swig (3.0.12 or newer).