0

I am trying to compile my own scripts that use aruco (v 3.0.7) on Linux. I am using a makefile but when I compile I get this error.

[ 33%] Building CXX object CMakeFiles/aruco_simple.dir/aruco_simple.cpp.o
/home/ucfaptv/opt/aruco-3.0.7/mine/aruco_simple.cpp:2:25: fatal error: aruco/aruco.h: No such file or directory
 #include <aruco/aruco.h>
                         ^
compilation terminated.
make[2]: *** [CMakeFiles/aruco_simple.dir/aruco_simple.cpp.o] Error 1
make[1]: *** [CMakeFiles/aruco_simple.dir/all] Error 2
make: *** [all] Error 2

My CMakeLists.txt looks like this

cmake_minimum_required(VERSION 2.8) 
SET(CMAKE_CXX_FLAGS "-std=c++11")

find_package(OpenCV REQUIRED PATHS "/home/ucfaptv/opt/opencv-3.4.4/build")
find_package(aruco REQUIRED PATH "/home/ucfaptv/opt/aruco-3.0.7/src")

add_library(aruco_simple SHARED aruco_simple.cpp)
target_link_libraries(aruco_simple aruco ${OpenCV_LIBS})

add_executable(run run.cpp)
target_link_libraries(run aruco_simple aruco ${OpenCV_LIBS})

add_executable(view view.cpp)
target_link_libraries(view aruco_simple aruco ${OpenCV_LIBS})

I thought find_package should point to the aruco.h located in /home/ucfaptv/opt/aruco-3.0.7/src

Using the same makefile (paths edited) I can compile just fine on my Mac.


I have now install aruco! A colleague pointed out that as I am installing locally (e.g. not make install) aruco.h in not in the directory /usr/local/include/aruco so the include statement is now #include <aruco.h>. I also had to edit the aruco.pc and arucoConfig.cmake files to point at the /home/ucfaptv/opt/aruco-3.0.7/src directory and not at /usr/local/include

kungphil
  • 1,759
  • 2
  • 18
  • 27
  • This is a cmake issue; it's not related to make. You should have a cmake tag and not a makefile tag. – MadScientist Nov 28 '18 at 21:47
  • Did you install opencv from source? If so, you should add opencv_extra path in cmake. You don't have to show where is aruco. Only opencv should be enough in your case. Check your opencv installation. If you installed aruco from source, cmake and make should handle the path related problems. So I believe you don't need to give the path. Can you check and update ? – aliyasineser Dec 05 '18 at 13:53

1 Answers1

0

Once you have your package, you still need to add the include path to add it to the compilation commands:

include_directories(${aruco_DIR})

(variable set according to https://github.com/elliotwoods/ArUco-MarkerMapper/blob/master/CMakeLists.txt)

And same for OpenCV.

Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62