Skip to content
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

Failing tests with castxml + gcc5 (container traits) #47

Closed
iMichka opened this issue Mar 27, 2016 · 10 comments
Closed

Failing tests with castxml + gcc5 (container traits) #47

iMichka opened this issue Mar 27, 2016 · 10 comments
Labels
Milestone

Comments

@iMichka
Copy link
Contributor

iMichka commented Mar 27, 2016

There are a bunch of errors with container traits under Wily (Ubuntu 5.2.1-22ubuntu2).

ERROR: test_hash_map (remove_template_defaults_tester.tester_t)

Traceback (most recent call last):
File "/home/popoff/repo/pygccxml/unittests/remove_template_defaults_tester.py", line 166, in test_hash_map
(name + '< int, double >') == hm_traits.remove_defaults(hm_i2d))
File "../pygccxml/pygccxml/declarations/container_traits.py", line 530, in remove_defaults
name = self.class_declaration(type_or_string).name
File "../pygccxml/pygccxml/declarations/container_traits.py", line 457, in class_declaration
(type_.decl_string, self.name()))
TypeError: Type "::rtd::hash_maps::hm_i2d" is not instantiation of std::unordered_map

ERROR: test_hash_multimap (remove_template_defaults_tester.tester_t)

Traceback (most recent call last):
File "/home/popoff/repo/pygccxml/unittests/remove_template_defaults_tester.py", line 182, in test_hash_multimap
hmm_traits.remove_defaults(hmm_i2d))
File "../pygccxml/pygccxml/declarations/container_traits.py", line 530, in remove_defaults
name = self.class_declaration(type_or_string).name
File "../pygccxml/pygccxml/declarations/container_traits.py", line 457, in class_declaration
(type_.decl_string, self.name()))
TypeError: Type "::rtd::hash_multimaps::hmm_i2d" is not instantiation of std::unordered_multimap

ERROR: test_hash_multiset (remove_template_defaults_tester.tester_t)

Traceback (most recent call last):
File "/home/popoff/repo/pygccxml/unittests/remove_template_defaults_tester.py", line 151, in test_hash_multiset
mhs_traits.remove_defaults(mhs_v_int))
File "../pygccxml/pygccxml/declarations/container_traits.py", line 530, in remove_defaults
name = self.class_declaration(type_or_string).name
File "../pygccxml/pygccxml/declarations/container_traits.py", line 457, in class_declaration
(type_.decl_string, self.name()))
TypeError: Type "::rtd::hash_multisets::mhs_v_int" is not instantiation of std::unordered_multiset

ERROR: test_hash_set (remove_template_defaults_tester.tester_t)

Traceback (most recent call last):
File "/home/popoff/repo/pygccxml/unittests/remove_template_defaults_tester.py", line 135, in test_hash_set
hs_traits.remove_defaults(hs_v_int),
File "../pygccxml/pygccxml/declarations/container_traits.py", line 530, in remove_defaults
name = self.class_declaration(type_or_string).name
File "../pygccxml/pygccxml/declarations/container_traits.py", line 457, in class_declaration
(type_.decl_string, self.name()))
TypeError: Type "::rtd::hash_sets::hs_v_int" is not instantiation of std::unordered_set

FAIL: test_find_traits (find_container_traits_tester.tester_t)

Traceback (most recent call last):
File "/home/popoff/repo/pygccxml/unittests/find_container_traits_tester.py", line 99, in test_find_traits
"unordered_set< std::vector< int > >")
File "/home/popoff/repo/pygccxml/unittests/find_container_traits_tester.py", line 39, in __cmp_traits
traits.name()))
AssertionError: container "rtd::hash_sets::hs_v_int [typedef]", expected unordered_set_traits, got hash_set_traits

@iMichka iMichka added the bug label Mar 27, 2016
@iMichka iMichka added this to the 1.8.0 milestone Mar 27, 2016
@iMichka
Copy link
Contributor Author

iMichka commented Mar 27, 2016

For this I need to setup a new travis build with gcc5, to get that tested.

@iMichka
Copy link
Contributor Author

iMichka commented Mar 29, 2016

I added a bunch of builds, with gcc 5.2.1 and 5.3.0, and they all pass. It was not on Wily though, so the toolchain may have a different setup there (though it should be gcc 5.2.1). I'll need to double-check that in Wily itself.

@mamoll
Copy link
Contributor

mamoll commented Apr 30, 2016

I am also seeing errors on wily with gcc 5.2.1, but not with gcc 4.9. Specifically, the error is triggered by a call to full_name_from_declaration_path in declarations/algorithm.py:

/home/ompl/castxml/bin/castxml  -std=c++11   -I. -I. -I/home/ompl/omplapp/ompl/src -I/home/ompl/omplapp/src -I/usr/include/python2.7 -I/usr/include -I/usr/include/assimp -I/usr/include/eigen3 -I/home/ompl/omplapp/ompl/src/../py-bindings -c -x c++ --castxml-cc-gnu  "(" /usr/bin/g++ -std=c++11 ")" --castxml-gccxml -o /tmp/tmpT4yHPz.xml bindings/util.h
Traceback (most recent call last):
  File "/home/ompl/omplapp/ompl/py-bindings/generate_bindings.py", line 800, in <module>
    globals()['ompl_'+module+'_generator_t']()
  File "/home/ompl/omplapp/ompl/py-bindings/generate_bindings.py", line 734, in __init__
    code_generator_t.__init__(self, 'util', None, replacement, 1)
  File "/home/ompl/omplapp/ompl/py-bindings/ompl/bindings_generator.py", line 136, in __init__
    self.mb.split_module('bindings/' + name, use_files_sum_repository=True)
  File "/usr/local/lib/python2.7/dist-packages/pyplusplus/module_builder/boost_python_builder.py", line 384, in split_module
    , encoding=self.encoding)
  File "/usr/local/lib/python2.7/dist-packages/pyplusplus/file_writers/__init__.py", line 36, in write_multiple_files
    mfs = multiple_files_t( extmodule, dir_path, files_sum_repository=files_sum_repository, encoding=encoding )
  File "/usr/local/lib/python2.7/dist-packages/pyplusplus/file_writers/multiple_files.py", line 34, in __init__
    writer.writer_t.__init__( self, extmodule, files_sum_repository, encoding=encoding )
  File "/usr/local/lib/python2.7/dist-packages/pyplusplus/file_writers/writer.py", line 36, in __init__
    , extmodule.specially_exposed_decls )
  File "/usr/local/lib/python2.7/dist-packages/pyplusplus/utils/__init__.py", line 200, in register_decls
    row = self.row_t( decl )
  File "/usr/local/lib/python2.7/dist-packages/pyplusplus/utils/__init__.py", line 71, in __init__
    self.__init_from_decl( decl_or_string )
  File "/usr/local/lib/python2.7/dist-packages/pyplusplus/utils/__init__.py", line 100, in __init_from_decl
    self.signature = decl.create_decl_string( with_defaults=False )
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/calldef.py", line 616, in create_decl_string
    return f_type.partial_decl_string
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/cpptypes.py", line 54, in partial_decl_string
    return self.build_decl_string(False)
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/cpptypes.py", line 829, in build_decl_string
    with_defaults)
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/cpptypes.py", line 820, in create_decl_string
    [_f(x, with_defaults) for x in arguments_types]),
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/cpptypes.py", line 486, in _f
    return x.build_decl_string(with_defaults)
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/cpptypes.py", line 584, in build_decl_string
    return self.base.build_decl_string(with_defaults) + ' &'
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/cpptypes.py", line 895, in build_decl_string
    return self._declaration.partial_decl_string
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/declaration.py", line 361, in partial_decl_string
    return self.create_decl_string(with_defaults=False)
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/declaration.py", line 343, in create_decl_string
    return algorithm.full_name(self, with_defaults)
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/algorithm.py", line 133, in full_name
    partial_declaration_path(decl))
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/algorithm.py", line 64, in partial_declaration_path
    result = [decl.partial_name]
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/declaration.py", line 195, in partial_name
    self._partial_name = self._get_partial_name_impl()
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/class_declaration.py", line 575, in _get_partial_name_impl
    if type_traits.is_std_string(self):
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/type_traits.py", line 1309, in is_std_string
    return remove_cv(type_).decl_string in string_equivalences
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/declaration.py", line 352, in decl_string
    return self.create_decl_string()
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/declaration.py", line 343, in create_decl_string
    return algorithm.full_name(self, with_defaults)
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/algorithm.py", line 128, in full_name
    declaration_path(decl))
  File "/usr/local/lib/python2.7/dist-packages/pygccxml/declarations/algorithm.py", line 107, in full_name_from_declaration_path
    result = result[0] + '::'.join(result[1:])
IndexError: list index out of range
Command exited with non-zero status 1

I have attached the XML files generated by castxml with the two different compilers, in case that helps:
gcc49.xml.gz
gcc52.xml.gz

If this appears unrelated to the original issue, I can create a separate one for my bug.

@mamoll
Copy link
Contributor

mamoll commented May 1, 2016

I wrote too soon. It looks like gcc49 also fails, just not in the first module. It happens in other modules (same error as above) that depend on the first one. In addition, the error also happens on 15.04, so it's definitely a different bug.

@iMichka
Copy link
Contributor Author

iMichka commented May 2, 2016

I'll not have time this week to look at this, I'm on holidays for a few days :) I'll investigate further next week. Maybe I will also try to add more builds to travis to get it reproduced on the build bots.

@iMichka
Copy link
Contributor Author

iMichka commented May 11, 2016

@mamoll I added Travis builds for c++03, c++11 and c++14. They are all green. Could you please open a new bug for your problem, which seems to be a separate one than this one. Also, if possible, a small c++ code example would be great so I can try to reproduce this.

@iMichka
Copy link
Contributor Author

iMichka commented May 11, 2016

Notes about the initial error, which I can reproduce in a wily docker container, using gcc 5.2.1-22ubuntu2.

I also get this warning:

In file included from /opt/pygccxml/unittests/data/remove_template_defaults.hpp:64:
In file included from /usr/include/c++/5/ext/hash_set:60:
/usr/include/c++/5/backward/backward_warning.h:32:2: warning: This file includes at least one deprecated or antiquated header which may be removed without further notice at a future
      date. Please use a non-deprecated interface with equivalent functionality instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h. To
      disable this warning use -Wno-deprecated. [-W#warnings]
#warning \
 ^
1 warning generated.

This is because the wrong macros are loaded.

Removing this line fixes it, so that tr1/unordered_map and tr1/unordered_set are used:
https://github.com/gccxml/pygccxml/blob/develop/unittests/data/remove_template_defaults.hpp#L44

The problem seems to be that the castxml is not defined with gcc5 on wily.
Compiling a simple file containing:

#if defined( __castxml__ )
  #error "OK"
#endif

does not print the error. @bradking any idea why that could happen ?

It is defined when run with clang on on OS X and with gcc 5.3 on OS X.

@bradking
Copy link
Member

The problem seems to be that the castxml is not defined with gcc5 on wily.

The castxml version packaged on wily is 0.1+git20150807-1 which pre-dates introduction of the __castxml__ definition.

iMichka added a commit that referenced this issue May 12, 2016
The __castxml__ definition does not exist with the castxml shipped with wily.
In this case, do not use it and check for __GCCXML__ instead, to know which xml generator we are using.

The travis build was not getting this error because we are using one of the latest versions of CastXML there
instead of the one shipped by apt.

Reorganised the definitions to make more sense.
@iMichka
Copy link
Contributor Author

iMichka commented May 12, 2016

Ok, I never thought that the castxml definition was introduced only later. This does make sense why I am seing the error on Wily but not on the Travis builds where I am using one of the newer versions of CastXML. I adapted the test to check for gccxml first. The errors we were seing here we not due to a pygccxml bug, but to a test/setup problem.

This should be fixed now. Thanks for the help.

@iMichka
Copy link
Contributor Author

iMichka commented May 12, 2016

@mamoll and @Richard-Gmac I opened a new issued for your problem, see #55

Closing here.

@iMichka iMichka closed this as completed May 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants