<br>HI Alex,<br><br><br> ITKIO depends on ITKCommon, <br><br><br> and so do ITKBasicFilters, ITKAlgorthms, <br> ITKFEM, ITKStatistics and ITKNumerics...<br><br><br>CMake is aware of the dependencies of ITK libraries, so it will
<br>add ITKCommon to the list of libraries to link with, if it finds that<br>you included a library that depends on ITKCommon.<br><br>You simply don't need to add ITKCommon to the list of libraries, <br>given that you are already setting all the others.
<br><br><br>Also, in general , you should put first in the list the high level libraries<br>and put towards the end the low level libraries. The goal is to resolve<br>the dependencies progressively. <br><br>Note that since you are including ITKIO in the list you can also
<br>get rid of "ITKMetaIO itkpng itkzlib" in your command:<br>TARGET_LINK_LIBRARIES.<br><br>If you are curious about the dependencies in ITK, you can take<br>a look at the CMakeLists.txt files of the different directories.
<br><br>For example, in Insight/Code/IO/CMakeLists.txt lines 69-83<br>you will find:<br><br>69 TARGET_LINK_LIBRARIES(ITKIO<br>70 ITKCommon<br>71 ITKNrrdIO<br>72 itkjpeg8<br>73 itkjpeg12<br>74 itkjpeg16<br>75 ${ITK_GDCM_LIBRARIES}
<br>76 ${ITK_PNG_LIBRARIES}<br>77 ${ITK_ZLIB_LIBRARIES}<br>78 ${ITK_TIFF_LIBRARIES}<br>79 ITKSpatialObject<br>80 ITKMetaIO<br>81 ITKDICOMParser<br>82 ITKEXPAT<br>83 ITKniftiio)<br><br><br>Even better, you may find interesting the CMake option that
<br>exports all the dependencies in the format that Graphviz can<br>use for generating a dependency graph.<br><br>You can invoke CMake as<br><br> cmake --graphviz=InsightDependencies.dot ~/src/Insight/<br> <br>
<br>and then call the "dot" tool from Graphviz as<br><br> <br> dot -Tjpg -o InsightDependencies.jpg InsightDependencies.dot<br><br><br><br>
The dependencies of CMake source code itself can be seen at <br>
<a href="http://www.cmake.org/Wiki/CMake:For_CMake_Hackers">http://www.cmake.org/Wiki/CMake:For_CMake_Hackers</a><br>
<br><br><br>Note that you can do the same for your own project, and<br>then you will identify all the dependencies of your code<br>with other libraries.<br><br><br> Regards,<br><br><br> Luis<br><br><br>--------------------------------------------
<br><div><span class="gmail_quote">On 7/9/07, <b class="gmail_sendername">Alex Lisovich</b> <<a href="mailto:alex.lisovich@gmail.com">alex.lisovich@gmail.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi Sean,<br><br>I was able to fix the problem, but the fix looks (to me) as strange as<br>the problem itself.<br>Inside my CMakeLists.txt file there was a line:<br><br>TARGET_LINK_LIBRARIES(Test64 ITKCommon ITKBasicFilters ITKAlgorithms
<br>ITKNumerics ITKFEM ITKIO ITKStatistics ITKMetaIO itkpng itkzlib)<br><br>It appears that ITKCommon does not live together with any other<br>libraries in 64 bit mode, causing linker to include it twice into the<br>build (see the complete failure message below).Removing ITKCommon from
<br>the line above leads to the successive build with, at least,<br>succesive creation of the image during the execution. The 32 bit build<br>works fine without the removal of ITKCommon.<br><br>Best,<br><br>Alex<br><br>P.S
.: failure message (double inclusion of ITKCommon):<br><br>Ld /Users/Alex/Sources/ITK_J2K_Region/Test64built/Debug/Test64 normal x86_64<br> mkdir /Users/Alex/Sources/ITK_J2K_Region/Test64built/Debug<br> cd /Users/Alex/Sources/ITK_J2K_Region/Test64built
<br> /usr/bin/g++-4.0 -o<br>/Users/Alex/Sources/ITK_J2K_Region/Test64built/Debug/Test64<br>-L/Users/Alex/Sources/ITK_J2K_Region/Test64built/Debug<br>-L/Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug<br>-L/Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin
<br>-F/Users/Alex/Sources/ITK_J2K_Region/Test64built/Debug -filelist<br>/Users/Alex/Sources/ITK_J2K_Region/Test64built/Test64.build/Debug/Test64.build/Objects-normal/x86_64/Test64.LinkFileList<br>-arch x86_64 -Wl,-Y,1455 -headerpad_max_install_names -lITKCommon
<br>-lITKBasicFilters -lITKAlgorithms -lITKNumerics -lITKFEM -lITKIO<br>-lITKStatistics -lITKMetaIO -litkpng -litkzlib -lITKBasicFilters<br>-lITKNrrdIO -litkgdcm -litkjpeg12 -litkjpeg16 -litktiff -litkjpeg8<br>-litkopenjpeg -lITKSpatialObject -lITKNumerics -lITKMetaIO
<br>-lITKDICOMParser -lITKEXPAT -lITKniftiio -lITKznz -litkzlib<br>-lITKCommon -litkvnl_inst -litkvnl_algo -litkv3p_netlib -litkvnl<br>-litkvcl -lm -lpthread -lm -litksys<br>ld64-62.1 failed: duplicate symbol<br>itk::Region::Print(std::basic_ostream<char, std::char_traits<char> >&,
<br>itk::Indent) constin<br>/Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug/libITKCommon.a(itkRegion.o)<br>and /Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug/libITKCommon.a(itkRegion.o)<br><br><br>
<br>On 7/9/07, Alex Lisovich <<a href="mailto:alex.lisovich@gmail.com">alex.lisovich@gmail.com</a>> wrote:<br>> Yes, I do, and it's actually using gcc/g++ 4.0<br>><br>> Well, life of mortals is difficult...
<br>><br>> Alex<br>><br>> On 7/9/07, Sean McBride <<a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a>> wrote:<br>> > On 7/6/07 5:52 PM, Alex Lisovich said:<br>> ><br>> > >Thank you very much for your patch! The warning about AppKit and
<br>> > >Carbon issue are gone.<br>> ><br>> > Glad it helped.<br>> ><br>> > >However, the build fails as before:<br>> > ><br>> > >ld64-62.1 failed: duplicate symbol<br>
> > >itk::Region::Print(std::basic_ostream<char, std::char_traits<char> >&,<br>> > >itk::Indent) constin<br>> > >/Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug/<br>> > >
libITKCommon.a(itkRegion.o)<br>> > >and /Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug/<br>> > >libITKCommon.a(itkRegion.o)<br>> > ><br>> > >So it looks like it complains about the duplicate Region::Print()
<br>> > >method within the same itkRegion.o? And this definitely looks like<br>> > >template instantiation problem, because when I remove the line<br>> > >"ImageType::Pointer im=ImageType::New();" it builds. I am (almost)
<br>> > >positive I am not building universal binaries, because I am using<br>> > ><xcodebuild ARCHS="x86_64"> which should build for a single target.<br>> > >Using make also produces the same build failure with the same message.
<br>> ><br>> > hmmm, not sure about this one... Are you specifying the 10.4u SDK with<br>> > CMAKE_OSX_SYSROOT?<br>> ><br>> > --<br>> > ____________________________________________________________
<br>> > Sean McBride, B. Eng <a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a><br>> > Rogue Research <a href="http://www.rogue-research.com">www.rogue-research.com
</a><br>> > Mac Software Developer Montréal, Québec, Canada<br>> ><br>> ><br>> ><br>><br>_______________________________________________<br>Insight-users mailing list<br><a href="mailto:Insight-users@itk.org">
Insight-users@itk.org</a><br><a href="http://www.itk.org/mailman/listinfo/insight-users">http://www.itk.org/mailman/listinfo/insight-users</a><br></blockquote></div><br>