Coder Social home page Coder Social logo

Comments (15)

hanl09 avatar hanl09 commented on July 30, 2024 12

I was trying to compile rpg_svo on my Laptop in the environment of Ubuntu 14.04 with the support of ROS. I also meet such a problem and fixed it luckily by modifying the CMakeLists.txt under vikit_common.

Here is how I treat this problem:
In CMakeLists.txt under vikit_common, there is a command as listed below:
cmakelists

which indicates that Sophus_LIBRARIES should be added as a linked lib, but it was null when I tried to
print it by using: message("sophus_lib: ${Sophus_LIBRARIES}").

I know that when compiling Sophus, a lib file libSophus.so will be built and it should be added in Sophus_LIBRARIES, so I added one command above the TARGET_LINK_LIBRARIES command as:
set{Sophus_LIBRARIES libSophus.so} and succeed by recompile rpg_svo using the catkin_make command.

modified

The problem was caused by missing to add the link to libSophus.so when compile the vikit_common problem. I don't know why it happens.

from rpg_svo.

hanl09 avatar hanl09 commented on July 30, 2024 5

yes, that should be set(Sophus_LIBRARIES libSophus.so) rather than set{Sophus_LIBRARIES libSophus.so}
my mistake

from rpg_svo.

zeadope-zz avatar zeadope-zz commented on July 30, 2024 4

I tried to add the suggested line set{Sophus_LIBRARIES libSophus.so} to ~/catkin_ws/src/rgp_vikit/vikit_common/CMakeLists.txt. But that did not work and got an error instantly "set{{Sophus_LIBRARIES".

Then I changed the line to SET(Sophus_LIBRARIES libSophus.so). That error was gone.
Now I end up with the error: /usr/bin/ld: cannot find -lSophus

So I went to ~/catkin_ws/Sophus/build/ directory and did a "sudo make install" and catkin_make again.
Success! vikit_common and the rest of rpg_vikit and rpg_svo compiled without a hitch.

from rpg_svo.

binary42 avatar binary42 commented on July 30, 2024 1

Please fix this. Otherwise I will create a pull request with the correct and modified CMakeLists.txt to handle this error.

from rpg_svo.

cfo avatar cfo commented on July 30, 2024

did you checkout the right version of sophus?

git checkout a621ff

from rpg_svo.

bvibhav avatar bvibhav commented on July 30, 2024

Yes, Its that version. Just to make sure, I rebuild it. It still gives the same error

from rpg_svo.

zeadope-zz avatar zeadope-zz commented on July 30, 2024

Just encountered the exact same problem. Can't seem to figure out a solution. Any help would be appreciated.

from rpg_svo.

tmagcaya avatar tmagcaya commented on July 30, 2024

Thanks!

from rpg_svo.

wang-chen avatar wang-chen commented on July 30, 2024

thanks

from rpg_svo.

cehberlin avatar cehberlin commented on July 30, 2024

I had the same problem. Adding SET(Sophus_LIBRARIES libSophus.so) and using make install worked for me as well. May add this line as a fix?

from rpg_svo.

binary42 avatar binary42 commented on July 30, 2024

FYI this issue exists for both vikit and svo compile

from rpg_svo.

binary42 avatar binary42 commented on July 30, 2024

Unfortunately, adding SET ... for sophus for the svo compile, though works, when svo is run, one gets:
symbol lookup error: ./lib/libsvo.so: undefined symbol: _ZN6Sophus3SE3C1Ev. Very frustrating

from rpg_svo.

qiangw89 avatar qiangw89 commented on July 30, 2024

@binary42 Did you figure out one way to solve the issue? I got the same error as well. Just like you said, "very frustrating". Thanks very much!

from rpg_svo.

Sbenai avatar Sbenai commented on July 30, 2024

[ 88%] Built target vikit_common
Linking CXX executable /home/benaissa/catkin_ws/devel/lib/vikit_common/test_vk_common_camera
/home/benaissa/catkin_ws/devel/lib/libvikit_common.so: undefined reference to Sophus::SE3::SE3(Eigen::Matrix<double, 3, 3, 0, 3, 3> const&, Eigen::Matrix<double, 3, 1, 0, 3, 1> const&)' /home/benaissa/catkin_ws/devel/lib/libvikit_common.so: undefined reference toSophus::SE3::operator_(Eigen::Matrix<double, 3, 1, 0, 3, 1> const&) const'
/home/benaissa/catkin_ws/devel/lib/libvikit_common.so: undefined reference to Sophus::SE3::exp(Eigen::Matrix<double, 6, 1, 0, 6, 1> const&)' /home/benaissa/catkin_ws/devel/lib/libvikit_common.so: undefined reference toSophus::SE3::operator_(Sophus::SE3 const&) const'
/home/benaissa/catkin_ws/devel/lib/libvikit_common.so: undefined reference to Sophus::SE3::operator=(Sophus::SE3 const&)' /home/benaissa/catkin_ws/devel/lib/libvikit_common.so: undefined reference toSophus::SE3::SE3()'
/home/benaissa/catkin_ws/devel/lib/libvikit_common.so: undefined reference to Sophus::SO3::matrix() const' /home/benaissa/catkin_ws/devel/lib/libvikit_common.so: undefined reference toSophus::SE3::SE3(Sophus::SE3 const&)'
collect2: ld a retourné 1 code d'état d'exécution
make[2]: *** [/home/benaissa/catkin_ws/devel/lib/vikit_common/test_vk_common_camera] Erreur 1
make[1]: *** [svo_slam/rpg_vikit/vikit_common/CMakeFiles/test_vk_common_camera.dir/all] Erreur 2
make: *** [all] Erreur 2
Invoking "make" failed
root@ubuntu:~/catkin_ws#

__
how to fixe this problem ?

from rpg_svo.

Sbenai avatar Sbenai commented on July 30, 2024

Go to vikit_common directory:

cd ~/catkin_ws/src/svo_slam/rpg_vikit/vikit_common
geany CMakeLists.txt

#######################################
SET(PROJECT_NAME vikit_common)
PROJECT(${PROJECT_NAME})
CMAKE_MINIMUM_REQUIRED (VERSION 2.8.3)
SET(CMAKE_BUILD_TYPE Release) # Release, RelWithDebInfo
SET(CMAKE_VERBOSE_MAKEFILE OFF)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/CMakeModules/")
SET(USE_ROS TRUE) # Set False if you want to build this package without Catkin

Set build flags. Set IS_ARM on odroid board as environment variable

SET(CMAKE_CXX_FLAGS "-Wall -D_LINUX -D_REENTRANT -march=native -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unknown-pragmas")
IF(DEFINED ENV{ARM_ARCHITECTURE})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -march=armv7-a")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmmx -msse -msse -msse2 -msse3 -mssse3")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ENDIF()
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -fsee -fomit-frame-pointer -fno-signed-zeros -fno-math-errno -funroll-loops")

Add plain cmake packages

FIND_PACKAGE(OpenCV REQUIRED)
FIND_PACKAGE(Eigen REQUIRED)
FIND_PACKAGE(Sophus REQUIRED)

Include dirs

INCLUDE_DIRECTORIES(
include
${Eigen_INCLUDE_DIRS}
${OpenCV_INCLUDE_DIRS}
${Sophus_INCLUDE_DIRS}
)

IF(USE_ROS)
FIND_PACKAGE(catkin REQUIRED COMPONENTS roscpp cmake_modules)
LIST(APPEND INCLUDE_DIRECTORIES ${catkin_INCLUDE_DIRS})
catkin_package(
DEPENDS Eigen OpenCV Sophus
CATKIN_DEPENDS roscpp
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
)
ELSE()
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
ENDIF()

Set Sourcefiles

LIST(APPEND SOURCEFILES src/atan_camera.cpp
src/omni_camera.cpp
src/math_utils.cpp
src/vision.cpp
src/performance_monitor.cpp
src/robust_cost.cpp
src/user_input_thread.cpp
src/pinhole_camera.cpp
src/homography.cpp
src/img_align.cpp)

Create vikit library

set(Sophus_LIBRARIES libSophus.so)
ADD_LIBRARY(${PROJECT_NAME} SHARED ${SOURCEFILES})
TARGET_LINK_LIBRARIES(${PROJECT_NAME}
${OpenCV_LIBS}
${Sophus_LIBRARIES}
${catkin_LIBRARIES})

IF(USE_ROS)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${catkin_LIBRARIES})
ENDIF()

##Tests
ADD_EXECUTABLE(test_vk_common_camera test/test_camera.cpp)
TARGET_LINK_LIBRARIES(test_vk_common_camera ${PROJECT_NAME})

ADD_EXECUTABLE(test_vk_common_triangulation test/test_triangulation.cpp)
TARGET_LINK_LIBRARIES(test_vk_common_triangulation ${PROJECT_NAME})

ADD_EXECUTABLE(test_vk_common_patch_score test/test_patch_score.cpp)
TARGET_LINK_LIBRARIES(test_vk_common_patch_score ${PROJECT_NAME})

################################################################################

Create the vikit_commonConfig.cmake file for other cmake projects.

IF(NOT USE_ROS)
GET_TARGET_PROPERTY( FULL_LIBRARY_NAME ${PROJECT_NAME} LOCATION )
SET(vikit_common_LIBRARIES ${FULL_LIBRARY_NAME} )
SET(vikit_common_LIBRARY_DIR ${PROJECT_BINARY_DIR} )
SET(vikit_common_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/include")
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/vikit_commonConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/vikit_commonConfig.cmake @only IMMEDIATE )
export( PACKAGE vikit_common )

INSTALL(DIRECTORY include/vikit DESTINATION ${CMAKE_INSTALL_PREFIX}/include FILES_MATCHING PATTERN "*.h" )
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_PREFIX}/lib )
ENDIF()

###########################################

from rpg_svo.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.