robotology / human-dynamics-estimation

Software repository for estimating human dynamics
BSD 3-Clause "New" or "Revised" License
81 stars 28 forks source link

Fix C1128 error when compiling on MSVC in Debug mode #286

Closed traversaro closed 2 years ago

traversaro commented 2 years ago

The InverseVelocityKinematics.cpp is quite big, and in certain condition (for example Debug compilation) in MSVC its compilation fails with error:

2022-02-25T19:52:11.1221049Z C:\robotology-superbuild\src\HumanDynamicsEstimation\HumanDynamicsEstimationLibrary\algorithms\src\InverseVelocityKinematics.cpp : fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj [C:\robotology-superbuild\build\src\HumanDynamicsEstimation\HumanDynamicsEstimationLibrary\algorithms\algorithms.vcxproj] [C:\robotology-superbuild\build\HumanDynamicsEstimation.vcxproj]

The suggested fix is to add the /bigobj option, that is harmless as it just break compatibility with VS2005 linker (see https://stackoverflow.com/questions/15110580/penalty-of-the-msvs-compiler-flag-bigobj), that however it is not a use case we are interested in.

This was already done in https://github.com/robotology/human-dynamics-estimation/pull/174, but then the InverseVelocityKinematics.cpp file was move to another target so the option needs to be added to that target as well.

@RiccardoGrieco @lrapetti it would be great to have a 2.4.1 once this is merged, so that we could include this in the v2022.02.0 distro without other workarounds (see P3 in https://github.com/robotology/robotology-superbuild/issues/1046). This also have the convenient side-effect to also include https://github.com/robotology/human-dynamics-estimation/pull/279 in a release.

traversaro commented 2 years ago

B.t.w, given that /bigobj is quite harmless we could consider just adding it by default in the add_component function, but that can be done in another PR.

traversaro commented 2 years ago

This was not catched by the CI as we can't compile in Debug with Conda dependencies on Windows, and I just catched by chance as on the robotology-superbuild we still have some vcpkg-based CI jobs that compile on Debug. However, I think it is still worth to fix this as InverseVelocityKinematics.cpp is so big that it could soon (as soon as methods are added) have the same problem on Release as well.

traversaro commented 2 years ago

Great, thanks!

lrapetti commented 2 years ago

Thanks @traversaro, I will take care of the new release

Done -> https://github.com/robotology/human-dynamics-estimation/releases/tag/v2.4.1