[ITK Community] Wrapping ITK with homebrewed python on OS 10.8.5
Michka Popoff
michkapopoff at gmail.com
Tue Oct 29 08:45:21 EDT 2013
Hi
I am currently trying to wrap ITK with python. Python 2.7.5 was installed with homebrew on OS 10.8.5. I tested with ITK 4.4.2.
The problem is exactly the same on OS 10.7.5.
The full make report can be found here : https://gist.github.com/iMichka/7053648/raw/5bd0289f19703d451f6c656a1d7e76cd9c936656/gistfile1.txt
The errors are due to the fact that gccxml does not link against the right compiler. The compiler should be the same than the one which was used to compile python
In python I used sysconfig.get_config_vars() to find the compiler : 'CXX': 'c++'.
which c++ gives /usr/bin/c++
c++ --version :
Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix
Some relevant options I defined in cmake for ITK :
BUILD_EXAMPLES = OFF
BUILD_DOCUMENTATION = OFF
BUILD_TESTING = OFF
BUILD_SHARED_LIBS = ON
CMAKE_BUILD_TYPE = Release
Module_ITKVtkGlue = ON
ITK_WRAP_PYTHON = ON
PYTHON_EXECUTABLE = /usr/local/bin/python
PYTHON_INCLUDE_DIR = /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7
PYTHON_LIBRARY = /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/lib/libpython2.7.dylib
ITK_USE_SYSTEM_GCCXML = OFF
ITK_WRAP_GCCXML = ON
CMAKE_CXX_COMPILER = /usr/bin/c++
CMAKE_C_COMPILER = /usr/bin/cc
Gccxml compiles correctly, but then when trying to generate the first xml file (Generating vcl_complex.xml), it fails :
In file included from /usr/include/c++/4.2.1/cstddef:51,
from /usr/include/c++/4.2.1/cstring:51,
from /usr/include/c++/4.2.1/bits/char_traits.h:45,
from /usr/include/c++/4.2.1/string:47,
from /tmp/insighttoolkit-nNsV/InsightToolkit-4.4.2/Modules/Core/Common/include/itkMacro.h:46,
from /tmp/insighttoolkit-nNsV/InsightToolkit-4.4.2/Modules/Core/Common/include/itkLightObject.h:21,
from /tmp/insighttoolkit-nNsV/InsightToolkit-4.4.2/Modules/Core/Common/include/itkObject.h:31,
from /tmp/insighttoolkit-nNsV/InsightToolkit-4.4.2/Modules/Core/Common/include/itkCommand.h:21,
from /tmp/insighttoolkit-nNsV/InsightToolkit-4.4.2/itk-build/Wrapping/Modules/ITKCommon/vcl_complex.cxx:1:
/usr/bin/../lib/clang/5.0/include/stddef.h:29:42: error: missing binary operator before token "("
/usr/bin/../lib/clang/5.0/include/stddef.h:37:39: error: missing binary operator before token "("
/usr/bin/../lib/clang/5.0/include/stddef.h:48:42: error: missing binary operator before token "("
I played a little bit around and was wondering about why there are two cstddef files, one in /usr/include/c++/, the other in /usr/bin/../lib/clang/ …
I then renamed the /usr/include to /usr/_include (this is a very dirty hack), and the compilation went to the end (and ITK works in python !).
I asked the same question on the gccxml mailing list, and got no answer for the moment.
My questions are the following :
1) Why are there two includes folders, and to what compilers do they belong ? I guess one is from clang, the other from llvm-g++ ?
2) Why does the compilation work when I rename the include folder so that then the compiler can't find it ?
3) Is there an options somewhere in cmake to tell gccxml which include folder to use ? Setting the CMAKE_CXX_COMPILER to llvm-g++ is not a solution, you get the same errors.
4) What is the status of the support of Clang for wrapping ITK with python ? (OS 10.9 is out, and Clang only)
I would be pleased to do some further tests or to invest some time in fixing this, but my c++ knowledge is rather bad. But once it is working I will upgrade the install formulas in homebrew so that people can install ITK on OS X with an one-liner :)
Michka
More information about the Community
mailing list