Ошибка компилятора при установке привязок yarp python - PullRequest
1 голос
/ 04 марта 2020

Я пытаюсь установить привязки 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?!

Ответы [ 2 ]

0 голосов
/ 05 марта 2020

Возможно, проблема в Swig 3.0.10, который не поддерживает некоторые части C ++ 11. Я предлагаю попробовать с более новой версией Swig (3.0.12 или новее).

0 голосов
/ 04 марта 2020

Предупреждение, которое вы получаете при запуске 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 должен начинаться с команды project() в начале файла CMake верхнего уровня. ; в этом случае ваш не сделал. Это означает, что вы можете запускать cmake из неправильного каталога.

Документация для построения привязок YARP явно сообщает:

Примечание: все команды cmake и make относятся к main каталогу сборки YARP.

Итак, вам следует попробовать настроить CMake из root каталог YARP, а не каталог bindings.

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