установка cgal-swig-bindings с Ma c Mojave и brew, после чего получение символа ошибки не найдено: _PyClass_Type - PullRequest
0 голосов
/ 10 марта 2020

Я пытаюсь использовать cgal-swig-bindings следующим образом: я установил cmake 3.17.0 и заварил

>>brew install cgal
>>brew install swig

>>cmake -DCGAL_DIR=/usr/local/lib/cmake/CGAL -DBUILD_JAVA=OFF -DPYTHON_LIBRARIES=/usr/local/bin/python3 

, затем получил следующее:

cmake -DCGAL_DIR=/usr/local/lib/cmake/CGAL -DBUILD_JAVA=OFF -DPYTHON_LIBRARIES=/usr/local/bin/python3 
CMake Warning:
  No source or binary directory provided.  Both will be assumed to be the
  same as the current working directory, but note that this warning will
  become a fatal error in future CMake releases.


-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using header-only CGAL
-- Targetting Unix Makefiles
-- Using /Library/Developer/CommandLineTools/usr/bin/c++ compiler.
-- DARWIN_VERSION=18
-- Mac Leopard detected
-- Found GMP: /usr/local/lib/libgmp.dylib  
-- Found MPFR: /usr/local/lib/libmpfr.dylib  
-- Found Boost: /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found suitable version "1.72.0", minimum required is "1.48")  
-- Boost include dirs: /usr/local/include
-- Boost libraries:    
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.11") 
-- Found SWIG: /usr/local/bin/swig (found version "4.0.1") 
-- Build type: 
-- USING CXXFLAGS = ' '
-- USING EXEFLAGS = ' '
-- Requested component: ImageIO
-- Requested component: MPFR
-- Requested component: GMP
-- NOTICE: Intel TBB was not found. Parallelism will be disabled.
-- BUILD_RUBY is set to OFF: no CGAL-bindings for Ruby will be generated.
-- Found PythonInterp: /usr/bin/python (found version "2.7.10") 
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found version "2.7.10") 
-- BUILD_JAVA is set to OFF: no CGAL-bindings for Java will be generated.
-- Found Python libs.
-- CGAL-SWIG Python files and libraries will be written in /Users/karinstaring/Documents/cgal-swig-bindings/build-python/CGAL.
-- Now adding packages
-- NOTICE : LAS IO requires LASlib and will not be available.
-- Found Eigen3: /usr/local/include/eigen3 (found suitable version "3.3.7", minimum required is "3.1.0") 
CMake Warning at /usr/local/lib/cmake/boost_serialization-1.72.0/libboost_serialization-variant-shared.cmake:64 (message):
  Target Boost::serialization already has an imported location
  '/usr/local/lib/libboost_serialization-mt.dylib', which will be overwritten
  with '/usr/local/lib/libboost_serialization.dylib'
Call Stack (most recent call first):
  /usr/local/lib/cmake/boost_serialization-1.72.0/boost_serialization-config.cmake:57 (include)
  /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake:120 (find_package)
  /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake:185 (boost_find_component)
  /Applications/CMake.app/Contents/share/cmake-3.17/Modules/FindBoost.cmake:444 (find_package)
  SWIG_CGAL/Classification/CMakeLists.txt:5 (find_package)


CMake Warning at /usr/local/lib/cmake/boost_iostreams-1.72.0/libboost_iostreams-variant-shared.cmake:64 (message):
  Target Boost::iostreams already has an imported location
  '/usr/local/lib/libboost_iostreams-mt.dylib', which will be overwritten
  with '/usr/local/lib/libboost_iostreams.dylib'
Call Stack (most recent call first):
  /usr/local/lib/cmake/boost_iostreams-1.72.0/boost_iostreams-config.cmake:57 (include)
  /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake:120 (find_package)
  /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake:185 (boost_find_component)
  /Applications/CMake.app/Contents/share/cmake-3.17/Modules/FindBoost.cmake:444 (find_package)
  SWIG_CGAL/Classification/CMakeLists.txt:5 (find_package)


-- Found Boost: /usr/local/lib/cmake/Boost-1.72.0/BoostConfig.cmake (found version "1.72.0") found components: serialization iostreams 
-- Found Eigen3: /usr/local/include/eigen3 (found suitable version "3.3.7", minimum required is "3.2.0") 
CMake Warning at /usr/local/lib/cmake/CGAL/CGAL_enable_end_of_configuration_hook.cmake:99 (message):
  =======================================================================

  CGAL performance notice:

  The variable CMAKE_BUILD_TYPE is set to "".  For performance reasons, you
  should set CMAKE_BUILD_TYPE to "Release".

  Set CGAL_DO_NOT_WARN_ABOUT_CMAKE_BUILD_TYPE to TRUE if you want to disable
  this warning.

  =======================================================================
Call Stack (most recent call first):
  CMakeLists.txt:9223372036854775807 (CGAL_run_at_the_end_of_configuration)


-- Configuring done
-- Generating done

после этого Я запускаю в терминале: >> make

In file included from /usr/include/python2.7/Python.h:94:
/usr/include/python2.7/stringobject.h:173:5: warning: 'register' storage class specifier is deprecated and incompatible with
      C++17 [-Wdeprecated-register]
    register PyObject *obj,     /* string or Unicode object */
    ^~~~~~~~~
/usr/include/python2.7/stringobject.h:174:5: warning: 'register' storage class specifier is deprecated and incompatible with
      C++17 [-Wdeprecated-register]
    register char **s,          /* pointer to buffer variable */
    ^~~~~~~~~
/usr/include/python2.7/stringobject.h:175:5: warning: 'register' storage class specifier is deprecated and incompatible with
      C++17 [-Wdeprecated-register]
    register Py_ssize_t *len    /* pointer to length variable or NULL
    ^~~~~~~~~

после этого я запускаю тестовый файл в python и получаю следующую ошибку:

Traceback (most recent call last):
  File "/.../Documents/cgal-swig-bindings/examples/python/test_aabb.py", line 4, in <module>
    from CGAL.CGAL_Kernel import Point_3
  File "/.../Documents/cgal-swig-bindings/build-python/CGAL/CGAL_Kernel.py", line 15, in <module>
    from . import _CGAL_Kernel
ImportError: dlopen(/.../Documents/cgal-swig-bindings/build-python/CGAL/_CGAL_Kernel.so, 2): Symbol not found: _PyClass_Type
  Referenced from: /.../Documents/cgal-swig-bindings/build-python/CGAL/_CGAL_Kernel.so
  Expected in: flat namespace
 in /.../Documents/cgal-swig-bindings/build-python/CGAL/_CGAL_Kernel.so

Я попробовал следующее из Невозможно скомпилировать C программу на Ma c после обновления до Mojave , но это не помогло:

>> open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

то же самое применимо при сборке cgal-swig- привязки следующим образом:

git clone https://github.com/cgal/cgal-swig-bindings
cd cgal-swig-bindings
mkdir build/CGAL-5.0_release -p
cd build/CGAL-5.0_release
cmake -DCGAL_DIR=/usr/lib/CGAL -DBUILD_JAVA=OFF -DPYTHON_OUTDIR_PREFIX=../../examples/python ../.

Надеюсь, кто-то знает, в чем проблема или предложения, какие вещи проверить?

1 Ответ

0 голосов
/ 11 марта 2020

Я установил python с пивоварней и следил за этим https://github.com/davisking/dlib/issues/889 и включил это

>>>cmake -DCGAL_DIR=/usr/local/lib/cmake/CGAL -DBUILD_JAVA=OFF -DPYTHON_LIBRARIES=/usr/local/lib/python3.7 -DPYTHON_LIBRARY=/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/lib/libpython3.7.dylib -DPython_FRAMEWORKS=/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework -DPYTHON_INCLUDE_DIR=/usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Headers

это сработало для меня!

...