有关在计算机上安装PCL的问题

时间:2018-12-17 05:48:22

标签: python cython

当我尝试安装python-pcl(PCL是用于演示的点云库,如激光雷达数据。我按照https://github.com/strawlab/python-pcl上的说明进行操作,并且我已经复制了travis / pcl-2d-1.8.pc文件到/ usr / local / lib / pkgconfig文件夹)中。我在终端机上输入了AppledeMacBook-Pro-3:python-pcl-0.3.0rc1 apple$ python setup.py install。然后,我在下面遇到了一个问题:

running install
running bdist_egg
running egg_info
writing requirements to python_pcl.egg-info/requires.txt
writing python_pcl.egg-info/PKG-INFO
writing top-level names to python_pcl.egg-info/top_level.txt
writing dependency_links to python_pcl.egg-info/dependency_links.txt
reading manifest file 'python_pcl.egg-info/SOURCES.txt'
writing manifest file 'python_pcl.egg-info/SOURCES.txt'
installing library code to build/bdist.macosx-10.6-x86_64/egg
running install_lib
running build_py
running build_ext
skipping 'pcl/_pcl_180.cpp' Cython extension (up-to-date)
building 'pcl._pcl' extension
/usr/bin/clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/apple/miniconda3/include -I/Users/apple/miniconda3/include -DEIGEN_YES_I_KNOW_SPARSE_MODULE_IS_NOT_STABLE_YET=1 -I/Users/apple/miniconda3/pkgs/python-3.5.4-h8f450c2_22/lib/python3.5/site-packages/numpy/core/include -I/usr/local/include/pcl-1.8 -I/usr/local/Cellar/openni/1.5.7.10/include/ni -I/usr/local/include/pcl-1.8 -I/usr/local/Cellar/flann/1.9.1_6/include -I/usr/local/include/pcl-1.8 -I/opt/local/include/eigen3 -I/usr/include/ni -I/usr/include/vtk-5.8 -I/usr/local/include/vtk-8.0 -I/usr/local/Cellar/vtk/8.0.1/include -I/Users/apple/miniconda3/pkgs/python-3.5.4-h8f450c2_22/include/python3.5m -c pcl/_pcl_180.cpp -o build/temp.macosx-10.6-x86_64-3.5/pcl/_pcl_180.o
warning: include path for stdlibc++ headers not found; pass '-std=libc++' on the
      command line to use the libc++ standard library instead
      [-Wstdlibcxx-not-found]
pcl/_pcl_180.cpp:447:10: fatal error: 'vector' file not found
#include <vector>
         ^~~~~~~~

有人说这与我的Cython版本有关。但是我已经将Cython切换到0.25.2版,仍然无法正常工作。有人有同样的问题吗?非常感谢。顺便说一下,我的python版本是3.5.4,我的Mac版本是macOS Mojave 10.14.1

1 个答案:

答案 0 :(得分:0)

这是当前MacOS安装中的一个特殊问题。您可以调整setup.py并根据警告提示将-std=libc++添加到编译选项,即

from distutils.core import setup
from Cython.Build import cythonize

...  some stuff

#passing `-stdlib=libc++` to compiler and linker:
ext_modules = [Extension(...,
                         language='c++',
                         extra_compile_args=["-stdlib=libc++"], # + anything else you need
                         extra_link_args= ["-stdlib=libc++"] # + anything else you need]

... some more stuff

我还在链接器选项中添加了-stdlib=libc++,因为这可能是您遇到的下一个问题。

更多背景信息:在MacOS世界中,长期以来,存在两种不同的c ++标准库实现:与-libstdc++关联的gcc和与libc++关联的clang 。最初,-libstdc++编译器还默认使用clang。但是,情况已不再如此-甚至现在都没有安装,这就是找不到标头的原因。我不确定为什么您的clang版本默认不会使用libc++-因此您必须手动将其传递给编译器/链接器。