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

COMP: Set CMAKE VISIBILITY_PRESET to hidden #636

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

N-Dekker
Copy link
Member

@N-Dekker N-Dekker commented Apr 15, 2022

Suggested by Bradley Lowekamp (@blowekamp) at "WIP: Support adding Elastix component by CMake SimpleITK_USE_ELASTIX=ON" comment SimpleITK/SimpleITK#1611 (comment) referring to https://github.com/SimpleITK/SimpleITK/blob/2681d0689a5922a7f2d1b56b1c7b62361eed9d8d/SuperBuild/External_ITK.cmake#L81-L83

Discussed with Marius Staring (@mstaring) at superelastix.slack.com #elastix

Aims to avoid link warnings in SimpleITK (+ Elastix component), like

ld: warning: direct access in function '...' from file '....cxx.o)' to global weak symbol 'typeinfo for ...' from file '....cxx.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

At at https://open.cdash.org/viewBuildError.php?type=1&buildid=7827932 ( Azure Pipelines 2-macOS)

Suggested by Bradley Lowekamp at "WIP: Support adding Elastix component by CMake SimpleITK_USE_ELASTIX=ON" comment SimpleITK/SimpleITK#1611 (comment) referring to https://github.com/SimpleITK/SimpleITK/blob/2681d0689a5922a7f2d1b56b1c7b62361eed9d8d/SuperBuild/External_ITK.cmake#L81-L83

Discussed with Marius Staring at superelastix.slack.com #elastix

Aims to avoid link warnings in SimpleITK (+ Elastix component), like
> ld: warning: direct access in function '...' from file '....cxx.o)' to global weak symbol 'typeinfo for ...' from file '....cxx.o' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

At at https://open.cdash.org/viewBuildError.php?type=1&buildid=7827932 ( Azure Pipelines 2-macOS)
@blowekamp
Copy link
Contributor

I would recommend the following logic elastix:
https://github.com/SimpleITK/SimpleITK/blob/master/CMakeLists.txt#L226-L236

I'm not sure how Elasix build ITK, but the following logic SimpleITK uses to build ITK:
https://github.com/SimpleITK/SimpleITK/blob/master/SuperBuild/External_ITK.cmake#L76-L84

These cmake visibility options should be consistent when building ITK and libraries which use ITK. SimpleITK defaults to building static libraries in the super build where using the hidden options makes since. When building shared libraries it can be best to disable this hidden visibility. There are cases where both options makes sense, so it should be options available to the advance developer building the application.

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