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

[workspace] Use sdformat hidden visibility #17230

Merged
merged 1 commit into from
Jun 8, 2022

Conversation

jwnimmer-tri
Copy link
Collaborator

@jwnimmer-tri jwnimmer-tri commented May 19, 2022

When building C++ code, we can't use -fvisibility=hidden because it infects all #included code, even the standard library. Instead, we should wrap the third-party C++ code in a inline hidden namespace. That way, only the third-party code itself is hidden.

Towards #17231.

Requires:


This change is Reviewable

@jwnimmer-tri

This comment was marked as outdated.

@jwnimmer-tri
Copy link
Collaborator Author

@drake-jenkins-bot mac-big-sur-clang-bazel-experimental-release please

@jwnimmer-tri
Copy link
Collaborator Author

+@rpoyner-tri for feature review, please.

Copy link
Contributor

@rpoyner-tri rpoyner-tri left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 2 of 10 files at r1, 5 of 13 files at r2, 12 of 15 files at r3, 5 of 5 files at r4, all commit messages.
Reviewable status: needs at least two assigned reviewers (waiting on @jwnimmer-tri)

@jwnimmer-tri
Copy link
Collaborator Author

+@sherm1 for platform review per schedule (tomorrow), please.

Copy link
Contributor

@rpoyner-tri rpoyner-tri left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 1 files at r5, all commit messages.
Reviewable status: LGTM missing from assignee sherm1(platform) (waiting on @sherm1)

Copy link
Member

@sherm1 sherm1 left a comment

Choose a reason for hiding this comment

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

Platform reviewed as best I can with limited understanding of the build system. I think I get the idea though and it looks good.
:lgtm:

Reviewed 2 of 10 files at r1, 5 of 13 files at r2, 4 of 15 files at r3, 5 of 5 files at r4, 1 of 1 files at r5, all commit messages.
Reviewable status: 3 unresolved discussions (waiting on @jwnimmer-tri)


tools/workspace/gz_math_internal/package.BUILD.bazel line 42 at r5 (raw file):

    defines = [
        "IGN_DESIGNATION=math",
        "PROJECT_VERSION_MAJOR=0",

BTW I gather the version numbers don't matter anymore but it isn't clear why. Consider adding a comment to explain why (a) they don't matter, and (b) why we have to define them at all.


tools/workspace/gz_math_internal/package.BUILD.bazel line 43 at r5 (raw file):

        "IGN_DESIGNATION=math",
        "PROJECT_VERSION_MAJOR=0",
        "PROJECT_VERSION_MINOR=%0",

nit: %0 -> 0


tools/workspace/gz_utils_internal/package.BUILD.bazel line 36 at r5 (raw file):

        "PROJECT_VERSION_PATCH=0",
        "PROJECT_VERSION=0.0",
        "PROJECT_VERSION_FULL=0.0.0",

BTW consider same comment here -- why all these zeros?

When building C++ code, we should not use -fvisibility=hidden because
it infects all #included code, even the standard library. Instead, we
should wrap the third-party C++ code in a inline hidden namespace.
That way, only the third-party code itself is hidden.

Remove the manually-curated version numbers from ignition builds. We
don't use them for anything, so keeping them in sync is wasted effort.
Copy link
Collaborator Author

@jwnimmer-tri jwnimmer-tri left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees rpoyner-tri(platform),sherm1(platform) (waiting on @rpoyner-tri and @sherm1)


tools/workspace/gz_math_internal/package.BUILD.bazel line 42 at r5 (raw file):

Previously, sherm1 (Michael Sherman) wrote…

BTW I gather the version numbers don't matter anymore but it isn't clear why. Consider adding a comment to explain why (a) they don't matter, and (b) why we have to define them at all.

Using zeros here is actually the typical convention (see below). Basically, no C++ code does anything with these definitions, so their value doesn't matter and it's easier to perform upgrades when we don't need to keep this information in sync. The fact that these used to have real version numbers was vestigial from when we shipped this code as a shared library.

tools/workspace/fcl/package.BUILD.bazel:61: "OCTOMAP_MAJOR_VERSION=0",
tools/workspace/fcl/package.BUILD.bazel:62: "OCTOMAP_MINOR_VERSION=0",
tools/workspace/fcl/package.BUILD.bazel:63: "OCTOMAP_PATCH_VERSION=0",
tools/workspace/libcmaes/package.BUILD.bazel:34: "LIBCMAES_VERSION_STRING=0.0.0",

Copy link
Contributor

@rpoyner-tri rpoyner-tri left a comment

Choose a reason for hiding this comment

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

Reviewed 4 of 4 files at r6, all commit messages.
Reviewable status: :shipit: complete! all discussions resolved, LGTM from assignees rpoyner-tri(platform),sherm1(platform) (waiting on @jwnimmer-tri)

@rpoyner-tri rpoyner-tri merged commit b8bf05c into RobotLocomotion:master Jun 8, 2022
@jwnimmer-tri jwnimmer-tri deleted the vendoring branch June 8, 2022 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: low release notes: none This pull request should not be mentioned in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants