- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试为 c++ 代码生成一个 python 包装器,它使用点云库 (PCL) 估计点云的法线。为此,我正在使用 boost.python 。我能够毫无问题地生成共享库,但是当我尝试在 ipython 中导入它时,出现导入错误
undefined symbol :_ZNK5boost6python7objects21py_function_impl_base9max_arityEv
以下是我的问题的详细描述。
首先,我尝试了 boost_python 文档中的 hello world 示例。
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
char const* greet()
{
return "hello, world";
}
int square(int number)
{
return number*number;
}
BOOST_PYTHON_MODULE(libhello)
{
using namespace boost::python;
def("greet", greet);
def("square",square);
}
我使用 CMakeLists.txt 编译上面的代码
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "DEBUG")
#SET(CMAKE_BUILD_TYPE "RELEASE")
#SET(CMAKE_BUILD_TYPE "RELWITHDEBINFO")
#SET(CMAKE_BUILD_TYPE "MINSIZEREL")
ENDIF()
FIND_PACKAGE(Boost 1.54.0)
IF(Boost_FOUND)
INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}" "/usr/include/python2.7")
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE(Boost 1.54.0 COMPONENTS python)
ADD_LIBRARY(hello SHARED hello.cpp)
TARGET_LINK_LIBRARIES(hello ${Boost_LIBRARIES})
ELSEIF(NOT Boost_FOUND)
MESSAGE(FATAL_ERROR "Unable to find correct Boost version. Did you set BOOST_ROOT?")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS("-Wall")
ELSE()
MESSAGE(FATAL_ERROR "CMakeLists.txt has not been tested/written for your compiler.")
ENDIF()
这完全没有问题。生成的共享库的 ldd outbut 如下所示:
badami@Zusi:~/Codes/indor_seg/pySegment/libC++/build_hello$ ldd libhello.so
linux-vdso.so.1 => (0x00007fff04695000)
libboost_python-py27.so.1.54.0 => /usr/lib/x86_64-linux-gnu/libboost_python-py27.so.1.54.0 (0x00007f4d0c234000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f4d0bf30000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f4d0bd1a000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f4d0b955000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f4d0b64f000)
/lib64/ld-linux-x86-64.so.2 (0x00007f4d0c68e000)
我可以在 ipython 环境中导入这个库并调用定义的方法,没有任何问题。
现在,我尝试使用 PCL 为以下代码重复我的正常估算代码的示例。
#include <boost/python/module.hpp>
#include <boost/python/def.hpp>
#include <pcl/io/io.h>
#include <pcl/io/pcd_io.h>
#include <pcl/features/integral_image_normal.h>
#include <pcl/visualization/cloud_viewer.h>
int normalEstimation()
{
// load point cloud
pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
pcl::io::loadPCDFile ("table_scene_mug_stereo_textured.pcd", *cloud);
// estimate normals
pcl::PointCloud<pcl::Normal>::Ptr normals (new pcl::PointCloud<pcl::Normal>);
pcl::IntegralImageNormalEstimation<pcl::PointXYZ, pcl::Normal> ne;
ne.setNormalEstimationMethod (ne.AVERAGE_3D_GRADIENT);
ne.setMaxDepthChangeFactor(0.02f);
ne.setNormalSmoothingSize(10.0f);
ne.setInputCloud(cloud);
ne.compute(*normals);
// visualize normals
pcl::visualization::PCLVisualizer viewer("PCL Viewer");
viewer.setBackgroundColor (0.0, 0.0, 0.5);
viewer.addPointCloudNormals<pcl::PointXYZ,pcl::Normal>(cloud, normals);
while (!viewer.wasStopped ())
{
viewer.spinOnce ();
}
return 0;
}
BOOST_PYTHON_MODULE(libpcltest)
{
using namespace boost::python;
def("normalEstimation", normalEstimation);
}
使用 CMakeLists.txt 如下:
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE "DEBUG")
#SET(CMAKE_BUILD_TYPE "RELEASE")
#SET(CMAKE_BUILD_TYPE "RELWITHDEBINFO")
#SET(CMAKE_BUILD_TYPE "MINSIZEREL")
ENDIF()
FIND_PACKAGE(Boost 1.54.0)
IF(Boost_FOUND)
INCLUDE_DIRECTORIES("${Boost_INCLUDE_DIRS}" "/usr/include/python2.7")
SET(Boost_USE_STATIC_LIBS OFF)
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_RUNTIME OFF)
FIND_PACKAGE(Boost 1.54.0 COMPONENTS python)
FIND_PACKAGE(PCL 1.7 REQUIRED COMPONENTS common io visualization features)
INCLUDE_DIRECTORIES(${PCL_INCLUDE_DIRS})
LINK_DIRECTORIES(${PCL_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${PYTHON_LIBRARY_DIRS})
ADD_LIBRARY(pcltest SHARED normal_estimation.cpp)
TARGET_LINK_LIBRARIES(pcltest ${PCL_LIBRARIES} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
ELSEIF(NOT Boost_FOUND)
MESSAGE(FATAL_ERROR "Unable to find correct Boost version. Did you set BOOST_ROOT?")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS("-Wall")
ELSE()
MESSAGE(FATAL_ERROR "CMakeLists.txt has not been tested/written for your compiler.")
ENDIF()
生成的共享库的ldd输出如下:
badami@Zusi:~/Codes/indor_seg/pySegment/libC++/build$ ldd libpcltest.so
linux-vdso.so.1 => (0x00007ffe05793000)
libboost_system.so.1.54.0 => /usr/lib/x86_64-linux-gnu/libboost_system.so.1.54.0 (0x00007f29d38a4000)
libpcl_common.so.1.7 => /usr/lib/libpcl_common.so.1.7 (0x00007f29d35f0000)
libpcl_io.so.1.7 => /usr/lib/libpcl_io.so.1.7 (0x00007f29d3138000)
libpcl_search.so.1.7 => /usr/lib/libpcl_search.so.1.7 (0x00007f29d2d8d000)
libpcl_visualization.so.1.7 => /usr/lib/libpcl_visualization.so.1.7 (0x00007f29d2a36000)
libpcl_features.so.1.7 => /usr/lib/libpcl_features.so.1.7 (0x00007f29d0f38000)
libvtkRendering.so.5.8 => /usr/lib/libvtkRendering.so.5.8 (0x00007f29d0832000)
libvtkFiltering.so.5.8 => /usr/lib/libvtkFiltering.so.5.8 (0x00007f29d02a9000)
libvtkCommon.so.5.8 => /usr/lib/libvtkCommon.so.5.8 (0x00007f29cfd33000)
libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f29cfa2f000)
libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f29cf729000)
libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f29cf513000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f29cf14e000)
libboost_thread.so.1.54.0 => /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.54.0 (0x00007f29cef38000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f29ced1a000)
libgomp.so.1 => /usr/lib/x86_64-linux-gnu/libgomp.so.1 (0x00007f29ceb0b000)
libboost_filesystem.so.1.54.0 => /usr/lib/x86_64-linux-gnu/libboost_filesystem.so.1.54.0 (0x00007f29ce8f5000)
libboost_iostreams.so.1.54.0 => /usr/lib/x86_64-linux-gnu/libboost_iostreams.so.1.54.0 (0x00007f29ce6dc000)
libboost_chrono.so.1.54.0 => /usr/lib/x86_64-linux-gnu/libboost_chrono.so.1.54.0 (0x00007f29ce4d5000)
libpcl_io_ply.so.1.7 => /usr/lib/libpcl_io_ply.so.1.7 (0x00007f29ce286000)
libvtkImaging.so.5.8 => /usr/lib/libvtkImaging.so.5.8 (0x00007f29cdc99000)
libvtkIO.so.5.8 => /usr/lib/libvtkIO.so.5.8 (0x00007f29cd518000)
libpng12.so.0 => /usr/lib/x86_64-linux-gnu/libpng12.so.0 (0x00007f29cd2f2000)
libusb-1.0.so.0 => /lib/x86_64-linux-gnu/libusb-1.0.so.0 (0x00007f29cd0db000)
libOpenNI2.so.0 => /usr/lib/libOpenNI2.so.0 (0x00007f29cce80000)
libOpenNI.so.0 => /usr/lib/libOpenNI.so.0 (0x00007f29ccc08000)
/lib64/ld-linux-x86-64.so.2 (0x00007f29d3d22000)
libpcl_octree.so.1.7 => /usr/lib/libpcl_octree.so.1.7 (0x00007f29cc81b000)
libpcl_kdtree.so.1.7 => /usr/lib/libpcl_kdtree.so.1.7 (0x00007f29cc4f4000)
libvtkGraphics.so.5.8 => /usr/lib/libvtkGraphics.so.5.8 (0x00007f29cbb38000)
libvtkHybrid.so.5.8 => /usr/lib/libvtkHybrid.so.5.8 (0x00007f29cb656000)
libvtkWidgets.so.5.8 => /usr/lib/libvtkWidgets.so.5.8 (0x00007f29cb282000)
libvtkCharts.so.5.8 => /usr/lib/libvtkCharts.so.5.8 (0x00007f29cafa4000)
libGL.so.1 => /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1 (0x00007f29cad15000)
libvtkftgl.so.5.8 => /usr/lib/libvtkftgl.so.5.8 (0x00007f29cab0a000)
libQtGui.so.4 => /usr/lib/x86_64-linux-gnu/libQtGui.so.4 (0x00007f29c9e57000)
libQtCore.so.4 => /usr/lib/x86_64-linux-gnu/libQtCore.so.4 (0x00007f29c9972000)
libgl2ps.so.0 => /usr/lib/libgl2ps.so.0 (0x00007f29c975f000)
libXt.so.6 => /usr/lib/x86_64-linux-gnu/libXt.so.6 (0x00007f29c94f9000)
libX11.so.6 => /usr/lib/x86_64-linux-gnu/libX11.so.6 (0x00007f29c91c4000)
libvtksys.so.5.8 => /usr/lib/libvtksys.so.5.8 (0x00007f29c8f88000)
libfreetype.so.6 => /usr/lib/x86_64-linux-gnu/libfreetype.so.6 (0x00007f29c8ce5000)
librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007f29c8add000)
libz.so.1 => /lib/x86_64-linux-gnu/libz.so.1 (0x00007f29c88c4000)
libbz2.so.1.0 => /lib/x86_64-linux-gnu/libbz2.so.1.0 (0x00007f29c86b4000)
libpq.so.5 => /usr/lib/libpq.so.5 (0x00007f29c8485000)
libmysqlclient.so.18 => /usr/lib/x86_64-linux-gnu/libmysqlclient.so.18 (0x00007f29c7f4d000)
libvtkDICOMParser.so.5.8 => /usr/lib/libvtkDICOMParser.so.5.8 (0x00007f29c7d34000)
libnetcdf.so.7 => /usr/lib/libnetcdf.so.7 (0x00007f29c79f7000)
libnetcdf_c++.so.4 => /usr/lib/libnetcdf_c++.so.4 (0x00007f29c77da000)
libvtkmetaio.so.5.8 => /usr/lib/libvtkmetaio.so.5.8 (0x00007f29c754d000)
libsqlite3.so.0 => /usr/lib/x86_64-linux-gnu/libsqlite3.so.0 (0x00007f29c7294000)
libjpeg.so.8 => /usr/lib/x86_64-linux-gnu/libjpeg.so.8 (0x00007f29c703f000)
libtiff.so.5 => /usr/lib/x86_64-linux-gnu/libtiff.so.5 (0x00007f29c6dcd000)
libexpat.so.1 => /lib/x86_64-linux-gnu/libexpat.so.1 (0x00007f29c6ba3000)
libavformat.so.54 => /usr/lib/x86_64-linux-gnu/libavformat.so.54 (0x00007f29c6881000)
libavcodec.so.54 => /usr/lib/x86_64-linux-gnu/libavcodec.so.54 (0x00007f29c5b2d000)
libavutil.so.52 => /usr/lib/x86_64-linux-gnu/libavutil.so.52 (0x00007f29c5908000)
libswscale.so.2 => /usr/lib/x86_64-linux-gnu/libswscale.so.2 (0x00007f29c56c1000)
libudev.so.1 => /lib/x86_64-linux-gnu/libudev.so.1 (0x00007f29c54b0000)
libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f29c52ac000)
libtinyxml.so.2.6.2 => /usr/lib/x86_64-linux-gnu/libtinyxml.so.2.6.2 (0x00007f29c5097000)
libvtkverdict.so.5.8 => /usr/lib/libvtkverdict.so.5.8 (0x00007f29c4e61000)
libvtkParallel.so.5.8 => /usr/lib/libvtkParallel.so.5.8 (0x00007f29c4a5e000)
libvtkexoIIc.so.5.8 => /usr/lib/libvtkexoIIc.so.5.8 (0x00007f29c4814000)
libvtkViews.so.5.8 => /usr/lib/libvtkViews.so.5.8 (0x00007f29c457a000)
libvtkInfovis.so.5.8 => /usr/lib/libvtkInfovis.so.5.8 (0x00007f29c40e2000)
libglapi.so.0 => /usr/lib/x86_64-linux-gnu/libglapi.so.0 (0x00007f29c3eb4000)
libXext.so.6 => /usr/lib/x86_64-linux-gnu/libXext.so.6 (0x00007f29c3ca2000)
libXdamage.so.1 => /usr/lib/x86_64-linux-gnu/libXdamage.so.1 (0x00007f29c3a9f000)
libXfixes.so.3 => /usr/lib/x86_64-linux-gnu/libXfixes.so.3 (0x00007f29c3899000)
libX11-xcb.so.1 => /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1 (0x00007f29c3697000)
libxcb-glx.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0 (0x00007f29c3480000)
libxcb-dri2.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0 (0x00007f29c327b000)
libxcb-dri3.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0 (0x00007f29c3078000)
libxcb-present.so.0 => /usr/lib/x86_64-linux-gnu/libxcb-present.so.0 (0x00007f29c2e75000)
libxcb-sync.so.1 => /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1 (0x00007f29c2c6f000)
libxcb.so.1 => /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007f29c2a50000)
libxshmfence.so.1 => /usr/lib/x86_64-linux-gnu/libxshmfence.so.1 (0x00007f29c284e000)
libXxf86vm.so.1 => /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1 (0x00007f29c2648000)
libdrm.so.2 => /usr/lib/x86_64-linux-gnu/libdrm.so.2 (0x00007f29c243a000)
libfontconfig.so.1 => /usr/lib/x86_64-linux-gnu/libfontconfig.so.1 (0x00007f29c21fe000)
libaudio.so.2 => /usr/lib/x86_64-linux-gnu/libaudio.so.2 (0x00007f29c1fe6000)
libglib-2.0.so.0 => /lib/x86_64-linux-gnu/libglib-2.0.so.0 (0x00007f29c1cde000)
libgobject-2.0.so.0 => /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0 (0x00007f29c1a8d000)
libSM.so.6 => /usr/lib/x86_64-linux-gnu/libSM.so.6 (0x00007f29c1885000)
libICE.so.6 => /usr/lib/x86_64-linux-gnu/libICE.so.6 (0x00007f29c1669000)
libXi.so.6 => /usr/lib/x86_64-linux-gnu/libXi.so.6 (0x00007f29c1459000)
libXrender.so.1 => /usr/lib/x86_64-linux-gnu/libXrender.so.1 (0x00007f29c124f000)
libssl.so.1.0.0 => /lib/x86_64-linux-gnu/libssl.so.1.0.0 (0x00007f29c0ff0000)
libcrypto.so.1.0.0 => /lib/x86_64-linux-gnu/libcrypto.so.1.0.0 (0x00007f29c0c15000)
libkrb5.so.3 => /usr/lib/x86_64-linux-gnu/libkrb5.so.3 (0x00007f29c094a000)
libcom_err.so.2 => /lib/x86_64-linux-gnu/libcom_err.so.2 (0x00007f29c0746000)
libgssapi_krb5.so.2 => /usr/lib/x86_64-linux-gnu/libgssapi_krb5.so.2 (0x00007f29c0500000)
libldap_r-2.4.so.2 => /usr/lib/x86_64-linux-gnu/libldap_r-2.4.so.2 (0x00007f29c02af000)
libhdf5_hl.so.7 => /usr/lib/x86_64-linux-gnu/libhdf5_hl.so.7 (0x00007f29c007f000)
libhdf5.so.7 => /usr/lib/x86_64-linux-gnu/libhdf5.so.7 (0x00007f29bfbe3000)
libcurl-gnutls.so.4 => /usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 (0x00007f29bf981000)
liblzma.so.5 => /lib/x86_64-linux-gnu/liblzma.so.5 (0x00007f29bf75f000)
libjbig.so.0 => /usr/lib/x86_64-linux-gnu/libjbig.so.0 (0x00007f29bf551000)
librtmp.so.0 => /usr/lib/x86_64-linux-gnu/librtmp.so.0 (0x00007f29bf337000)
libgnutls.so.26 => /usr/lib/x86_64-linux-gnu/libgnutls.so.26 (0x00007f29bf079000)
libxvidcore.so.4 => /usr/lib/x86_64-linux-gnu/libxvidcore.so.4 (0x00007f29bed3b000)
libx264.so.142 => /usr/lib/x86_64-linux-gnu/libx264.so.142 (0x00007f29be9a5000)
libvpx.so.1 => /usr/lib/x86_64-linux-gnu/libvpx.so.1 (0x00007f29be5c6000)
libvorbisenc.so.2 => /usr/lib/x86_64-linux-gnu/libvorbisenc.so.2 (0x00007f29be0f7000)
libvorbis.so.0 => /usr/lib/x86_64-linux-gnu/libvorbis.so.0 (0x00007f29bdeca000)
libtheoraenc.so.1 => /usr/lib/x86_64-linux-gnu/libtheoraenc.so.1 (0x00007f29bdc8a000)
libtheoradec.so.1 => /usr/lib/x86_64-linux-gnu/libtheoradec.so.1 (0x00007f29bda71000)
libspeex.so.1 => /usr/lib/x86_64-linux-gnu/libspeex.so.1 (0x00007f29bd858000)
libschroedinger-1.0.so.0 => /usr/lib/x86_64-linux-gnu/libschroedinger-1.0.so.0 (0x00007f29bd594000)
libopus.so.0 => /usr/lib/x86_64-linux-gnu/libopus.so.0 (0x00007f29bd34c000)
libopenjpeg.so.2 => /usr/lib/x86_64-linux-gnu/libopenjpeg.so.2 (0x00007f29bd12a000)
libmp3lame.so.0 => /usr/lib/x86_64-linux-gnu/libmp3lame.so.0 (0x00007f29bce9d000)
libgsm.so.1 => /usr/lib/x86_64-linux-gnu/libgsm.so.1 (0x00007f29bcc8f000)
libva.so.1 => /usr/lib/x86_64-linux-gnu/libva.so.1 (0x00007f29bca78000)
libcgmanager.so.0 => /lib/x86_64-linux-gnu/libcgmanager.so.0 (0x00007f29bc85d000)
libnih.so.1 => /lib/x86_64-linux-gnu/libnih.so.1 (0x00007f29bc645000)
libnih-dbus.so.1 => /lib/x86_64-linux-gnu/libnih-dbus.so.1 (0x00007f29bc43b000)
libdbus-1.so.3 => /lib/x86_64-linux-gnu/libdbus-1.so.3 (0x00007f29bc1f6000)
libVPIC.so.5.8 => /usr/lib/libVPIC.so.5.8 (0x00007f29bbfcd000)
libCosmo.so.5.8 => /usr/lib/libCosmo.so.5.8 (0x00007f29bbd9e000)
libmpi_cxx.so.1 => /usr/lib/libmpi_cxx.so.1 (0x00007f29bbb84000)
libmpi.so.1 => /usr/lib/libmpi.so.1 (0x00007f29bb803000)
libxml2.so.2 => /usr/lib/x86_64-linux-gnu/libxml2.so.2 (0x00007f29bb49d000)
libvtkalglib.so.5.8 => /usr/lib/libvtkalglib.so.5.8 (0x00007f29bb279000)
libXau.so.6 => /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007f29bb075000)
libXdmcp.so.6 => /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007f29bae6f000)
libpcre.so.3 => /lib/x86_64-linux-gnu/libpcre.so.3 (0x00007f29bac31000)
libffi.so.6 => /usr/lib/x86_64-linux-gnu/libffi.so.6 (0x00007f29baa29000)
libuuid.so.1 => /lib/x86_64-linux-gnu/libuuid.so.1 (0x00007f29ba824000)
libk5crypto.so.3 => /usr/lib/x86_64-linux-gnu/libk5crypto.so.3 (0x00007f29ba5f5000)
libkrb5support.so.0 => /usr/lib/x86_64-linux-gnu/libkrb5support.so.0 (0x00007f29ba3ea000)
libkeyutils.so.1 => /lib/x86_64-linux-gnu/libkeyutils.so.1 (0x00007f29ba1e6000)
libresolv.so.2 => /lib/x86_64-linux-gnu/libresolv.so.2 (0x00007f29b9fcb000)
liblber-2.4.so.2 => /usr/lib/x86_64-linux-gnu/liblber-2.4.so.2 (0x00007f29b9dbc000)
libsasl2.so.2 => /usr/lib/x86_64-linux-gnu/libsasl2.so.2 (0x00007f29b9ba1000)
libgssapi.so.3 => /usr/lib/x86_64-linux-gnu/libgssapi.so.3 (0x00007f29b9963000)
libgcrypt.so.11 => /lib/x86_64-linux-gnu/libgcrypt.so.11 (0x00007f29b96e3000)
libidn.so.11 => /usr/lib/x86_64-linux-gnu/libidn.so.11 (0x00007f29b94b0000)
libtasn1.so.6 => /usr/lib/x86_64-linux-gnu/libtasn1.so.6 (0x00007f29b929c000)
libp11-kit.so.0 => /usr/lib/x86_64-linux-gnu/libp11-kit.so.0 (0x00007f29b905a000)
libogg.so.0 => /usr/lib/x86_64-linux-gnu/libogg.so.0 (0x00007f29b8e51000)
liborc-0.4.so.0 => /usr/lib/x86_64-linux-gnu/liborc-0.4.so.0 (0x00007f29b8bcf000)
libutil.so.1 => /lib/x86_64-linux-gnu/libutil.so.1 (0x00007f29b89cc000)
libhwloc.so.5 => /usr/lib/x86_64-linux-gnu/libhwloc.so.5 (0x00007f29b878c000)
libltdl.so.7 => /usr/lib/x86_64-linux-gnu/libltdl.so.7 (0x00007f29b8582000)
libheimntlm.so.0 => /usr/lib/x86_64-linux-gnu/libheimntlm.so.0 (0x00007f29b8379000)
libkrb5.so.26 => /usr/lib/x86_64-linux-gnu/libkrb5.so.26 (0x00007f29b80f1000)
libasn1.so.8 => /usr/lib/x86_64-linux-gnu/libasn1.so.8 (0x00007f29b7e50000)
libhcrypto.so.4 => /usr/lib/x86_64-linux-gnu/libhcrypto.so.4 (0x00007f29b7c1d000)
libroken.so.18 => /usr/lib/x86_64-linux-gnu/libroken.so.18 (0x00007f29b7a08000)
libgpg-error.so.0 => /lib/x86_64-linux-gnu/libgpg-error.so.0 (0x00007f29b7803000)
libnuma.so.1 => /usr/lib/x86_64-linux-gnu/libnuma.so.1 (0x00007f29b75f8000)
libwind.so.0 => /usr/lib/x86_64-linux-gnu/libwind.so.0 (0x00007f29b73cf000)
libheimbase.so.1 => /usr/lib/x86_64-linux-gnu/libheimbase.so.1 (0x00007f29b71c1000)
libhx509.so.5 => /usr/lib/x86_64-linux-gnu/libhx509.so.5 (0x00007f29b6f78000)
libcrypt.so.1 => /lib/x86_64-linux-gnu/libcrypt.so.1 (0x00007f29b6d3f000)
现在,当我尝试在 ipython 中导入这个库时,出现以下错误:
In [1]: import libpcltest
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-93c311da18da> in <module>()
----> 1 import libpcltest
ImportError: ./libpcltest.so: undefined symbol: _ZNK5boost6python7objects21py_function_impl_base9max_arityEv
通过简单地在谷歌中复制粘贴这个错误,我发现这个错误对应于 libboost_python.so 库的链接错误。为了证实我的疑问,我检查了我的库 libpcltest.so 的 ldd 输出并意识到指向 libboost_python.so 的链接确实丢失了。
为了进一步调查,然后我使用第二个 CMakeLists.txt 的配置编译了第一个示例中的 hello.cpp 代码(其中还包括 PCL,包括目录和到 PCL 库的链接),令人惊讶的是,结果共享库的 ldd 输出确实没有指向 libboost_python.so 的链接
这个错误似乎与同时使用libboost_python和PCL有关,但我仍然不知道如何解决它。
有人可以帮我解决这里的问题吗?附言我正在使用 ubuntu 14.04,这里使用的所有库都是默认系统库。
最佳答案
我想我知道这里出了什么问题。当我检查 cmake
的输出时,我得到以下信息:
badami@Zusi:~/Codes/indor_seg/pySegment/libC++/build$ cmake ..
-- Boost version: 1.54.0
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- python
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- thread
-- date_time
-- iostreams
-- serialization
-- chrono
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
-- looking for PCL_COMMON
-- looking for PCL_OCTREE
-- looking for PCL_IO
-- looking for PCL_KDTREE
-- looking for PCL_GEOMETRY
-- looking for PCL_SEARCH
-- looking for PCL_VISUALIZATION
-- looking for PCL_SAMPLE_CONSENSUS
-- looking for PCL_FILTERS
-- looking for PCL_FEATURES
-- Configuring done
-- Generating done
-- Build files have been written to: /home/badami/Codes/indor_seg/pySegment/libC++/build
如您所见,它找到了两次 Boost 库,一次来自系统默认的 boost 安装,一次来自 PCL 中的 boost。
由于在我的CMakeLists.txt中,我先搜索boost库,然后再搜索PCL,发现boost的python库被PCL中的boost库覆盖。
当我更改 CMakeLists.txt 文件中的顺序时
FIND_PACKAGE(Boost 1.54.0 COMPONENTS python)
FIND_PACKAGE(PCL 1.7 REQUIRED COMPONENTS common io visualization features)
到
FIND_PACKAGE(PCL 1.7 REQUIRED COMPONENTS common io visualization features)
FIND_PACKAGE(Boost 1.54.0 COMPONENTS python)
cmake
对应的输出变为:
badami@Zusi:~/Codes/indor_seg/pySegment/libC++/build$ cmake ..
-- Boost version: 1.54.0
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- system
-- filesystem
-- thread
-- date_time
-- iostreams
-- serialization
-- chrono
** WARNING ** io features related to pcap will be disabled
** WARNING ** io features related to png will be disabled
-- looking for PCL_COMMON
-- looking for PCL_OCTREE
-- looking for PCL_IO
-- looking for PCL_KDTREE
-- looking for PCL_GEOMETRY
-- looking for PCL_SEARCH
-- looking for PCL_VISUALIZATION
-- looking for PCL_SAMPLE_CONSENSUS
-- looking for PCL_FILTERS
-- looking for PCL_FEATURES
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- python
-- Configuring done
-- Generating done
-- Build files have been written to: /home/badami/Codes/indor_seg/pySegment/libC++/build
并且 libboost_python.so 成功链接到生成的共享库。
非常欢迎更优雅的解决方案。
关于c++ - 为 PCL c++ 代码创建的 boost.python 模块导入错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33503373/
我想在可移植的 C# 类中实现这个逻辑: static JsonWebToken() { HashAlgorithms = new Dictionary>
我有一个线程可以在处理点云时将其可视化。我还需要可视化法线,我该如何更新它们? 我找不到像普通云的 updateClouds 这样的东西。 void pclVisualizerThread::oper
下面的函数没有产生结果。换句话说,点云中的点数与降采样前完全相同。我尝试了从 0.01 一直到您在下面看到的那些不同的叶子大小数字,但它们都产生相同的结果。我不得不对从 pcl::PointCloud
我是 PCL 的新手。我正在使用 PCL 库,我正在寻找一种从点云中提取点或将特定点复制到新点的方法。我想验证每个点是否符合条件,我想获得一个只有好的点的点云。谢谢! 最佳答案 使用 ExtractI
我更新到了最新版本的 Xamarin,其中“完全支持”PCL。我现在如何使用 Azure 移动服务? 如果我创建 PCL 库并尝试使用 NuGet 添加它,则无法安装“Newtonsoft.Json
创建 C# Xamarin Forms 应用 添加 C# PCL 添加 F# PCL 尝试添加从 C# PCL 到 F# PCL 的引用 -> 在引用对话框中您将看到:不兼容的框架定义::NETFra
我现在正在使用一些 Laserscans,并希望在 C++ 中对 PointClouds 进行下采样。我在构建过程中遇到了一个奇怪的问题,我认为在我尝试编译代码时的库链接过程中。这里是问题似乎来自的最
我想知道这是否可能。我有一个功能: pcl::PointCloud createPointCloud(std::Vector input) 返回一个点云。我想知道是否可以获取这个点云,并制作一个指向
我正在尝试使用点云库提供的 RANSAC 方法估计通过点云点的线。我可以创建对象,并毫无问题地估计线模型,如下所示: pcl::PointCloud::ConstPtr source_cloud(ne
正在尝试使用 PCL为 mvvmcross使用 Profile 78 的 TPL (关于问题 TPL on PCL of mvvmcross) 上 iOS项目正在运行,但不适用于 android .
我使用以下命令安装了 PCL。 sudo add-apt-repository ppa:v-launchpad-jochen-sprickerhof-de/pcl sudo apt-get updat
PCL库中是否有任何函数可以保存pcl::PointCloud可以用Meshlab打开的XYZRGB格式的点云? 好像pcl::io::savePCDFileASCII (filename, clou
我正在尝试使用 PortableRest从 Xamarin Forms 对 Web API 2.2 Rest 服务进行异步调用。 我想我遇到了某种死锁/同步上下文问题,但我无法解决(新手到异步等)。
我正尝试在 C++ 中运行以下命令: #include #include "pcl/pcl_base.h" #include "pcl/PointIndices.h" #include "pcl/c
在 .NET 标准 PCL 项目中,我想引用一个针对配置文件 111 (lib\portable-win8+net45+wpa81+MonoAndroid+Xamarin.iOS10) 的私有(pri
我想使用 PCL 加载点云数据。我可以在教程中正确加载示例数据,但是当我尝试使用我的数据时,pcd 文件的值被更改为非常小的值。 终端输出图像 实际值类似于 3603538.71629,但当 PCL
我在创建 F# 可移植项目时遇到问题,该项目应该从 C# 可移植项目中引用。添加此类引用时,会出现以下消息: Unable to add a reference to 'PortableLibrary
操作系统:Ubuntu20.04 PCL信息: Package: libpcl-dev Version: 1.10.0+dfsg-5ubuntu1 Priority: extra Section: u
我想删除 SQLite.Net-PCL打包并想使用sqlite-net-pcl因为我后来发现SQLite.Net-PCL官方没有维护。 我的 Xamarin 项目中有一些表将 GUID 存储为字符串类
我有一些代码如下所示: typedef pcl::PointXYZRGB pcl_ColorPointType; typedef pcl::PointXYZ pcl_PointType; typede
我是一名优秀的程序员,十分优秀!