使用Mac Mojave和brew安装cgal-swig绑定,然后获得未找到的错误符号:_PyClass_Type



我尝试以这种方式使用cgal-swig绑定:我安装了cmake 3.17.0和brew

>>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

之后我在终端中运行:>>制作

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

我尝试了Can';升级到莫哈韦后,我无法在Mac上编译C程序,但这并没有帮助:

>> 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 ../.

我希望有人知道问题出在哪里,或者建议检查哪些东西?

我安装了带有brew的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

这对我有用!

相关内容

最新更新