ompl icon indicating copy to clipboard operation
ompl copied to clipboard

declaration_not_found_t for ompl::base::ProjectionEvaluator and vector< std::string >

Open jonathanglima opened this issue 4 years ago • 6 comments

Hey, archlinux user here trying to build ompl with python bindings. While running ninja update_bindings I get the following errors.

I'm running python 3.9.7 with pyenv and virtualenvwrapper. Any suggestions?

I've installed the dependencies that show up in cmake and enabled OMPL_BUILD_PYBINDINGS=On.

Edit: hiding user folder structure below

  File "<hidden>/.cache/yay/ompl/src/ompl-1.5.2/py-bindings/generate_bindings.py", line 950, in <module>
    globals()['ompl_'+module+'_generator_t']()
  File "<hidden>/.cache/yay/ompl/src/ompl-1.5.2/py-bindings/generate_bindings.py", line 878, in __init__
    code_generator_t.__init__(self, 'util', None, replacement, 1)
  File "<hidden>/.cache/yay/ompl/src/ompl-1.5.2/py-bindings/ompl/bindings_generator.py", line 146, in __init__
    self.filter_declarations()
  File "<hidden>/.cache/yay/ompl/src/ompl-1.5.2/py-bindings/generate_bindings.py", line 893, in filter_declarations
    self.std_ns.class_('vector< std::string >').include()
  File "<hidden>/.virtualenvs/msc_simulation_env/lib/python3.9/site-packages/pygccxml/declarations/scopedef.py", line 546, in class_
    self._find_single(
  File "<hidden>/.virtualenvs/msc_simulation_env/lib/python3.9/site-packages/pygccxml/declarations/scopedef.py", line 464, in _find_single
    found = matcher.get_single(decl_matcher, decls, False)
  File "<hidden>/.virtualenvs/msc_simulation_env/lib/python3.9/site-packages/pygccxml/declarations/scopedef.py", line 90, in get_single
    raise runtime_errors.declaration_not_found_t(decl_matcher)
pygccxml.declarations.runtime_errors.declaration_not_found_t: Unable to find declaration. Matcher: [(decl type==class_t) and (name==vector< std::string >)]
  File "<hidden>/.cache/yay/ompl/src/ompl-1.5.2/py-bindings/generate_bindings.py", line 950, in <module>
    globals()['ompl_'+module+'_generator_t']()
  File "<hidden>/.cache/yay/ompl/src/ompl-1.5.2/py-bindings/generate_bindings.py", line 154, in __init__
    code_generator_t.__init__(self, 'base', ['bindings/util'], replacement)
  File "<hidden>/.cache/yay/ompl/src/ompl-1.5.2/py-bindings/ompl/bindings_generator.py", line 146, in __init__
    self.filter_declarations()
  File "<hidden>/.cache/yay/ompl/src/ompl-1.5.2/py-bindings/generate_bindings.py", line 163, in filter_declarations
    self.std_ns.class_(
  File "<hidden>/.virtualenvs/msc_simulation_env/lib/python3.9/site-packages/pygccxml/declarations/scopedef.py", line 546, in class_
    self._find_single(
  File "<hidden>/.virtualenvs/msc_simulation_env/lib/python3.9/site-packages/pygccxml/declarations/scopedef.py", line 464, in _find_single
    found = matcher.get_single(decl_matcher, decls, False)
  File "<hidden>/.virtualenvs/msc_simulation_env/lib/python3.9/site-packages/pygccxml/declarations/scopedef.py", line 90, in get_single
    raise runtime_errors.declaration_not_found_t(decl_matcher)
pygccxml.declarations.runtime_errors.declaration_not_found_t: Unable to find declaration. Matcher: [(decl type==class_t) and (name==map< std::string, std::shared_ptr< ompl::base::ProjectionEvaluator > >)]```

jonathanglima avatar Oct 04 '21 06:10 jonathanglima

Can you check if this PR fixes it?

mamoll avatar Oct 04 '21 15:10 mamoll

It does not. Error went from generate_bindings.py, line 893 to generate_bindings.py, line 894. Basically the same thing but the declaration matcher changed:

pygccxml.declarations.runtime_errors.declaration_not_found_t: Unable to find declaration. Matcher: [((decl type==class_t) and (name==vector< std::basic_string< char, std::char_traits< char >, std::allocator< char > > >)] (sorry if I had typos, just wrote this by hand)

Before this PR I also tried to build using python3.7 from pyenv and the system's python @ 3.9.7. Same error as before. I tried changing -march as well (suggestion from archlinux AUR). Znver2 (current), native and generic gave me the same results before the PR. I can test them in this PR as well if you'd like to.

Does it have something to do with pyplusplus/pygccxml? Any suggestions on code changes or environment changes/tests I could make to a better debugging? Maybe some package versions?

jonathanglima avatar Oct 04 '21 19:10 jonathanglima

Just logged the installed versions. Maybe it's boost or eigen's fault?

boost 1.76
gcc 9.4 (had 11 before, tried a downgrade and it didn't helped)
python 3.9.7
pyplusplus 1.8.4
cmake 3.21.3
eigen 3.4.0
flann 1.9.1
libspot 2.9.7
doxygen 1.9.2
pygccxml 2.2.1
castxml 0.4.3-1

also, the full log from this PRs error:

  File "<hidden>/ompl/py-bindings/generate_bindings.py", line 951, in <module>
    globals()['ompl_'+module+'_generator_t']()
  File "<hidden>/ompl/py-bindings/generate_bindings.py", line 879, in __init__
    code_generator_t.__init__(self, 'util', None, replacement, 1)
  File "<hidden>/ompl/py-bindings/ompl/bindings_generator.py", line 146, in __init__
    self.filter_declarations()
  File "<hidden>/ompl/py-bindings/generate_bindings.py", line 894, in filter_declarations
    self.std_ns.class_(f'vector<{STRING}>').include()
  File "<hidden>/.virtualenvs/msc_simulation_env/lib/python3.9/site-packages/pygccxml/declarations/scopedef.py", line 554, in class_
    recursive=recursive)
  File "<hidden>/.virtualenvs/msc_simulation_env/lib/python3.9/site-packages/pygccxml/declarations/scopedef.py", line 464, in _find_single
    found = matcher.get_single(decl_matcher, decls, False)
  File "<hidden>/.virtualenvs/msc_simulation_env/lib/python3.9/site-packages/pygccxml/declarations/scopedef.py", line 90, in get_single
    raise runtime_errors.declaration_not_found_t(decl_matcher)
pygccxml.declarations.runtime_errors.declaration_not_found_t: Unable to find declaration. Matcher: [(decl type==class_t) and (name==vector< std::basic_string< char, std::char_traits< char >, std::allocator< char > > >)]

jonathanglima avatar Oct 06 '21 00:10 jonathanglima

Which OS are you using? If it's a recent version of Ubuntu, macOS or Windows 10, I should be able to reproduce this error (which would make it a lot easier to actually fix). You may also want to try using clang++ as your C++ compiler to see if that makes a difference.

mamoll avatar Oct 28 '21 18:10 mamoll

I met the same problem. Is it solved?

JianLi0-0 avatar Dec 16 '21 05:12 JianLi0-0

Sorry for the delay. I'm using Manjaro.

I actually went with another approach and did not fix/retried this issue

jonathanglima avatar Dec 16 '21 12:12 jonathanglima

Hi is this problem solved for Ubuntu 20.04 and pygccxml version 2.2.1?

UtkarshMishra04 avatar Oct 09 '22 03:10 UtkarshMishra04

A temporary fix: Replace all std::string inside ompl_util_generator_t.filter_declarations with std::basic_string<char>

Update: it doesn't fix all the problems. I'm guessing it's due to some recent updates to castxml. Here is my castxml version

castxml version 0.4.6

CastXML project maintained and supported by Kitware (kitware.com).

clang version 14.0.5 (Fedora 14.0.5-1.fc36)
Target: x86_64-redhat-linux-gnu
Thread model: posix
InstalledDir:```

xinyazhang avatar Nov 01 '22 09:11 xinyazhang

Just checked Python binding build on archlinux, with #978 they should work now.

zkingston avatar Jan 23 '23 21:01 zkingston

Closing - please follow up if this issue persists.

zkingston avatar Feb 06 '23 17:02 zkingston

This error still exists for Ubuntu 20.04.

/usr/lib/pypy3/lib-python/3/importlib/_bootstrap.py:228: DeprecationWarning: invalid escape sequence 'm'
  return f(*args, **kwds)
Traceback (most recent call last):
  File "/home/rikka/Project/ompl/ompl-1.6.0/py-bindings/generate_bindings.py", line 963, in <module>
    globals()['ompl_'+module+'_generator_t']()
  File "/home/rikka/Project/ompl/ompl-1.6.0/py-bindings/generate_bindings.py", line 154, in __init__
    code_generator_t.__init__(self, 'base', ['bindings/util'], replacement)
  File "/home/rikka/Project/ompl/ompl-1.6.0/py-bindings/ompl/bindings_generator.py", line 151, in __init__
    self.filter_declarations()
  File "/home/rikka/Project/ompl/ompl-1.6.0/py-bindings/generate_bindings.py", line 194, in filter_declarations
    self.ompl_ns.class_(f'SpecificParam< {self.string_decl} >').rename('SpecificParamString')
  File "/usr/local/lib/python3.8/dist-packages/pygccxml/declarations/scopedef.py", line 554, in class_
    recursive=recursive)
  File "/usr/local/lib/python3.8/dist-packages/pygccxml/declarations/scopedef.py", line 464, in _find_single
    found = matcher.get_single(decl_matcher, decls, False)
  File "/usr/local/lib/python3.8/dist-packages/pygccxml/declarations/scopedef.py", line 90, in get_single
    raise runtime_errors.declaration_not_found_t(decl_matcher)
pygccxml.declarations.runtime_errors.declaration_not_found_t: Unable to find declaration. Matcher: [(decl type==class_t) and (name==SpecificParam< std::string >)]

sleichu2 avatar Feb 10 '23 16:02 sleichu2

See #980 for a potential fix.

zkingston avatar Feb 10 '23 17:02 zkingston

Another error has occurred when build geometric. Ubuntu 20.04.

Traceback (most recent call last):
  File "/home/rikka/Project/ompl/ompl-1.6.0/py-bindings/generate_bindings.py", line 966, in <module>
    globals()['ompl_'+module+'_generator_t']()
  File "/home/rikka/Project/ompl/ompl-1.6.0/py-bindings/generate_bindings.py", line 625, in __init__
    replacement)
  File "/home/rikka/Project/ompl/ompl-1.6.0/py-bindings/ompl/bindings_generator.py", line 156, in __init__
    self.mb.split_module('bindings/' + name, use_files_sum_repository=True)
  File "/usr/local/lib/python3.8/dist-packages/pyplusplus/module_builder/boost_python_builder.py", line 389, in split_module
    , encoding=self.encoding)
  File "/usr/local/lib/python3.8/dist-packages/pyplusplus/file_writers/__init__.py", line 37, in write_multiple_files
    mfs.write()
  File "/usr/local/lib/python3.8/dist-packages/pyplusplus/file_writers/multiple_files.py", line 395, in write
    self.split_values_traits()
  File "/usr/local/lib/python3.8/dist-packages/pyplusplus/file_writers/multiple_files.py", line 321, in split_values_traits
    for trait in self.__value_traits: self.split_value_traits(trait)
  File "/usr/local/lib/python3.8/dist-packages/pyplusplus/file_writers/multiple_files.py", line 317, in split_value_traits
    , value_traits.create() ) )
  File "/usr/local/lib/python3.8/dist-packages/pyplusplus/file_writers/multiple_files.py", line 56, in write_file
    raise RuntimeError( os.linesep.join(msg) )
RuntimeError: `Py++` is going to write different content to the same file(bindings/geometric/_Edge__value_traits.pypp.hpp).

sleichu2 avatar Feb 11 '23 13:02 sleichu2

For an operational fix, try removing the line src/ompl/geometric/planners/informedtrees/EITstar.h from py-bindings/headers_geometric.txt. It seems there is an unintended naming conflict between EIT* and the other informed planners.

zkingston avatar Feb 11 '23 18:02 zkingston

See #979 for a potential fix.

zkingston avatar Feb 11 '23 21:02 zkingston

Worked!Thank you very much!

sleichu2 avatar Feb 12 '23 06:02 sleichu2

This breaks on main at the moment, when reverting main back to where #980 is committed, works OK

lydonchandra avatar Jul 19 '23 17:07 lydonchandra

This breaks on main at the moment, when reverting main back to where #980 is committed, works OK

Still facing the issue with ubuntu 18.04, python3, and the command to install is ./install-ompl-ubuntu.sh --python --github. One thing to notice during the installation process: ${SUDO} pip${PYTHONV} install -vU https://github.com/CastXML/pygccxml/archive/develop.zip this command fails and I replaced it with pip3 install pygccxml.

@lydonchandra Can you elaborate a bit more how did you make it work? e.g., which exact commit did you revert to? Thanks!

yufeiwang63 avatar Aug 23 '23 02:08 yufeiwang63