rameau-fr / MC-Calib

A generic and robust calibration toolbox for multi-camera systems
MIT License
399 stars 57 forks source link

cmake question (anxious) #46

Closed UselessHua closed 4 months ago

UselessHua commented 1 year ago

image How to solve this problem and how to find McCalib?

rameau-fr commented 1 year ago

Thank you very much for trying MC-Calib. Please tell me more about your problem. On what OS are you trying to install the toolbox? Could you give me more details on what led to this error?

pedroarroyo commented 1 year ago

If it helps, I am also seeing this on Ubunty 20.04.

rameau-fr commented 1 year ago

Thank you very much for the additional feedback. Could you please share the entire error message? I will try to replicate it but I assume it is a problem with libraries versions. If possible could you report the version of all your dependencies ? An easy fix is to use the docker provided with MC-Calib (if you are familiar with it).

vswdigitall commented 10 months ago

I can comment line and it works.

BAILOOL commented 10 months ago

@vswdigitall please follow the issue template so we can better understand your setup and resolve the issue faster.

What's on the line CMakeLists.txt:51? I believe CMakeLists.txt has been modified in your case compared to the one found in master branch?

vswdigitall commented 10 months ago

For current master, i can't cmake your code. Only if disable line 74 it works. Line 51 solved by installing doxygen.

BAILOOL commented 10 months ago

Please provide the full output from the cmake command to start with @vswdigitall

vswdigitall commented 10 months ago

-- Boost version: 1.74.0 Doxygen build started CMake Error at CMakeLists.txt:74 (find_library): Could not find McCalib using the following names:

-- Configuring incomplete, errors occurred! See also "/home/vsw/MC-Calib/CMakeFiles/CMakeOutput.log". CMake process exited with exit code 1.

Elapsed time: 00:00.

nukbridge commented 9 months ago

I just modified CMakeLists.txt for both of ROOT and 'McCalib' directory like below and run separated build steps;

--- CMakeLists.txt.ORIG 2023-11-29 10:20:39.458403852 +0900
+++ CMakeLists.txt  2023-11-29 10:23:51.189940669 +0900
@@ -1,9 +1,44 @@
+project(McCalib)

 file(GLOB MC_CALIB_HEADERS include/*.hpp include/*.h)
 file(GLOB MC_CALIB_SOURCES CONFIGURE_DEPENDS src/*.cpp)

+# OpenCV
+find_package(OpenCV REQUIRED)
+include_directories( ${OpenCV_INCLUDE_DIRS} )
+
+# CERES
+find_package(Ceres REQUIRED)
+
+# Boost related setup
+set(Boost_USE_STATIC_LIBS ON)
+set(Boost_USE_MULTITHREADED ON)
+find_package(Boost COMPONENTS log system filesystem REQUIRED)
+message(STATUS "Boost version: ${Boost_VERSION}")
+
+# This is needed if your Boost version is newer than your CMake version
+# or if you have an old version of CMake (<3.5)
+if(NOT TARGET Boost::filesystem)
+    add_library(Boost::filesystem IMPORTED INTERFACE)
+    set_property(TARGET Boost::filesystem PROPERTY
+        INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIR})
+    set_property(TARGET Boost::filesystem PROPERTY
+        INTERFACE_LINK_LIBRARIES ${Boost_LIBRARIES})
+endif()
+
+include_directories(
+        include
+        /usr/include/opencv4
+        /usr/include/eigen3
+        /usr/local/lib
+)
+
 add_library(McCalib STATIC ${MC_CALIB_HEADERS} ${MC_CALIB_SOURCES})
 set_target_properties(McCalib PROPERTIES VERSION "${PROJECT_VERSION}")
 target_include_directories(McCalib PUBLIC include)
 target_include_directories(McCalib PUBLIC src)
 target_link_libraries(McCalib PUBLIC -L/usr/local/lib ${OpenCV_LIBS} ${CERES_LIBRARIES} Boost::log Boost::system Boost::filesystem)
+
+# Install library
+install(TARGETS ${PROJECT_NAME} DESTINATION ../${PROJECT_NAME})
+
--- CMakeLists.txt.ORIG 2023-11-29 10:26:05.823796525 +0900
+++ CMakeLists.txt  2023-11-29 10:26:30.226668818 +0900
@@ -72,6 +72,7 @@
 ##########################################################################
 add_subdirectory(apps/create_charuco_boards)
 add_subdirectory(McCalib)
-find_library(McCalib REQUIRED)
+#find_library(McCalib REQUIRED)
+find_library(McCalib NAMES libMcCalib.a PATHS McCalib/build REQUIRED)
 add_subdirectory(apps/calibrate)
 add_subdirectory(tests)

Strange things is, libMcCalib.a seems rebuilt during second build step. Anyway it's working in my case.

BAILOOL commented 4 months ago

@nukbridge thank you for providing the solution.