[Insight-users] Cannot build ITK for MAC OS X Tiger 64 bit

Luis Ibanez luis.ibanez at kitware.com
Mon Jul 9 14:03:01 EDT 2007


HI Alex,


                  ITKIO depends on ITKCommon,


   and so do ITKBasicFilters, ITKAlgorthms,
   ITKFEM, ITKStatistics and ITKNumerics...


CMake is aware of the dependencies of ITK libraries, so it will
add ITKCommon to the list of libraries to link with, if it finds that
you included a library that depends on ITKCommon.

You simply don't need to add ITKCommon to the list of libraries,
given that you are already setting all the others.


Also, in general , you should put first in the list the high level libraries
and put towards the end the low level libraries. The goal is to resolve
the dependencies progressively.

Note that since you are including ITKIO in the list you can also
get rid of "ITKMetaIO itkpng itkzlib" in your command:
TARGET_LINK_LIBRARIES.

If you are curious about the dependencies in ITK, you can take
a look at the CMakeLists.txt files of the different directories.

For example, in Insight/Code/IO/CMakeLists.txt lines 69-83
you will find:

69 TARGET_LINK_LIBRARIES(ITKIO
70 ITKCommon
71 ITKNrrdIO
72 itkjpeg8
73 itkjpeg12
74 itkjpeg16
75 ${ITK_GDCM_LIBRARIES}
76 ${ITK_PNG_LIBRARIES}
77 ${ITK_ZLIB_LIBRARIES}
78 ${ITK_TIFF_LIBRARIES}
79 ITKSpatialObject
80 ITKMetaIO
81 ITKDICOMParser
82 ITKEXPAT
83 ITKniftiio)


Even better, you may find interesting the CMake option that
exports all the dependencies in the format that Graphviz can
use for generating a dependency graph.

You can invoke CMake as

    cmake    --graphviz=InsightDependencies.dot    ~/src/Insight/


and then call the "dot" tool from Graphviz as


   dot -Tjpg -o InsightDependencies.jpg InsightDependencies.dot



The dependencies of CMake source code itself can be seen at
http://www.cmake.org/Wiki/CMake:For_CMake_Hackers



Note that you can do the same for your own project, and
then you will identify all the dependencies of your code
with other libraries.


  Regards,


      Luis


--------------------------------------------
On 7/9/07, Alex Lisovich <alex.lisovich at gmail.com> wrote:
>
> Hi Sean,
>
> I was able to fix the problem, but the fix looks (to me) as strange as
> the problem itself.
> Inside my CMakeLists.txt file there was a line:
>
> TARGET_LINK_LIBRARIES(Test64 ITKCommon ITKBasicFilters ITKAlgorithms
> ITKNumerics ITKFEM ITKIO ITKStatistics ITKMetaIO itkpng itkzlib)
>
> It appears that ITKCommon does not live together with any other
> libraries in 64 bit mode, causing linker to include it twice into the
> build (see the complete failure message below).Removing ITKCommon from
> the line above  leads to the successive build with, at least,
> succesive creation of the image during the execution. The 32 bit build
> works fine without the removal of ITKCommon.
>
> Best,
>
> Alex
>
> P.S.: failure message (double inclusion of ITKCommon):
>
> Ld /Users/Alex/Sources/ITK_J2K_Region/Test64built/Debug/Test64 normal
> x86_64
>     mkdir /Users/Alex/Sources/ITK_J2K_Region/Test64built/Debug
>     cd /Users/Alex/Sources/ITK_J2K_Region/Test64built
>     /usr/bin/g++-4.0 -o
> /Users/Alex/Sources/ITK_J2K_Region/Test64built/Debug/Test64
> -L/Users/Alex/Sources/ITK_J2K_Region/Test64built/Debug
> -L/Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug
> -L/Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin
> -F/Users/Alex/Sources/ITK_J2K_Region/Test64built/Debug -filelist
>
> /Users/Alex/Sources/ITK_J2K_Region/Test64built/Test64.build/Debug/Test64.build/Objects-normal/x86_64/Test64.LinkFileList
> -arch x86_64 -Wl,-Y,1455 -headerpad_max_install_names -lITKCommon
> -lITKBasicFilters -lITKAlgorithms -lITKNumerics -lITKFEM -lITKIO
> -lITKStatistics -lITKMetaIO -litkpng -litkzlib -lITKBasicFilters
> -lITKNrrdIO -litkgdcm -litkjpeg12 -litkjpeg16 -litktiff -litkjpeg8
> -litkopenjpeg -lITKSpatialObject -lITKNumerics -lITKMetaIO
> -lITKDICOMParser -lITKEXPAT -lITKniftiio -lITKznz -litkzlib
> -lITKCommon -litkvnl_inst -litkvnl_algo -litkv3p_netlib -litkvnl
> -litkvcl -lm -lpthread -lm -litksys
> ld64-62.1 failed: duplicate symbol
> itk::Region::Print(std::basic_ostream<char, std::char_traits<char> >&,
> itk::Indent) constin
>
> /Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug/libITKCommon.a(
> itkRegion.o)
> and
> /Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug/libITKCommon.a(
> itkRegion.o)
>
>
>
> On 7/9/07, Alex Lisovich <alex.lisovich at gmail.com> wrote:
> > Yes, I do, and it's actually using gcc/g++ 4.0
> >
> > Well, life of mortals is difficult...
> >
> > Alex
> >
> > On 7/9/07, Sean McBride <sean at rogue-research.com> wrote:
> > > On 7/6/07 5:52 PM, Alex Lisovich said:
> > >
> > > >Thank you very much for your patch! The warning about AppKit and
> > > >Carbon issue are gone.
> > >
> > > Glad it helped.
> > >
> > > >However, the build fails as before:
> > > >
> > > >ld64-62.1 failed: duplicate symbol
> > > >itk::Region::Print(std::basic_ostream<char, std::char_traits<char>
> >&,
> > > >itk::Indent) constin
> > > >/Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug/
> > > >libITKCommon.a(itkRegion.o)
> > > >and /Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug/
> > > >libITKCommon.a(itkRegion.o)
> > > >
> > > >So it looks like it complains about the duplicate Region::Print()
> > > >method within the same itkRegion.o? And this definitely looks like
> > > >template instantiation problem, because when I remove the line
> > > >"ImageType::Pointer im=ImageType::New();" it builds. I am (almost)
> > > >positive I am not building universal binaries, because I am using
> > > ><xcodebuild ARCHS="x86_64"> which should build for a single target.
> > > >Using make also produces the same build failure with the same
> message.
> > >
> > > hmmm, not sure about this one... Are you specifying the 10.4u SDK with
> > > CMAKE_OSX_SYSROOT?
> > >
> > > --
> > > ____________________________________________________________
> > > Sean McBride, B. Eng                 sean at rogue-research.com
> > > Rogue Research                        www.rogue-research.com
> > > Mac Software Developer              Montréal, Québec, Canada
> > >
> > >
> > >
> >
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070709/4d6872ea/attachment.htm


More information about the Insight-users mailing list