- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试获取 LSD_SLAM工作,但是当以 91% 的速度运行 catkin_make
命令时。我收到错误消息/usr/bin/ld:
/usr/bin/ld: 找不到 -lcsparse我已经尝试使用此命令进行软链接(soft link) sudo ln -s/usr/local/lib/libg2o_solver_csparse.so/usr/bin/lcsparse.so
但这并不能解决问题。
这里是完整的错误信息:
[ 91%] Linking CXX shared library /home/adas/lsd-slam_workspace/devel/lib/liblsdslam.so
/usr/bin/ld: cannot find -lcsparse
collect2: error: ld returned 1 exit status
lsd_slam/lsd_slam_core/CMakeFiles/lsdslam.dir/build.make:755: recipe for target '/home/adas/lsd-slam_workspace/devel/lib/liblsdslam.so' failed
make[2]: * [/home/adas/lsd-slam_workspace/devel/lib/liblsdslam.so] Error 1 CMakeFiles/Makefile2:2385: recipe for target 'lsd_slam/lsd_slam_core/CMakeFiles/lsdslam.dir/all' failed
make[1]: [lsd_slam/lsd_slam_core/CMakeFiles/lsdslam.dir/all] Error 2 Makefile:140: recipe for target 'all' failed
make: ** [all] Error 2
Invoking "make -j4 -l4" failed
老实说,我不知道我还应该尝试什么,因为 apt 中也没有名为 lcsparse
的东西。此外,我还在另外两台计算机上尝试过,但仍然因为这个错误而卡住。
以下是我安装的一些信息,可能对我有帮助:
这里还有CMakeList.txt
cmake_minimum_required(VERSION 2.8.7)
project(lsd_slam_core)
# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
set(CMAKE_BUILD_TYPE Release)
find_package(catkin REQUIRED COMPONENTS
cv_bridge
OpenCV
dynamic_reconfigure
sensor_msgs
image_transport
roscpp
rosbag
cmake_modules
lsd_slam_viewer
)
find_package(Eigen3 REQUIRED)
find_package(X11 REQUIRED)
include(cmake/FindG2O.cmake)
include(cmake/FindSuiteParse.cmake)
message("-- CHOLMOD_INCLUDE_DIR : " ${CHOLMOD_INCLUDE_DIR})
message("-- CSPARSE_INCLUDE_DIR : " ${CSPARSE_INCLUDE_DIR})
message("-- G2O_INCLUDE_DIR : " ${G2O_INCLUDE_DIR})
# FabMap
# uncomment this part to enable fabmap
#add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/openFabMap)
#include_directories(${PROJECT_SOURCE_DIR}/thirdparty/openFabMap/include)
#add_definitions("-DHAVE_FABMAP")
#set(FABMAP_LIB openFABMAP )
generate_dynamic_reconfigure_options(
cfg/LSDDebugParams.cfg
cfg/LSDParams.cfg
)
catkin_package(
LIBRARIES lsdslam
DEPENDS EIGEN3 SuiteSparse
CATKIN_DEPENDS libg2o
)
# SSE flags
add_definitions("-DUSE_ROS")
add_definitions("-DENABLE_SSE")
# Also add some useful compiler flag
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -march=native -Wall -std=c++0x"
)
# Set source files
set(lsd_SOURCE_FILES
${PROJECT_SOURCE_DIR}/src/DataStructures/Frame.cpp
${PROJECT_SOURCE_DIR}/src/DataStructures/FramePoseStruct.cpp
${PROJECT_SOURCE_DIR}/src/DataStructures/FrameMemory.cpp
${PROJECT_SOURCE_DIR}/src/SlamSystem.cpp
${PROJECT_SOURCE_DIR}/src/LiveSLAMWrapper.cpp
${PROJECT_SOURCE_DIR}/src/DepthEstimation/DepthMap.cpp
${PROJECT_SOURCE_DIR}/src/DepthEstimation/DepthMapPixelHypothesis.cpp
${PROJECT_SOURCE_DIR}/src/util/globalFuncs.cpp
${PROJECT_SOURCE_DIR}/src/util/SophusUtil.cpp
${PROJECT_SOURCE_DIR}/src/util/settings.cpp
${PROJECT_SOURCE_DIR}/src/util/Undistorter.cpp
${PROJECT_SOURCE_DIR}/src/Tracking/Sim3Tracker.cpp
${PROJECT_SOURCE_DIR}/src/Tracking/Relocalizer.cpp
${PROJECT_SOURCE_DIR}/src/Tracking/SE3Tracker.cpp
${PROJECT_SOURCE_DIR}/src/Tracking/TrackingReference.cpp
${PROJECT_SOURCE_DIR}/src/IOWrapper/Timestamp.cpp
${PROJECT_SOURCE_DIR}/src/GlobalMapping/FabMap.cpp
${PROJECT_SOURCE_DIR}/src/GlobalMapping/KeyFrameGraph.cpp
${PROJECT_SOURCE_DIR}/src/GlobalMapping/g2oTypeSim3Sophus.cpp
${PROJECT_SOURCE_DIR}/src/GlobalMapping/TrackableKeyFrameSearch.cpp
)
set(SOURCE_FILES
${lsd_SOURCE_FILES}
${PROJECT_SOURCE_DIR}/src/IOWrapper/ROS/ROSImageStreamThread.cpp
${PROJECT_SOURCE_DIR}/src/IOWrapper/ROS/ROSOutput3DWrapper.cpp
${PROJECT_SOURCE_DIR}/src/IOWrapper/OpenCV/ImageDisplay_OpenCV.cpp
)
include_directories(
include
${EIGEN3_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/thirdparty/Sophus
${CSPARSE_INCLUDE_DIR} #Has been set by SuiteParse
${CHOLMOD_INCLUDE_DIR} #Has been set by SuiteParse
${OpenCV_INCLUDE_DIRS}
${catkin_INCLUDE_DIRS}
)
# build shared library.
add_library(lsdslam SHARED ${SOURCE_FILES})
target_link_libraries(lsdslam ${FABMAP_LIB} ${G2O_LIBRARIES} ${catkin_LIBRARIES} csparse cxsparse X11)
#rosbuild_link_boost(lsdslam thread)
# build live ros node
add_executable(live_slam src/main_live_odometry.cpp)
target_link_libraries(live_slam lsdslam ${catkin_LIBRARIES} ${G2O_LIBRARIES})
# build image node
add_executable(dataset src/main_on_images.cpp)
add_dependencies(lsdslam lsd_slam_viewer_generate_messages_cpp)
add_dependencies(live_slam lsd_slam_viewer_generate_messages_cpp)
add_dependencies(dataset lsd_slam_viewer_generate_messages_cpp)
target_link_libraries(dataset lsdslam ${catkin_LIBRARIES} ${G2O_LIBRARIES})
target_link_libraries(live_slam lsdslam ${OpenCV_LIBRARIES})
# TODO add INSTALL
或多或少修复了错误消息的问题...我将其添加到我的 CMakeList.txt 的顶部
find_path(CSPARSE_INCLUDE_DIR NAMES cs.h
PATHS
/usr/include/suitesparse
/usr/include
/opt/local/include
/usr/local/include
/sw/include
/usr/include/ufsparse
/opt/local/include/ufsparse
/usr/local/include/ufsparse
/sw/include/ufsparse
PATH_SUFFIXES
suitesparse
)
并将 target_linked_libraries
中的 csparse
和 cxsparse
替换为 ${CSPARSE_INCLUDE_DIR}
。现在我在 *** 遇到了 undefined reference 看这里:
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_post«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_etree«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »g2o::csparse_extension::cs_chol_workspace(cs_di_sparse const*, cs_di_symbolic const*, int*, double*)«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_pinv«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_counts«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_sfree«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_spfree«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »g2o::csparse_extension::cs_cholsolsymb(cs_di_sparse const*, double*, cs_di_symbolic const*, double*, int*)«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_nfree«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_amd«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_cumsum«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_symperm«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_schol«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_calloc«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_malloc«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »cs_di_free«
/home/alex/Schreibtisch/workspace/devel/lib/liblsdslam.so: Warnung: undefinierter Verweis auf »g2o::csparse_extension::writeCs2Octave(char const*, cs_di_sparse const*, bool)«
collect2: error: ld returned 1 exit status
lsd_slam/lsd_slam_core/CMakeFiles/live_slam.dir/build.make:232: recipe for target '/home/alex/Schreibtisch/workspace/devel/lib/lsd_slam_core/live_slam' failed
make[2]: *** [/home/alex/Schreibtisch/workspace/devel/lib/lsd_slam_core/live_slam] Error 1
CMakeFiles/Makefile2:2348: recipe for target 'lsd_slam/lsd_slam_core/CMakeFiles/live_slam.dir/all' failed
make[1]: *** [lsd_slam/lsd_slam_core/CMakeFiles/live_slam.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
HERE也是完整的输出。
最佳答案
好的,我自己修好了。这是我执行的步骤。首先,我做了编辑 2 中解释的步骤。之后我得到了一些undefined reference
的东西,我先安装libsuitesparse-dev
然后编译g2o
它对我有用,所以我希望它对你也有用。
关于c++ - catkin_make»/usr/bin/ld : cannot find -lcsparse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57077832/
我正在尝试获取 LSD_SLAM工作,但是当以 91% 的速度运行 catkin_make 命令时。我收到错误消息/usr/bin/ld: /usr/bin/ld: 找不到 -lcsparse我已经尝
我是一名优秀的程序员,十分优秀!