Skip to content

Commit

Permalink
Fix linking libvtkWrapping with Python wrapping and kits enabled on Mac
Browse files Browse the repository at this point in the history
On Mac, the libvtkWrapping-8.1.1 library fails to link to libpython when
configuring with VTK_WRAP_PYTHON and VTK_ENABLE_KITS enabled.

This commit ensures that the library links to libpython.

This fixes the following error:

    FAILED: lib/libvtkWrapping-8.1.1.dylib
    Undefined symbols for architecture x86_64:
      "_PyCallable_Check", referenced from:
          vtkPythonAlgorithm::SetPythonObject(_object*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::FillInputPortInformation(int, vtkInformation*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::FillOutputPortInformation(int, vtkInformation*) in vtkPythonAlgorithm.cxx.o
      "_PyErr_Clear", referenced from:
          GetPythonErrorString() in vtkPythonAlgorithm.cxx.o
      "_PyErr_Fetch", referenced from:
          GetPythonErrorString() in vtkPythonAlgorithm.cxx.o
      "_PyImport_ImportModule", referenced from:
          GetPythonErrorString() in vtkPythonAlgorithm.cxx.o
      "_PyInt_AsLong", referenced from:
          vtkPythonAlgorithm::CheckResult(char const*, vtkSmartPyObject const&) in vtkPythonAlgorithm.cxx.o
      "_PyInt_FromLong", referenced from:
          vtkPythonAlgorithm::FillInputPortInformation(int, vtkInformation*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::FillOutputPortInformation(int, vtkInformation*) in vtkPythonAlgorithm.cxx.o
      "_PyObject_Call", referenced from:
          GetPythonErrorString() in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::SetPythonObject(_object*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::FillInputPortInformation(int, vtkInformation*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::FillOutputPortInformation(int, vtkInformation*) in vtkPythonAlgorithm.cxx.o
      "_PyObject_GetAttrString", referenced from:
          GetPythonErrorString() in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::SetPythonObject(_object*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::FillInputPortInformation(int, vtkInformation*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::FillOutputPortInformation(int, vtkInformation*) in vtkPythonAlgorithm.cxx.o
      "_PyObject_Str", referenced from:
          vtkPythonAlgorithm::PrintSelf(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, vtkIndent) in vtkPythonAlgorithm.cxx.o
          GetPythonErrorString() in vtkPythonAlgorithm.cxx.o
      "_PySequence_Fast", referenced from:
          GetPythonErrorString() in vtkPythonAlgorithm.cxx.o
      "_PySequence_Size", referenced from:
          GetPythonErrorString() in vtkPythonAlgorithm.cxx.o
      "_PyString_AsString", referenced from:
          vtkPythonAlgorithm::PrintSelf(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, vtkIndent) in vtkPythonAlgorithm.cxx.o
          GetPythonErrorString() in vtkPythonAlgorithm.cxx.o
      "_PyTuple_New", referenced from:
          GetPythonErrorString() in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::SetPythonObject(_object*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::ProcessRequest(vtkInformation*, vtkInformationVector**, vtkInformationVector*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::FillInputPortInformation(int, vtkInformation*) in vtkPythonAlgorithm.cxx.o
          vtkPythonAlgorithm::FillOutputPortInformation(int, vtkInformation*) in vtkPythonAlgorithm.cxx.o
  • Loading branch information
msmolens committed Jul 11, 2017
1 parent 93a7c67 commit cbb1269
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CMake/vtkModuleMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -678,8 +678,12 @@ function(vtk_module_library name)
endforeach()

# Optionally link the module to the python library
if(NOT _vtk_build_as_kit AND ${${vtk-module}_OPTIONAL_PYTHON_LINK})
vtk_target_link_libraries_with_dynamic_lookup(${vtk-module} LINK_PUBLIC ${vtkPython_LIBRARIES})
if(${${vtk-module}_OPTIONAL_PYTHON_LINK})
if(_vtk_build_as_kit)
vtk_module_link_libraries(${vtk-module} LINK_PUBLIC ${vtkPython_LIBRARIES})
else()
vtk_target_link_libraries_with_dynamic_lookup(${vtk-module} LINK_PUBLIC ${vtkPython_LIBRARIES})
endif()
endif()

# Handle the private dependencies, setting up link/include directories.
Expand Down

0 comments on commit cbb1269

Please sign in to comment.