[Insight-developers] Explicit instantiation linking issues on mac
platform
Zachary Pincus
zpincus at stanford.edu
Wed Sep 6 17:38:09 EDT 2006
I think that the TARGET_LINK_LIBRARIES statement is trying to link
ITKCommonExplicit into the ITKCommon library, so that an app can just
link to the common lib and the explicit one will be pulled in.
Is that not working? What are the link errors you see when building
applications?
You can check what libraries are linked to an object file (executable
or other library) on OS X with 'otool -L'. It would be worth checking
what's linked to libITKCommon.dylib, and in what order.
Zach
On Sep 6, 2006, at 8:20 AM, Hans Johnson wrote:
> Hello Fellow Developers!
>
> I wanted to alert the group to a small issue with linking on mac
> platform
> with explicit instantiation, and get some advice on how to fix the
> problem.
>
> The issue is that when explicit instantiation is used the extra
> ITKCommonExplicit library needs to be linked into the applications
> along
> with ITKCommon library. The file Insight/Code/Common/
> CMakeLists.txt code
> has the following
>
> IF(ITK_EXPLICIT_INSTANTIATION)
> TARGET_LINK_LIBRARIES (ITKCommon ITKCommonExplicit)
> ENDIF(ITK_EXPLICIT_INSTANTIATION)
>
> Which I interpret as "ITKCommon depends upon ITKCommonExplicit, so
> whenever
> you use -lITKCommon then also follow with -lITKCommonExplicit
> during linking
> stages". The problem is that the linking dependancies are
> backwards, and
> that ITKCommonExplicit needs to preceed ITKCommon.
>
> What needs to happen is that somehow ITKCommonExplicit needs to be
> prepended
> to many of the linking stages.
>
> I would like some guidance on resolving this issues, because the
> "easy way"
> touches quite a lot of CmakeLists.txt files and adds complexity to
> linking
> logic.
>
>
> Regards,
> Hans
>
> Food For Thought---Another less intrusive way to do this would be
> to have
> conditionals in the Insight/Code/Common/CMakeLists.txt file that
> builds the
> explicit instantiations right into the ITKCommon library rather
> than having
> a separate library. This will make life a lot easier as the number
> and
> names of the library linking would be constant across configuration
> options.
>
>
> _______________________________________________
> Insight-developers mailing list
> Insight-developers at itk.org
> http://www.itk.org/mailman/listinfo/insight-developers
More information about the Insight-developers
mailing list