[Insight-developers] The source of the linking errors on gcc 4.0 (-fvisibility)
Bradley Lowekamp
blowekamp at mail.nih.gov
Fri Dec 16 15:58:33 EST 2011
Hello,
Due to the pending ITKv4 tag on Monday I think it would be best to get the patch for this in this evening before the nightly tag in case there is a problem with it we have a couple of nights to fix it or revert it.
This is the patch I came up to address the problem:
http://review.source.kitware.com/#change,3519
Thanks,
Brad
On Dec 16, 2011, at 3:07 PM, Lowekamp, Bradley (NIH/NLM/LHC) [C] wrote:
> Hello,
>
> I have narrowed down the cause of the linking errors to the addition of GCC feature "-fvisibility=hidden" in the Module/Core/Common/src/CMakeLists.txt file:
>
> if(NOT WIN32 AND CMAKE_COMPILER_IS_GNUCXX AND BUILD_SHARED_LIBS)
> set(ITKCommon_CXX_FLAGS "-fvisibility=hidden -fvisibility-inlines-hidden")
> ITK_CHECK_CXX_COMPILER_FLAG(${ITKCommon_CXX_FLAGS} ITKCommon_HAS_GCC_VISIBILITY_FLAGS)
> if(ITKCommon_HAS_GCC_VISIBILITY_FLAGS)
> set_target_properties(ITKCommon PROPERTIES
> COMPILE_FLAGS "${ITKCommon_CXX_FLAGS}"
> )
> endif(ITKCommon_HAS_GCC_VISIBILITY_FLAGS)
> endif()
>
> And then in itkDataObject.cxx the following is added, which should specify the correct linkage:
>
> #include "itkSmartPointerForwardReference.hxx"
>
> // Manual instantiation is necessary to prevent link errors
> template class ITK_ABI_EXPORT itk::SmartPointerForwardReference< itk::ProcessObject >;
>
> So the like errors are reproducible with gcc4.0 (i686-apple-darwin10-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5494)) and SHARED libraries turned on, for the mac.
>
> Luis,
>
> You have a linux box with gcc 4.0.1, I would be quite curious if shared libraries work on that system!
>
> I am digging through gcc documentation now trying to find out the histry of these options and if this was a known bug or something.
>
> If anyone knows something helpful about this issue or has a suggested resolution, please share.
>
> Thanks,
> Brad
>
>
>
> ========================================================
> Bradley Lowekamp
> Medical Science and Computing for
> Office of High Performance Computing and Communications
> National Library of Medicine
> blowekamp at mail.nih.gov
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Kitware offers ITK Training Courses, for more information visit:
> http://kitware.com/products/protraining.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-developers
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20111216/29ccdc79/attachment.htm>
More information about the Insight-developers
mailing list