<div><div><span style="color:rgb(80,0,80)">On Mon, Nov 12, 2012 at 7:53 PM, Ahmed Halaweish, Ph.D.</span><br style="color:rgb(80,0,80)"><span style="color:rgb(80,0,80)"><</span><a href="mailto:ahmed.halaweish@duke.edu">ahmed.halaweish@duke.edu</a><span style="color:rgb(80,0,80)">> wrote:</span><br style="color:rgb(80,0,80)">
<span style="color:rgb(80,0,80)">> I'm trying to get ITK 4.1 and ITK 4.2 + Python wrapping to work on my</span><br style="color:rgb(80,0,80)"><span style="color:rgb(80,0,80)">> macbook and mac pro desktop (both running 10.7) without any luck. I always</span><br style="color:rgb(80,0,80)">
<span style="color:rgb(80,0,80)">> seem to get a make: error 2 in the Wrapping/Modules section of the</span><br style="color:rgb(80,0,80)"><span style="color:rgb(80,0,80)">> compilation process.</span><br style="color:rgb(80,0,80)">
</div><div><span style="color:rgb(80,0,80)"><br></span></div><div>I don't know if the following applies to your case (would need to see the error messages you got), but here is what I have found necessary trying to compile WrapITK for Python on Lion.</div>
<div><br></div><div>Xcode comes with two sets of compilers (clan/clang++ and llvm-gcc/llvm-g++).</div><div>While either appears to work for compiling ITK itself, I have only been able to get llvm-gcc to work for WrapITK.</div>
<div><br></div><div>By default, cmake chooses /usr/bin/gcc (a symlink to llvm-gcc) and /usr/bin/c++ (a symlink to clang++), which is not just inconsistent but causes some weird problems with GCC_XML, a program required for generating the wrappers.</div>
<div><br></div><div><br></div><div>I have been able to get WrapITK to compile by following these steps (Lion, Xcode 4.5, cmake 2.8.8):</div><div><br></div><div>1. Download GCC_XML from <a href="http://itk.org/files/gccxml/gccxml-2012-08-08.tar.bz2">http://itk.org/files/gccxml/gccxml-2012-08-08.tar.bz2</a> (see the thread in this list today titled "build fails to download gccxml (4.2.1)").</div>
<div><br></div><div>2. Configure GCC_XML with the following, build, and install (to /usr/local).</div><div><br></div><div><div>CMAKE_BUILD_TYPE=Release</div><div>CMAKE_C_COMPILER=/usr/bin/llvm-gcc</div><div>CMAKE_CXX_COMPILER=/usr/bin/llvm-g++</div>
</div><div><br></div><div>[If the compilers are not explicitly set here, building WrapITK will fail. If they are set to clang/clang++, configuration of GCC_XML will fail.]<br></div><div><br></div><div>3. Configure ITK 4.2.1. First set the compilers:</div>
<div><br></div><div><div><div>CMAKE_C_COMPILER=/usr/bin/llvm-gcc</div><div>CMAKE_CXX_COMPILER=/usr/bin/llvm-g++</div></div></div><div><br></div><div>[If you are using ccmake, all other settings will be reset after changing the compiler.]</div>
<div><br></div><div>Then,</div><div><div>BUILD_SHARED_LIBS=ON</div><div>BUILD_EXAMPLES=OFF # Not the point here, but this is what I did</div><div>BUILD_TESTING=OFF # Ditto.</div></div><div><br></div><div>Add</div><div>
ITK_WRAP_PYTHON=ON<br></div><div><br></div><div>This (if using ccmake) will disclose additional options.</div><div>We need to set</div><div><br></div><div>ITK_USE_SYSTEM_GCCXML=ON<br></div><div><br></div><div>to use the GCC_XML installed above in 2.</div>
<div><br></div><div>Also, they Python paths are usually detected incorrectly (the paths may exist but may be wrong or belong to a different installation of Python). In my case, I am using Python 2.7 compiled from the source, which is installed under /Library (as is Python 2.7 from the <a href="http://python.org">python.org</a> installer package). It is best to set all of the following explicitly, or at least check that they are correct:</div>
<div><br></div><div><div>PYTHON_INCLUDE_DIR=/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7</div><div>PYTHON_LIBRARY=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/libpython2.7.dylib</div>
<div>PY_SITE_PACKAGES_PATH=/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages</div></div><div><div>PYTHON_EXECUTABLE=/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7</div></div><div>
<br></div><div>(end of steps)</div><div><br></div><div>I have not tried building ITK from the git head. It is probably sufficient to just set the compilers in ITK's config and let those propagate to GCC_XML's, rather than doing a separate build and installation of GCC_XML. At least, that used to work with ITK 4.2.1 before the GCC_XML repository got moved.</div>
<div><br></div><div>Hope this helps,</div><div><br></div><div>Mark</div><div><br></div><div><br></div><div><span style="color:rgb(80,0,80)"><br></span></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Nov 12, 2012 at 1:25 PM, Matt McCormick <span dir="ltr"><<a href="mailto:matt.mccormick@kitware.com" target="_blank">matt.mccormick@kitware.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi AFH,<br>
<br>
Could you please reply with the error message that you get.<br>
<br>
Thanks,<br>
Matt<br>
<div><div class="h5"><br>
On Mon, Nov 12, 2012 at 7:53 PM, Ahmed Halaweish, Ph.D.<br>
<<a href="mailto:ahmed.halaweish@duke.edu">ahmed.halaweish@duke.edu</a>> wrote:<br>
> All,<br>
> I'm trying to get ITK 4.1 and ITK 4.2 + Python wrapping to work on my<br>
> macbook and mac pro desktop (both running 10.7) without any luck. I always<br>
> seem to get a make: error 2 in the Wrapping/Modules section of the<br>
> compilation process.<br>
><br>
> Here are the variables I set in cmake:<br>
> BUILD_SHARED_LIBS = ON<br>
> CMAKE_BUILD_TYPE = Release<br>
> ITK_USE_REVIEW = ON<br>
> ITK_WRAPPING = ON<br>
> ITK_WRAP_PYTHON = ON<br>
><br>
> If anyone has had any luck with this, please do share any tips or pointers.<br>
><br>
> Cheers<br>
> AFH<br>
><br>
</div></div>> _____________________________________<br>
> Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
><br>
> Visit other Kitware open-source projects at<br>
> <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
><br>
> Kitware offers ITK Training Courses, for more information visit:<br>
> <a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
><br>
> Please keep messages on-topic and check the ITK FAQ at:<br>
> <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> <a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
><br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Kitware offers ITK Training Courses, for more information visit:<br>
<a href="http://www.kitware.com/products/protraining.php" target="_blank">http://www.kitware.com/products/protraining.php</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at:<br>
<a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br></div></div>