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(clang-tidy): install libomp-dev to prevent clang-diagnostic-error #172

Merged
merged 1 commit into from Aug 2, 2022

Conversation

kenji-miyake
Copy link
Contributor

@kenji-miyake kenji-miyake commented Aug 2, 2022

Description

Without this, it causes the following error due to the -fopenmp option.

/usr/include/eigen3/Eigen/Core:70:10: error: 'omp.h' file not found [clang-diagnostic-error]
#include <omp.h>

LLVM OpenMP runtime - dev package

https://packages.ubuntu.com/jammy/libomp-dev

Related: llvm/llvm-project#56460

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.

After all checkboxes are checked, anyone who has write access can merge the PR.

Signed-off-by: Kenji Miyake <kenji.miyake@tier4.jp>
@kenji-miyake
Copy link
Contributor Author

My test results in autowarefoundation/autoware_common#90.

Eigen/Core:

#if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE)
  #define EIGEN_HAS_OPENMP
#endif

#ifdef EIGEN_HAS_OPENMP
#include <omp.h>
#endif

Without OpenMP (by unclearing _OPENMP):

~/ghq/github.com/autowarefoundation/autoware_common add-lanelet2-extension* 10sclang-tidy -p build/ tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/virtual_traffic_light.hpp --extra-arg=-U_OPENMP
26044 warnings generated.
/home/kenji/ghq/github.com/autowarefoundation/autoware_common/tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/virtual_traffic_light.hpp:26:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
namespace lanelet
^~~~~~~~~~~~~~~~~
namespace lanelet::autoware
Suppressed 26101 warnings (26043 in non-user code, 58 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.

With OpenMP:

~/ghq/github.com/autowarefoundation/autoware_common add-lanelet2-extension* 10sclang-tidy -p build/ tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/virtual_traffic_light.hpp
19652 warnings and 1 error generated.
Error while processing /home/kenji/ghq/github.com/autowarefoundation/autoware_common/tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/virtual_traffic_light.hpp.
/home/kenji/ghq/github.com/autowarefoundation/autoware_common/tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/virtual_traffic_light.hpp:26:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
namespace lanelet
^~~~~~~~~~~~~~~~~
namespace lanelet::autoware
/home/kenji/ghq/github.com/autowarefoundation/autoware_common/tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/virtual_traffic_light.hpp:43:35: warning: method 'getVirtualTrafficLight' can be made static [readability-convert-member-functions-to-static]
  [[nodiscard]] ConstLineString3d getVirtualTrafficLight() const
                                  ^                        ~~~~~
                static 
/home/kenji/ghq/github.com/autowarefoundation/autoware_common/tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/virtual_traffic_light.hpp:57:35: warning: method 'getStartLine' can be made static [readability-convert-member-functions-to-static]
  [[nodiscard]] ConstLineString3d getStartLine() const
                                  ^              ~~~~~
                static 
/home/kenji/ghq/github.com/autowarefoundation/autoware_common/tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/virtual_traffic_light.hpp:62:36: warning: method 'getEndLines' can be made static [readability-convert-member-functions-to-static]
  [[nodiscard]] ConstLineStrings3d getEndLines() const
                                   ^             ~~~~~
                static 
/usr/include/eigen3/Eigen/Core:70:10: error: 'omp.h' file not found [clang-diagnostic-error]
#include <omp.h>
         ^~~~~~~
Suppressed 19697 warnings (19648 in non-user code, 49 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
Found compiler error(s).

With OpenMP (after installing libomp-dev):

~/ghq/github.com/autowarefoundation/autoware_common add-lanelet2-extension*sudo apt -y install libomp-dev

~/ghq/github.com/autowarefoundation/autoware_common add-lanelet2-extension* 6sclang-tidy -p build/ tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/virtual_traffic_light.hpp
26108 warnings generated.
/home/kenji/ghq/github.com/autowarefoundation/autoware_common/tmp/lanelet2_extension/include/lanelet2_extension/regulatory_elements/virtual_traffic_light.hpp:26:1: warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
namespace lanelet
^~~~~~~~~~~~~~~~~
namespace lanelet::autoware
Suppressed 26165 warnings (26107 in non-user code, 58 NOLINT).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.

@kenji-miyake
Copy link
Contributor Author

I'll merge this since it's a small change and I've tested it.

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.

None yet

1 participant