[vtk-developers] compiling vtk with enthought python issue/partial solution

David Gobbi david.gobbi at gmail.com
Tue Sep 25 22:55:50 EDT 2012


Hi Lauren,

The "-u _PyMac_Error" has been one of the vtkpython link flags for
almost as long as vtkpython has been compiled on the Mac.  I'm not
sure if it is still necessary (on my system vtkpython will build
without it).  However, the official python 2.7 source package uses
this link flag, so I am cautious about removing it.  E.g. I just did a
test build of python 2.7, this was the command line that it used to
build its python executable:

gcc  -u _PyMac_Error -o python \
			Modules/python.o \
			-L. -lpython2.7 -ldl  -framework CoreFoundation

Do you know what config options enthought uses when it builds Python?

 - David


On Tue, Sep 25, 2012 at 5:26 PM, Lauren O'Donnell
<lauren.j.odonnell at gmail.com> wrote:
> Hi,
>
> I just upgraded to Max OS X 10.8.2 (mountain lion) and I'm trying to compile
> VTK with python wrapping, using the Enthought Python distribution (EPD). I
> have done this in the past many times with no issues. But now the linker (on
> the command line) is requesting a symbol that is defined in system python
> but not EPD, making the compilation fail.
>
> This symbol "-u _PyMac_Error" wasn't ever needed by VTK before, and removing
> it from the linker line here:
> VTK-build/Wrapping/Python/CMakeFiles/vtkpython.dir/link.txt
> fixes the problem as far as I can see (compilation works fine and I can
> import vtk into python and make objects).
>
> Is there some reason that this "-u _PyMac_Error" is needed now? Can this be
> changed in a better way in CMake files somewhere?
>
> Any suggestions are appreciated. Build errors and the results of nm are
> below. I'm using a VTK checkout from this afternoon using git clone
> git://vtk.org/VTK.git. The machine is OS X 10.8.2. I have the latest Xcode.
>
> Thanks!
> --Lauren
>
> ERROR
> -------------
> Apple clang version 4.1 (tags/Apple/clang-421.11.65) (based on LLVM 3.1svn)
> Target: x86_64-apple-darwin12.2.0
> Thread model: posix
>  "/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.8.0 -u
> _PyMac_Error -o ../../bin/vtkpython -search_paths_first
> -headerpad_max_install_names CMakeFiles/vtkpython.dir/vtkPythonAppInit.cxx.o
> /Library/Frameworks/EPD64.framework/Versions/Current/lib/libpython2.7.dylib
> ../../lib/libvtksys-6.0.1.dylib ../../lib/libvtkCommonCore-6.0.1.dylib
> /usr/lib/libutil.dylib ../../lib/libvtksys-6.0.1.dylib -lstdc++ -lSystem
> /usr/bin/../lib/clang/4.1/lib/darwin/libclang_rt.osx.a
> [  8%] Scanning dependencies of target vtkCommonSystemCxxTests
> Scanning dependencies of target vtkhdf5
> Built target vtkWrappingPython
> Scanning dependencies of target vtkCommonMisc
> Linking C shared library ../../../lib/libvtktiff-6.0.dylib
> Scanning dependencies of target vtkCommonTransforms
> Undefined symbols for architecture x86_64:
>   "_PyMac_Error", referenced from:
>      -u command line option
> ld: symbol(s) not found for architecture x86_64
> clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
> make[2]: *** [bin/vtkpython] Error 1
> make[1]: *** [Wrapping/Python/CMakeFiles/vtkpython.dir/all] Error 2
> make[1]: *** Waiting for unfinished jobs....
>
> _PyMac_Error symbol
> -----------------------------------
> If I check the libraries, the system python defines it but the EPD python
> does not define this symbol (and neither did previous EPD versions that pre
> OS X 10.8 and clang worked fine with VTK)
>
> brage:~ odonnell$ nm
> /Library/Frameworks/Python.framework/Versions/Current/lib/libpython2.7.dylib
> | grep PyMac_Error
> 0011a1f0 T _PyMac_Error
> 00102890 T _PyMac_Error
> brage:~ odonnell$ nm
> /Library/Frameworks/EPD64.framework/Versions/Current/lib/libpython2.7.dylib
> | grep PyMac_Error
> brage:~ odonnell$



More information about the vtk-developers mailing list