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

Improve compile time #2

Merged
merged 2 commits into from
Aug 23, 2023
Merged

Improve compile time #2

merged 2 commits into from
Aug 23, 2023

Conversation

Yadunund
Copy link
Member

It turns out passing libraries to link in target_link_libraries() as ${foo_pkg_LIBRARIES} introduces a lot of duplicate of the same library that needs to be linked. This the reason why the ld linker takes a REALLY long time to finish linking since it does not de-duplicate the duplicate libraries and links all them. The lld linker seems to be smarter about this.

Switching to ${foo_pkg_TARGETS} prevents the duplicate libraries that were previously included as transitives. This is also the pattern that ROS 2 follows. See.

With these changes, I can compile the workspace faster than ever with just ld.

I removed the need to install and use lld in the README so that users can follow regular ROS patterns to build the workspace. But kept it in CI so that i can be faster since at the end of the day lld with these changes is faster than lld without these changes.

Signed-off-by: Yadunund <yadunund@openrobotics.org>
@Yadunund Yadunund requested a review from koonpeng August 22, 2023 16:28
Signed-off-by: Yadunund <yadunund@openrobotics.org>
@Yadunund Yadunund merged commit 0f5940a into main Aug 23, 2023
2 checks passed
@Yadunund Yadunund deleted the yadu/improve_compile_time branch August 23, 2023 03:44
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.

2 participants