<br>HI Alex,<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ITKIO depends on ITKCommon, <br><br><br>&nbsp;&nbsp; and so do ITKBasicFilters, ITKAlgorthms, <br>&nbsp;&nbsp; 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&#39;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  &quot;ITKMetaIO itkpng itkzlib&quot; 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>&nbsp;&nbsp;&nbsp; cmake&nbsp;&nbsp;&nbsp; --graphviz=InsightDependencies.dot&nbsp;&nbsp;&nbsp; ~/src/Insight/<br>&nbsp;&nbsp;&nbsp; <br>
<br>and then call the &quot;dot&quot; tool from Graphviz as<br><br>&nbsp;&nbsp; <br>&nbsp;&nbsp; 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>&nbsp; Regards,<br><br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Luis<br><br><br>--------------------------------------------
<br><div><span class="gmail_quote">On 7/9/07, <b class="gmail_sendername">Alex Lisovich</b> &lt;<a href="mailto:alex.lisovich@gmail.com">alex.lisovich@gmail.com</a>&gt; 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&nbsp;&nbsp;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>&nbsp;&nbsp;&nbsp;&nbsp;mkdir /Users/Alex/Sources/ITK_J2K_Region/Test64built/Debug<br>&nbsp;&nbsp;&nbsp;&nbsp;cd /Users/Alex/Sources/ITK_J2K_Region/Test64built
<br>&nbsp;&nbsp;&nbsp;&nbsp;/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&lt;char, std::char_traits&lt;char&gt; &gt;&amp;,
<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 &lt;<a href="mailto:alex.lisovich@gmail.com">alex.lisovich@gmail.com</a>&gt; wrote:<br>&gt; Yes, I do, and it&#39;s actually using gcc/g++ 4.0<br>&gt;<br>&gt; Well, life of mortals is difficult...
<br>&gt;<br>&gt; Alex<br>&gt;<br>&gt; On 7/9/07, Sean McBride &lt;<a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a>&gt; wrote:<br>&gt; &gt; On 7/6/07 5:52 PM, Alex Lisovich said:<br>&gt; &gt;<br>&gt; &gt; &gt;Thank you very much for your patch! The warning about AppKit and
<br>&gt; &gt; &gt;Carbon issue are gone.<br>&gt; &gt;<br>&gt; &gt; Glad it helped.<br>&gt; &gt;<br>&gt; &gt; &gt;However, the build fails as before:<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;ld64-62.1 failed: duplicate symbol<br>
&gt; &gt; &gt;itk::Region::Print(std::basic_ostream&lt;char, std::char_traits&lt;char&gt; &gt;&amp;,<br>&gt; &gt; &gt;itk::Indent) constin<br>&gt; &gt; &gt;/Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug/<br>&gt; &gt; &gt;
libITKCommon.a(itkRegion.o)<br>&gt; &gt; &gt;and /Users/Alex/Sources/ITK_J2K_Region/ItkXCode_Debug/bin/Debug/<br>&gt; &gt; &gt;libITKCommon.a(itkRegion.o)<br>&gt; &gt; &gt;<br>&gt; &gt; &gt;So it looks like it complains about the duplicate Region::Print()
<br>&gt; &gt; &gt;method within the same itkRegion.o? And this definitely looks like<br>&gt; &gt; &gt;template instantiation problem, because when I remove the line<br>&gt; &gt; &gt;&quot;ImageType::Pointer im=ImageType::New();&quot; it builds. I am (almost)
<br>&gt; &gt; &gt;positive I am not building universal binaries, because I am using<br>&gt; &gt; &gt;&lt;xcodebuild ARCHS=&quot;x86_64&quot;&gt; which should build for a single target.<br>&gt; &gt; &gt;Using make also produces the same build failure with the same message.
<br>&gt; &gt;<br>&gt; &gt; hmmm, not sure about this one... Are you specifying the 10.4u SDK with<br>&gt; &gt; CMAKE_OSX_SYSROOT?<br>&gt; &gt;<br>&gt; &gt; --<br>&gt; &gt; ____________________________________________________________
<br>&gt; &gt; Sean McBride, B. Eng&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="mailto:sean@rogue-research.com">sean@rogue-research.com</a><br>&gt; &gt; Rogue Research&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.rogue-research.com">www.rogue-research.com
</a><br>&gt; &gt; Mac Software Developer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Montréal, Québec, Canada<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt;<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>