-
Notifications
You must be signed in to change notification settings - Fork 49
pygccxml.utils.xml_generator not always set #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I think I know what is going on, I already encountered this problem but I did not think it would cause any trouble. Maybe my approach with this global |
So far, I have also needed to make this (unrelated) change: --- pygccxml/declarations/calldef.py 2015-11-15 11:33:22.000000000 -0600
+++ pygccxml/declarations/calldef.py 2015-11-24 13:56:26.000000000 -0600
@@ -745,8 +745,11 @@
arg = args[0]
if not type_traits.is_reference(arg.type):
return False
+ try:
if not type_traits.is_const(arg.type.base):
return False
+ except:
+ return False
unaliased = type_traits.remove_alias(arg.type.base)
# unaliased now refers to const_t instance
if not isinstance(unaliased.base, cpptypes.declarated_t): It turns out that arg.type can be of type declarated_t which does not have the |
Hi I looked at the second problem with the copy_constructor. I was not able to reproduce it. I can have arguments which have arg.type.base of type declarated_t, but not arg.type of type declarated_t. Could you provide an small c++ code example, so that I can write a unit test for this case ? |
I'm working on narrowing down the second problem, but it's tricky. So far, I have found that pygccxml/py++ chokes on boost::tuples::access_traits::parameter_type. |
Here is a minimal example for the second problem. Header file #include <boost/tuple/tuple.hpp>
class tuple1 : public boost::tuple<unsigned long>
{
public:
tuple1(boost::tuples::access_traits<unsigned long>::parameter_type t0)
: boost::tuple<unsigned long>(t0)
{
}
}; Python binding generation code: from pyplusplus import module_builder
from pygccxml import parser
# fails with this setting:
xml_generator_config = parser.xml_generator_configuration_t(xml_generator="castxml",
xml_generator_path="/opt/local/bin/castxml", include_paths=['/opt/local/include'])
# succeeds with this setting:
# xml_generator_config = parser.xml_generator_configuration_t(xml_generator="gccxml",
# xml_generator_path="/opt/local/bin/gccxml", include_paths=['/opt/local/include'])
mb = module_builder.module_builder_t(files=['test.h'], xml_generator_config = xml_generator_config)
mb.build_code_creator( module_name='tupletest' )
mb.write_module('tupletest.cpp' ) |
Hello @mamoll
And, I got following error message:
I am wondering how it worked for you. |
@jamir414, make sure you get pyplusplus from here: https://bitbucket.org/ompl/pyplusplus. I have been trying to update the PyPI entry, but to no avail (http://sourceforge.net/p/pypi/support-requests/566/). |
@mamoll Actually, I did got pyplusplus from that link ( https://bitbucket.org/ompl/pyplusplus/downloads ) and pygccxml from https://github.com/gccxml/pygccxml |
@jamir414, did you download the whole repo or one of the prepackaged releases? Only the former has support for the newest pygccxml. |
@mamoll I downloaded only the latest release. I will try again after downloading the whole repo like you said. Thank you. |
@mamoll It worked without any problem. Thank you. |
…hod (issue #27) The code path used needs to be compared to gccxml in a next step and the error needs to be fixed. Then; the test can be further adapted.
I wrote a simplified test to reproduce the error for the missing arg.base, 74ffdde It seems that this is also broken with gccxml ... Checking for the copy constructor works with:
But fails with:
In the second case (like in your boost example), I would prefer to not implement the try/catch block for the moment without understanding what is going on. Not sure if there is a difference in C++ between these two ways of writing the constructor. Because I would still expect the second one to be a copy constructor (so returning False is not correct). For the second problem with the caching, I was not able to reproduce it. I tried playing around with the cache. Would it be possible to get also a small example for this problem ? |
I am sorry I haven't had time to create a small example. If you're interested, you can try looking at the errors when building OMPL, the project that depends on pyplusplus and pygccxml:
|
…he constructor. See issue #27. is_copy_constructor() will now return False in this case, instead of failing.
The copy constructor problem is now fixed. I create a 1.7.2 branch which will contain the fix. I tried to build ompl, and had no problems. The update_bindings target was not there, but OMPL_BUILD_PYBINDINGS was set to on so I guess the python bindings were built. I edited some c++ files to re-trigger a build (and hopefully a re-read of some cached files), but could not reproduce the error. |
The update_bindings target is defined automatically if castxml/gccxml, pygccml, and pyplusplus are installed. (See https://bitbucket.org/ompl/ompl/src/tip/CMakeModules/Findxmlgenerator.cmake and https://bitbucket.org/ompl/ompl/src/tip/CMakeModules/PythonBindingsUtils.cmake for details.) I'll test the 1.7.2 branch shortly. Which version of python do you use? |
It was python 2.7 |
@iMichka, you most likely did not build the python bindings for OMPL if cmake didn't detect castxml/gccxml, pygccml, and pyplusplus. The good news is that with the hotfix/v1.7.2 branch the copy constructor error is now fixed. The bad news is that running "make update_bindings" twice still fails in the same way as described at the top of the page. I am using python 3.5 now. It's a bit of a pain to recompile boost.python with python2.7, but if you think that might matter I'm willing to try it. If you are sure you have castxml, pygccxml, and pyplusplus installed, perhaps you can try configuring OMPL like so:
(Obviously, you'd substitute your python path and the right module paths.) |
Ok I had pyplusplus not installed. I got the bindings to build, and also got the error on the second run. I'll look at it now and try to write some minimal test first. I'll probably debug this on python3, the stack trace is much nicer there :) |
This could happen when reading a cache file in a clean environment where utils.xml_generator was not set. The value is now stored in the cached record, and re-read when the cache file is loaded. Fixes issue #27
I fixed the problem, should be good now. There may be other problems while compiling ompl, please open a new bug if it is the case (I think my build failed but I just updated boost on OS X so this may have broken it, I did not investigate the new errors). Please close this bug once you tested the v1.7.2 branch. I will then make a new release to get these fixes out. Other bugs will then be fixed in v1.7.3. |
Yes, the original problem is fixed. Thank you! Feel free to file a bug or send me a message with the ompl build problem you observed. |
When trying to regenerate python bindings and using the cache file mechanism I run into the following problem:
The text was updated successfully, but these errors were encountered: