[安装Yarp python绑定时出现编译器错误

问题描述 投票:1回答:2

我正在尝试为yarp安装python绑定。已安装YARP,没有任何问题。我进入my_yarp_root_dir/bindings/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

我得到这个没有任何问题:

 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

然后我做了:sudo make install

这里是我得到的错误:

/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=]

有人知道如何修复它,因为我想我不应该编辑yarp文件吗?!

python cmake compiler-errors gnu yarp
2个回答
0
投票

运行CMake时收到的警告表明有些不对劲:

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.

每个基于CMake的项目都应在顶级CMake文件的开头附近以project()命令开头;在这种情况下,您没有。这表明您可能在错误的目录中运行cmake

用于构建YARP绑定的documentation 明确地状态:

注意:所有cmakemake命令都引用main YARP构建目录。

因此,您应该尝试从root YARP目录而不是bindings目录配置CMake。

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

0
投票

问题可能是Swig 3.0.10,它不支持C ++ 11的某些部分。我建议尝试使用较新版本的Swig(3.0.12或更高版本)。

© www.soinside.com 2019 - 2024. All rights reserved.