[Insight-users] Linking to shared MinGW build of ITK not possible
Bill Lorensen
bill.lorensen at gmail.com
Wed Oct 14 13:04:17 EDT 2009
itk 3.16 has several changes to correct the shared library problems on
mingw and cygwin.
You might update to 3.16 and see if it solves your problem.
Bill
On Tue, Oct 13, 2009 at 12:50 PM, Zelzer Sascha
<s.zelzer at dkfz-heidelberg.de> wrote:
> Hi,
>
>
>
> I built ITK 3.14 successfully with MinGW (gcc 4.4) with
> BUILD_SHARED_LIBS=ON. However, when I try to build my project which depends
> on ITK, the linker complains about multiple definitions of symbols in
> ITKCommon.dll.a and libitkvnl.a (for example).
>
>
>
> It seems that the transitive library dependencies, which CMake generates for
> my shared library, are incorrect since ITKCommon already links statically to
> itkvnl but libitkvnl.a ist still present in the list of libraries to be
> linked.
>
>
>
> If I change the following lines in ITKs CMakeLists.txt from
>
>
>
> 407: IF(WIN32)
>
> 408: IF(BUILD_SHARED_LIBS)
>
> 409: SET(ITK_COMMON_BUILD_TYPE "SHARED")
>
> 410: ELSE(BUILD_SHARED_LIBS)
>
> 411: SET(ITK_COMMON_BUILD_TYPE "STATIC")
>
> 412: ENDIF(BUILD_SHARED_LIBS)
>
> 413: SET(BUILD_SHARED_LIBS OFF)
>
> 414: ENDIF(WIN32)
>
>
>
> to
>
>
>
> 407: IF(WIN32 AND NOT MINGW)
>
> 408: IF(BUILD_SHARED_LIBS)
>
> 409: SET(ITK_COMMON_BUILD_TYPE "SHARED")
>
> 410: ELSE(BUILD_SHARED_LIBS)
>
> 411: SET(ITK_COMMON_BUILD_TYPE "STATIC")
>
> 412: ENDIF(BUILD_SHARED_LIBS)
>
> 413: SET(BUILD_SHARED_LIBS OFF)
>
> 414: ENDIF(WIN32 AND NOT MINGW)
>
>
>
> and correct the export/import defines in Utilities/gdcm/src/gdcmCommon.h:81
>
>
>
> from #ifdef gdcm_EXPORTS to #ifdef itkgdcm_EXPORTS
>
>
>
> the utility libraries are build as shared libraries and everything links
> fine to my project.
>
>
>
> Is this a known bug, a CMake problem, or a misconfiguration on my side?
>
>
>
> Thanks,
>
> Sascha
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.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-users
>
>
More information about the Insight-users
mailing list