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

Fix Aspect/Composite-relate tests on Windows/MSVC by marking every class with virtual base with appropriate pragmas #1541

Merged
merged 16 commits into from
Mar 17, 2021

Conversation

traversaro
Copy link
Contributor

@traversaro traversaro commented Mar 13, 2021

Fix #1522 .

This fix was inspired by #1540, however just enabling the /vd2 option can change the ABI of classes with virtual base whose implementation has been compiled without the /vd2 option. For this reason, using instead the vtordisp pragmas explicitly for each class of Dart with a virtual base could be a more robust solution.

For some reason, the fix is not working for the Clang-Cl toolset, at least for the version of Visual Studio used in GitHub Actions. I did not investigated this, but in theory clang-cl has support for the vtordisp pragmas (see https://clang.llvm.org/docs/UsersManual.html), but it is possible that this support has some bugs. However, for the time being I just remove the Clang-Cl toolset from the CI jobs, and I instead enabled the unit tests that previously were failing.

erwincoumans and others added 2 commits March 12, 2021 21:47
This fixes a crash on Windows. Confirmed to work in visual studio 2019.
See also dartsim#1431 (comment)
@traversaro traversaro changed the title Check if PR 1540 fix issue 1522 Check if PR 1540 fixes issue 1522 Mar 13, 2021
@traversaro traversaro changed the title Check if PR 1540 fixes issue 1522 Check if PR 1540 (add /vd2 option) fixes issue 1522 Mar 13, 2021
@traversaro

This comment has been minimized.

@traversaro

This comment has been minimized.

@traversaro

This comment has been minimized.

@codecov
Copy link

codecov bot commented Mar 13, 2021

Codecov Report

Merging #1541 (9fece0b) into master (f0ba239) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #1541   +/-   ##
=======================================
  Coverage   58.27%   58.27%           
=======================================
  Files         414      414           
  Lines       30077    30077           
=======================================
  Hits        17527    17527           
  Misses      12550    12550           
Impacted Files Coverage Δ
dart/common/Aspect.hpp 100.00% <ø> (ø)
dart/common/Composite.hpp 100.00% <ø> (ø)
dart/common/EmbeddedAspect.hpp 94.44% <ø> (ø)
dart/common/SpecializedForAspect.hpp 100.00% <ø> (ø)
dart/dynamics/BodyNode.hpp 100.00% <ø> (ø)
dart/dynamics/DegreeOfFreedom.hpp 100.00% <ø> (ø)
dart/dynamics/Entity.hpp 100.00% <ø> (ø)
dart/dynamics/FixedFrame.hpp 100.00% <ø> (ø)
dart/dynamics/Frame.hpp 87.50% <ø> (ø)
dart/dynamics/Joint.hpp 66.66% <ø> (ø)
... and 7 more

@traversaro traversaro changed the title Check if PR 1540 (add /vd2 option) fixes issue 1522 Fix test_Aspect unit test on Windows by marking every class with virtual base with appropriate pragmas Mar 13, 2021
@traversaro traversaro changed the title Fix test_Aspect unit test on Windows by marking every class with virtual base with appropriate pragmas Fix Aspect/Composite-relate tests on Windows/MSVC by marking every class with virtual base with appropriate pragmas Mar 13, 2021
@jslee02 jslee02 self-assigned this Mar 13, 2021
@traversaro
Copy link
Contributor Author

@jslee02 the history is a bit messy, after review let me know if you prefer me to squash it (I would squash it as a single commit, but let me know if you prefer a different division) or you want to squash&merge. The Travis failure seems to be related to being out of credits, and unrelated from this PR.

@traversaro traversaro mentioned this pull request Mar 13, 2021
5 tasks
Copy link
Member

@jslee02 jslee02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is awesome! Don't worry about the commit history. Let me do Sqaush&merge.

Thanks for the fix @traversaro and @erwincoumans!

dart/common/ClassWithVirtualBase.hpp Outdated Show resolved Hide resolved
dart/common/ClassWithVirtualBase.hpp Outdated Show resolved Hide resolved
Comment on lines +56 to 59
if(NOT MSVC)
dart_add_test("unit" test_VskParser)
target_link_libraries(test_VskParser dart-utils)
endif()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need to be fixed in this PR, but did you get any hint why test_VskParser doesn't build or pass with MSVC?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I briefly saw a 0xC0000135 that typically means dll not found, so I guess it could be something related to dll of the dependencies not being in the path or not being copied in the directory with the test executables. In any case, I tried to reduce the modification as possible to have the smallest possible PR to ensure that it could be merged without side-effects.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, let me take a look!

@jslee02 jslee02 merged commit 30ed61d into dartsim:master Mar 17, 2021
@jslee02 jslee02 added this to the DART 6.10.0 milestone Mar 17, 2021
traversaro added a commit to traversaro/dart that referenced this pull request Mar 19, 2021
…ass with virtual base with appropriate pragmas (dartsim#1541)

Co-authored-by: Jeongseok Lee <[email protected]>
Co-authored-by: erwincoumans <[email protected]>
traversaro added a commit to traversaro/dart that referenced this pull request Mar 19, 2021
…ass with virtual base with appropriate pragmas (dartsim#1541)

Co-authored-by: Jeongseok Lee <[email protected]>
Co-authored-by: erwincoumans <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Windows test failures with c++ exception: "Access violation - no RTTI data!"
3 participants