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(autoware_shape_estimation): resolve undefined reference to ~TrtShapeEstimator() #8738

Conversation

ktro2828
Copy link
Contributor

@ktro2828 ktro2828 commented Sep 3, 2024

Description

While building autoware_shape_estimation, I got the following error:

Starting >>> autoware_shape_estimation                                                                                                                                                        
--- stderr: autoware_shape_estimation                                                                                                                                                         
CUDA found, including CUDA-specific sources
/usr/bin/ld: libautoware_shape_estimation.so: undefined reference to `autoware::shape_estimation::TrtShapeEstimator::~TrtShapeEstimator()'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/test_autoware_shape_estimation.dir/build.make:830: test_autoware_shape_estimation] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:242: CMakeFiles/test_autoware_shape_estimation.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< autoware_shape_estimation [5.64s, exited with code 2]

This PR added the definition of ~TrtShapeEstimator() as =default.

Related links

Parent Issue:

  • Link

How was this PR tested?

Notes for reviewers

None.

Interface changes

None.

Effects on system behavior

None.

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
@github-actions github-actions bot added component:perception Advanced sensor data processing and environment understanding. (auto-assigned) tag:require-cuda-build-and-test labels Sep 3, 2024
Copy link

github-actions bot commented Sep 3, 2024

Thank you for contributing to the Autoware project!

🚧 If your pull request is in progress, switch it to draft mode.

Please ensure:

Copy link
Contributor

@YoshiRi YoshiRi left a comment

Choose a reason for hiding this comment

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

LGTM but could you write what build command you used.
I could not reproduce the error with following command:

colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release --packages-up-to autoware_shape_estimat
ion

@YoshiRi YoshiRi added the run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) label Sep 3, 2024
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 25.04%. Comparing base (a5cc3ba) to head (b7f1e1f).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8738      +/-   ##
==========================================
- Coverage   25.04%   25.04%   -0.01%     
==========================================
  Files        1320     1320              
  Lines       97932    97942      +10     
  Branches    37803    37806       +3     
==========================================
  Hits        24531    24531              
- Misses      70870    70880      +10     
  Partials     2531     2531              
Flag Coverage Δ *Carryforward flag
differential 9.00% <ø> (?)
total 25.04% <ø> (ø) Carriedforward from a5cc3ba

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ktro2828
Copy link
Contributor Author

ktro2828 commented Sep 3, 2024

@YoshiRi Thank you for the quick review!

I could not reproduce the error with following command:

This is because there is no line to initialize ShapeEstimatorNode explicitly.
If we add a line to invoke the constructor of ShapeEstimatorNode, compiler will look for the definition of the destructor for each object recursively.

As an experiment, I declared ShapeEstimationNode as an executable as follows:

// src/shape_estimation_node.cpp

int main(int argc, char * argv[])
{
  rclcpp::init(argc, argv);
  auto node_options = rclcpp::NodeOptions();
  rclcpp::spin(std::make_shared<autoware::shape_estimation::ShapeEstimationNode>(node_options));
  rclcpp::shutdown();
  return 0;
}

After editing CMakeLists.txt, I could reproduce the error:

--- stderr: autoware_shape_estimation                                  
CUDA found, including CUDA-specific sources
/usr/bin/ld: CMakeFiles/autoware_shape_estimation.dir/src/shape_estimation_node.cpp.o: in function `autoware::shape_estimation::ShapeEstimationNode::ShapeEstimationNode(rclcpp::NodeOptions const&)':
shape_estimation_node.cpp:(.text+0x3e89): undefined reference to `autoware::shape_estimation::TrtShapeEstimator::~TrtShapeEstimator()'
/usr/bin/ld: CMakeFiles/autoware_shape_estimation.dir/src/shape_estimation_node.cpp.o: in function `autoware::shape_estimation::ShapeEstimationNode::ShapeEstimationNode(rclcpp::NodeOptions const&) [clone .cold]':
shape_estimation_node.cpp:(.text.unlikely+0xac1): undefined reference to `autoware::shape_estimation::TrtShapeEstimator::~TrtShapeEstimator()'
/usr/bin/ld: CMakeFiles/autoware_shape_estimation.dir/src/shape_estimation_node.cpp.o: in function `autoware::shape_estimation::ShapeEstimationNode::~ShapeEstimationNode()':
shape_estimation_node.cpp:(.text._ZN8autoware16shape_estimation19ShapeEstimationNodeD2Ev[_ZN8autoware16shape_estimation19ShapeEstimationNodeD5Ev]+0x2f): undefined reference to `autoware::shape_estimation::TrtShapeEstimator::~TrtShapeEstimator()'
/usr/bin/ld: CMakeFiles/autoware_shape_estimation.dir/src/shape_estimation_node.cpp.o: in function `autoware::shape_estimation::ShapeEstimationNode::~ShapeEstimationNode()':
shape_estimation_node.cpp:(.text._ZN8autoware16shape_estimation19ShapeEstimationNodeD0Ev[_ZN8autoware16shape_estimation19ShapeEstimationNodeD5Ev]+0x2f): undefined reference to `autoware::shape_estimation::TrtShapeEstimator::~TrtShapeEstimator()'
collect2: error: ld returned 1 exit status
gmake[2]: *** [CMakeFiles/autoware_shape_estimation.dir/build.make:939: autoware_shape_estimation] Error 1
gmake[1]: *** [CMakeFiles/Makefile2:165: CMakeFiles/autoware_shape_estimation.dir/all] Error 2
gmake: *** [Makefile:146: all] Error 2
---
Failed   <<< autoware_shape_estimation [10.0s, exited with code 2]

@ktro2828 ktro2828 merged commit 1557806 into autowarefoundation:main Sep 3, 2024
40 of 41 checks passed
@ktro2828 ktro2828 deleted the fix/autoware_shape_estimation/undefined-destructor branch September 3, 2024 16:07
ktro2828 added a commit to ktro2828/autoware.universe that referenced this pull request Sep 18, 2024
…hapeEstimator()` (autowarefoundation#8738)

fix: resolve undefined reference to `~TrtShapeEstimator()`

Signed-off-by: ktro2828 <kotaro.uetake@tier4.jp>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:perception Advanced sensor data processing and environment understanding. (auto-assigned) run:build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) tag:require-cuda-build-and-test
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

2 participants