0

having some trouble to install aruco lib in Ubuntu 14.04 where I do not have any sudo rights and no access to /usr/...

I downloaded the .zip aruco lib and did the following:

mkdir build
cd build
cmake .. (gives me: -- Build files have been written to: software/aruco-2.0.19/build
make  (gives me some warning msg but nothing critical)
make install (gives an error)

make install gives me:

-- Install configuration: "Debug"
CMake Error at cmake_install.cmake:36 (FILE):
  file cannot create directory: /usr/local/lib/cmake.  Maybe need
  administrative privileges.

Now simple question:

how to set in the Makefile file of the build folder the path to install the lib locally

Well I would like to use this library with ros and I included it in a cpp package like this in the CMakeLists.txt:

cmake_minimum_required(VERSION 2.8.3)
PROJECT(ros_aruco)

## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
FIND_PACKAGE(catkin REQUIRED COMPONENTS roscpp tf std_msgs sensor_msgs geometry_msgs message_generation genmsg cv_bridge image_transport)

#INCLUDE_DIRECTORIES("/hri/localdisk/markus/software/aruco-2.0.19/src")
SET(ARUCO_INCLUDE_DIRS "/hri/localdisk/markus/software/aruco-2.0.19/src") ## headers!
SET(CMAKE_MODULE_PATH "/hri/localdisk/markus/software/aruco-2.0.19/build") ## path to Findaruco.cmake

#SET(CMAKE_MODULE_PATH ${ARUCO_PATH}/lib/cmake)
#SET(ARUCO_INCLUDE_DIRS ${ARUCO_PATH}/include/aruco)

## System dependencies are found with CMake's conventions
FIND_PACKAGE(aruco REQUIRED)
FIND_PACKAGE(OpenCV REQUIRED)

INCLUDE(FindPkgConfig)

SET(ROS_BUILD_TYPE Release)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++11 -march=core-avx-i -O2")

## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
    ${catkin_INCLUDE_DIRS}
    ${ARUCO_INCLUDE_DIRS}
)

add_executable(ros_aruco
    src/ros_aruco.cpp 
)

add_dependencies(ros_aruco ${catkin_EXPORTED_TARGETS})

# give .so librarys:
target_link_libraries(ros_aruco 
    ${catkin_LIBRARIES}
    ${OpenCV_LIBS}
        "/hri/localdisk/markus/software/aruco-2.0.19/build/src"
)

When compiling with that code I get this error which I acutally would like to solve:

CMakeFiles/ros_aruco.dir/src/ros_aruco.cpp.o: In function `main':
ros_aruco.cpp:(.text.startup+0x18d): undefined reference to `aruco::CameraParameters::readFromXMLFile(std::string)'
ros_aruco.cpp:(.text.startup+0x1cf): undefined reference to `aruco::CameraParameters::resize(cv::Size_<int>)'
ros_aruco.cpp:(.text.startup+0x49a): undefined reference to `aruco::CameraParameters::CameraParameters(aruco::CameraParameters const&)'
ros_aruco.cpp:(.text.startup+0x4bd): undefined reference to `aruco::MarkerDetector::detect(cv::Mat const&, std::vector<aruco::Marker, std::allocator<aruco::Marker> >&, aruco::CameraParameters, float, bool)'
ros_aruco.cpp:(.text.startup+0xfce): undefined reference to `aruco::CvDrawingUtils::draw3dCube(cv::Mat&, aruco::Marker&, aruco::CameraParameters const&, bool)'
ros_aruco.cpp:(.text.startup+0xfe7): undefined reference to `aruco::CvDrawingUtils::draw3dAxis(cv::Mat&, aruco::Marker&, aruco::CameraParameters const&)'
CMakeFiles/ros_aruco.dir/src/ros_aruco.cpp.o: In function `_GLOBAL__sub_I_current_image_copy':
ros_aruco.cpp:(.text.startup+0x1fa0): undefined reference to `aruco::CameraParameters::CameraParameters()'
ros_aruco.cpp:(.text.startup+0x1fbe): undefined reference to `aruco::MarkerDetector::MarkerDetector()'
ros_aruco.cpp:(.text.startup+0x1fcd): undefined reference to `aruco::MarkerDetector::~MarkerDetector()'
sqp_125
  • 538
  • 6
  • 21

2 Answers2

0

The Problem You Have in Compile Time is U Cannot Find The Shared Objects(.so) of The aruco library

in target_link_librariesYou Need To Add Path To Your *.so built by aruco and I think U also need To remove FIND_PACKAGE(aruco REQUIRED)

edit1

Found this Link As Well.

Community
  • 1
  • 1
Mohammad Ali
  • 569
  • 4
  • 10
0

So first, you don't have sudo permission and you can't install your library to your system default /usr/local/lib or usr/lib etc. This means find_package() won't give you feedback. What you could do is to build all aruco libraries yourself by like add_library() and write your own link_directories() include_directories() link_library() etc.

But, you could also modify the install destination.

samliu
  • 73
  • 1
  • 1
  • 7