Ask Your Question
0

Linking error with OpenCV on Jetson TK1

asked 2018-01-06 13:06:50 -0600

ferasb gravatar image

Hi there everybody,

I am currently trying to build a package on my Jetson TK1. The package already works on my laptop. Everything works up to the linking stage of the catkin_make. The errors look like : Linking CXX executable /home/ubuntu/catkin_ws/devel/lib/turtlebot_/face_follower face_follower.cpp(.text+0x2fc): undefined reference to 'cv::CascadeClassifier::load(cv::String const&)'

For reference, here's my CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
set(CMAKE_CXX_FLAGS "-std=c++11")
# PROJECT NAME 
project(turtlebot_)

# CATKIN PREFIX FOR LIBFREENECT AND OPENCV DIRECTORIES
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} /usr/local/lib)
set(OpenCV_DIR /usr/share/OpenCV)

# ENABLE THREADING AND OPENGL (FOR LATER USE (EX: DISPLAY WITHOUT IMSHOW()))
set(THREADS_USE_PTHREADS_WIN32 true)
find_package(Threads)
find_package(OpenGL)
find_package(GLUT)

# ROS RELATED PACKAGES
find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  geometry_msgs
  image_transport
  kobuki_msgs
  nodelet
  pluginlib
  roscpp
  rospy
  rviz
  sensor_msgs
  std_msgs
  tf
  urdf
  xacro
  yocs_controllers
  OpenCV
  message_filters
)

if(CMAKE_VERSION VERSION_LESS "2.8.11")
# Add OpenCV headers location to your include paths
include_directories(${OpenCV_INCLUDE_DIRS})
endif()

# NON-ROS RELATED PACKAGES
find_package(libfreenect REQUIRED)

# REQUIRED TO USE ROS.H
catkin_package()
include_directories(
  include ${catkin_INCLUDE_DIRS} ${freenect_INCLUDE_DIRS})

# LIBFREENECT/THREADING/OPENGL DIRECTORIES (SEE EXAMPLES IN LIBFREENECT/EXAMPLES/CMAKELISTS.TXT)
include_directories("/usr/include/libusb-1.0/")
include_directories(../wrappers/c_sync/)
include_directories(${THREADS_PTHREADS_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR} ${GLUT_INCLUDE_DIR})

# ADDING NODES AND LINKING REQUIRED LIBRARIES
add_executable(face_follower src/face_follower.cpp)
target_link_libraries(face_follower ${OpenCV_LIBS} ${catkin_LIBRARIES} freenect freenect_sync ${CMAKE_THREAD_LIBS_INIT} ${MATH_LIB})

# LIKE ALWAYS
add_dependencies(face_follower face_follower_generate_messages_cpp)

I looked into /usr/local/lib and it seems that the OpenCV files are located inside a folder named arm-linux-gnueabihf. I copied them ouside of that folder with their pkgconfig file too but it didn't solve the problem.

Any thoughts?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-01-06 17:16:33 -0600

ferasb gravatar image

I managed to solve my problem. I had mistakenly installed OpenCV by myself but since ROS Indigo already has it, some problems were ocurring. I had another error about libfreenect.so.0.6 and I solved it by writting in my terminal (or .bashrc for that matter) the following line: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH=/usr/local/lib.

Now, the thing is that regular OpenCV, or at least the one that comes with Indigo, isn't using GPU acceleration. Face detection is atrociously slow. Will have to find a solution to that...

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2018-01-06 13:06:50 -0600

Seen: 112 times

Last updated: Jan 06 '18