Error with Boost Filesystem Version in Cmake - c++

I'm working on a c++ program that uses cmake with conan to compile, and boost 1.7.4. Recently, I started getting: error: #error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3.
The program was working fine up until recently, and now just started getting this error.
Here's my cmake code
#find external libraries with Conan
----------------------------------------------------------
conan_check(VERSION 1.0.0 REQUIRED)
message(STATUS "Downloading dependency libraries with Conan")
#The boost dependency is tricky.
#Need 1.74 for correct behavior, and need options to successfully build on mac
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin")
#workaround for https://github.com/conan-io/conan-center-index/issues/4097
set(CONAN_OPTIONS boost:without_fiber=True boost:without_nowide=True)
else()
set(CONAN_OPTIONS )
endif()
conan_cmake_run(REQUIRES boost/1.74.0 jsoncpp/[>=1.8.4] eigen/[>=3.3.7] cgal/[>=5.1]
OPTIONS
${CONAN_OPTIONS}
BUILD missing
CMAKE_TARGETS
BASIC_SETUP
UPDATE)
I believe boost 1.7.4 only supports filesystem v3, is there a way to check my Boost file system version? Any potential fixes would be greatly appreciated.

We're having the same issue. I fixed it (locally) by adding
'boost:filesystem_version = 3'
to our conanfile.py's default options {}. Looks like this recent change to the recipe is the culprit: https://github.com/conan-io/conan-center-index/pull/11988

Related

Issues when building C++ using CMake with Intel oneApi

I my library I use boost's float128 wrapper therefore changing the compiler is not an option.
Following Intel's developer guide I added find_package(IntelDPCPP REQUIRED) to my CMakeLists.txt and ran cmake -DCMAKE_C_COMPILER=icx -DCMAKE_CXX_COMPILER=icx -GNinja on the VS 2022 terminal. I get the following error message
Found package configuration file:
C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/IntelDPCPP/IntelDPCPPConfig.cmake
but it set IntelDPCPP_FOUND to FALSE so package "IntelDPCPP" is considered
to be NOT FOUND. Reason given by package:
Unsupported compiler family and compiler icx!!
Anyone with a similar issue that can help out?
EDIT: as suggested by #Botje here the output information relevant to this case
IntelDPCPPConfig.cmake(84): string(COMPARE EQUAL ${CMAKE_CXX_COMPILER} nocmplr )
IntelDPCPPConfig.cmake(85): if(nocmplr)
IntelDPCPPConfig.cmake(93): if(NOT x${CMAKE_CXX_COMPILER_ID} STREQUAL xClang AND NOT x${CMAKE_CXX_COMPILER_ID} STREQUAL xIntelLLVM )
IntelDPCPPConfig.cmake(95): set(IntelDPCPP_FOUND False )
This is a known issue, it will be fixed in the OneAPI 2023.1 release.
You can try reversing the order of find_package and project or removing find_package(IntelDPCPP REQUIRED) in CMakeLists.txt. Because CMake identifies and sets up all the compiler-related variables when the project() is called.
Also, you can set the compiler option for the DPC++ compiler in CMakeLists.txt using the below command.
set(CMAKE_CXX_COMPILER dpcpp)

Using vc140 Boost for Visual Studio 17

I am currently linking boost to my current project. The libs I have been provided (I cannot ask to change them) are vc140 [They are named something like : boost_thread-vc140-mt-x64-1_67.lib]. Now, when I try to build my code, I get an error.
Error log:
LNK1104 cannot open file 'libboost_thread-vc141-mt-x64-1_67.lib'
The same can be removed using the vc141 variants (I tried using the same after downloading it once). Reading through some materials, I find that vc140 is for Studio 15 while vc141 is for Studio 17].
This Link seems to suggest vc140 will work with Studio 17. Any suggestions about what might be going wrong?
P.S. I've tried using add_definitions(-DBOOST_ALL_NO_LIB) and Boost::disable_autolinking
P.P.S My cmake is succeeding. The problem crops up during compilation. The Linker > Command Line display seems to suggest that the vc140 library is being linked successfully.
message(${Boost_LIBRARIES}) prints:
optimized
[path-to-boost]/tools/lib/boost_thread-vc140-mt-x64-1_67.libdebug
[path-to-boost]/tools/lib/boost_thread-vc140-mt-gd-x64-1_67.liboptimized
[path-to-boost]/tools/lib/boost_system-vc140-mt-x64-1_67.libdebug
[path-to-boost]/tools/lib/boost_system-vc140-mt-gd-x64-1_67.liboptimized
[path-to-boost]/tools/lib/boost_date_time-vc140-mt-x64-1_67.libdebug
[path-to-boost]/tools/lib/boost_date_time-vc140-mt-gd-x64-1_67.liboptimized
[path-to-boost]/tools/lib/boost_chrono-vc140-mt-x64-1_67.libdebug
[path-to-boost]/tools/lib/boost_chrono-vc140-mt-gd-x64-1_67.liboptimized
[path-to-boost]/tools/lib/boost_atomic-vc140-mt-x64-1_67.libdebug
[path-to-boost]/tools/lib/boost_atomic-vc140-mt-gd-x64-1_67.lib
Script snippet:
# Boost headers dependency (and boost_system calls generated by inline
# functions)
if (WIN32)
set(Boost_USE_STATIC_LIBS OFF)
find_package(Boost 1.67 REQUIRED
COMPONENTS thread system date_time chrono)
else ()
find_package(Boost 1.67 REQUIRED
COMPONENTS thread system)
endif ()
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(${MAIN_TARGET} ${Boost_LIBRARIES})
# we know how to link against Boost ourselves, thank you...
add_definitions(-DBOOST_ALL_NO_LIB)

Building Open Source library Teem with Levmar support using CMake

I try to build the library Teem under Windows 64bit with levmar support using cmakeGUI with generator VisualStudio10 Win64.
First off all, i built Levmar with CLAPACK and F2C. That works fine as levmar can be compiled without errors and the demo succeds.
The mysterious thing is, when i try to build teem with levmar support ON, cmake always turns it off "because it was not found" although i told cmake the path to levmar.lib.
Thats what the CmakeGUI tells me:
"warning: Turning off Teem_LEVMAR, because it wasn't found.
Configuring done"
Here is a part of my CMakeList.txt delivered with teem:
# Look for "levmar" library <http://www.ics.forth.gr/~lourakis/levmar/>
option(Teem_LEVMAR "Build Teem with levmar library support." OFF)
set(Teem_LEVMAR_LIB "")
if(Teem_LEVMAR)
find_package(LEVMAR)
if(LEVMAR_FOUND)
add_definitions(-DTEEM_LEVMAR)
set(Teem_LEVMAR_LIB ${LEVMAR_LIBRARIES})
set(Teem_LEVMAR_IPATH ${LEVMAR_INCLUDE_DIR})
else()
# We need to set this as a cache variable, so that it will show up as
# being turned off in the cache.
message("warning: Turning off Teem_LEVMAR, because it wasn't found.")
set(Teem_LEVMAR OFF CACHE BOOL "Build Teem with levmar library support." FORCE)
endif()
endif()
Has anyone an idea what happens here?
I tried the same thing with 3 different levmar.lib and different generators but unfortunately i suggest that i have to tell cmake the exact name of the library or the name levmar.lib is simply wrong.
I reported that question also to my supervisor for my thesis but he had the same problem and could not help me.
I also tried to modify the CMakeList:
#if(Teem_LEVMAR)
include_directories(${LEVMAR}/lib)
#endif()
which was originally
if(Teem_LEVMAR)
include_directories(${Teem_LEVMAR_IPATH})
endif()
but it did not help.
Why does cmake recognizes levmar.lib not as the levmar library, in fact does not accept it.
i also tried to understand why find_package(levmar) does not succeed but now i do not know any ways to make it work.
greetings,
jan luca.

OpenCV linking problems with ROS

I'm trying to compile this project (following the instructions given). When building it with rosmake, I get a bunch of undefined reference to cv::String::deallocate() and undefined reference to cv::String::allocate(unsigned long). I find curious that I'm getting an error just in those functions while the rest of the OpenCV functions seem to be working properly.
I know this happens because the linker can't find the objects where these functions were compiled to, but I'm kind of new to the ROS build system and can't find what's wrong.
I've tried using the CMakeLists.txt file provided, and also adding find_package(OpenCV REQUIRED) and target_link_libraries(xxx xxx ${OpenCV_LIBRARIES}), without that making any difference. I know OpenCV is installed and compiled properly (I've used it before), and I had installed ROS without any problems.
I'm using OpenCV 3, ROS Indigo, Ubuntu 14.04
I had this exact same problem - same error messages, same setup. I've managed to solve it, though I'm not exactly sure of the steps I did which actually contributed. As far as I can tell, it was due to a conflict of OpenCV versions - I think I had old versions of OpenCV cluttering my /usr/include and /usr/local. I uninstalled all OpenCV packages (including the ROS ones) and including my from-source install of OpenCV3 (also in /usr/local). Then I installed the ROS package vision_opencv, which seemed to install OpenCV 2.4.8 (incidentally the one recommended by LSD SLAM). Of course, this could be annoying if you need OpenCV3 for other things, but I now have that as a local install in my home directory (I couldn't figure out how to get ROS to link to this).
I think this solved the problem, the only issue remaining was that I got error messages saying was not found. This was because the package install leaves it in (similar for all module include files), whereas the make install step of the from-source install copies them into the parent folder. To get around this I simply edited the #include in the only file in which it is used (lsd_slam_core/src/IOWrapper/OpenCV/ImageDisplay_OpenCV.cpp). That seemed to solve it!
I hope this helps, I can give further details if needed.
I am using OpenCV 3.1.0(Bleeding edge), ROS Indigo, Ubuntu 14.04.
I ran in to similar trouble when trying to compile LSD-SLAM
I added:
find_package(OpenCV 3.1.0 REQUIRED COMPONENTS core highgui imgproc imgcodecs)
I also added opencv libs to target link libs:
target_link_libraries(lsdslam ${FABMAP_LIB} g2o_core g2o_stuff csparse cxsparse g2o_solver_csparse g2o_csparse_extension g2o_types_sim3 g2o_types_sba X11 opencv_core opencv_imgproc opencv_highgui opencv_imgcodecs)
Here is my CMakeLists.txt file:
cmake_minimum_required(VERSION 2.8.12)
project(lsd_slam_core)
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake)
find_package(OpenCV 3.1.0 REQUIRED COMPONENTS core highgui imgproc imgcodecs)
# Set the build type. Options are:
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage
# Debug : w/ debug symbols, w/o optimization
# Release : w/o debug symbols, w/ optimization
# RelWithDebInfo : w/ debug symbols, w/ optimization
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries
set(ROS_BUILD_TYPE Release)
rosbuild_init()
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
find_package(Eigen3 REQUIRED)
find_package(SuiteParse REQUIRED) # Apparently needed by g2o
find_package(X11 REQUIRED)
# FabMap
# uncomment this part to enable fabmap
#add_subdirectory(${PROJECT_SOURCE_DIR}/thirdparty/openFabMap)
#include_directories(${PROJECT_SOURCE_DIR}/thirdparty/openFabMap/include)
#add_definitions("-DHAVE_FABMAP")
#set(FABMAP_LIB openFABMAP )
# Dynamic Reconfigure Services
rosbuild_find_ros_package(dynamic_reconfigure)
include(${dynamic_reconfigure_PACKAGE_PATH}/cmake/cfgbuild.cmake)
gencfg()
# SSE flags
rosbuild_check_for_sse()
add_definitions("-DUSE_ROS")
add_definitions("-DENABLE_SSE")
# Also add some useful compiler flag
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} ${SSE_FLAGS} -march=native -std=c++0x"
)
# Set source files
set(lsd_SOURCE_FILES
${PROJECT_SOURCE_DIR}/src/DataStructures/Frame.cpp
${PROJECT_SOURCE_DIR}/src/DataStructures/FramePoseStruct.cpp
${PROJECT_SOURCE_DIR}/src/DataStructures/FrameMemory.cpp
${PROJECT_SOURCE_DIR}/src/SlamSystem.cpp
${PROJECT_SOURCE_DIR}/src/LiveSLAMWrapper.cpp
${PROJECT_SOURCE_DIR}/src/DepthEstimation/DepthMap.cpp
${PROJECT_SOURCE_DIR}/src/DepthEstimation/DepthMapPixelHypothesis.cpp
${PROJECT_SOURCE_DIR}/src/util/globalFuncs.cpp
${PROJECT_SOURCE_DIR}/src/util/SophusUtil.cpp
${PROJECT_SOURCE_DIR}/src/util/settings.cpp
${PROJECT_SOURCE_DIR}/src/util/Undistorter.cpp
${PROJECT_SOURCE_DIR}/src/Tracking/Sim3Tracker.cpp
${PROJECT_SOURCE_DIR}/src/Tracking/Relocalizer.cpp
${PROJECT_SOURCE_DIR}/src/Tracking/SE3Tracker.cpp
${PROJECT_SOURCE_DIR}/src/Tracking/TrackingReference.cpp
${PROJECT_SOURCE_DIR}/src/IOWrapper/Timestamp.cpp
${PROJECT_SOURCE_DIR}/src/GlobalMapping/FabMap.cpp
${PROJECT_SOURCE_DIR}/src/GlobalMapping/KeyFrameGraph.cpp
${PROJECT_SOURCE_DIR}/src/GlobalMapping/g2oTypeSim3Sophus.cpp
${PROJECT_SOURCE_DIR}/src/GlobalMapping/TrackableKeyFrameSearch.cpp
)
set(SOURCE_FILES
${lsd_SOURCE_FILES}
${PROJECT_SOURCE_DIR}/src/IOWrapper/ROS/ROSImageStreamThread.cpp
${PROJECT_SOURCE_DIR}/src/IOWrapper/ROS/ROSOutput3DWrapper.cpp
${PROJECT_SOURCE_DIR}/src/IOWrapper/OpenCV/ImageDisplay_OpenCV.cpp
)
include_directories(
${EIGEN3_INCLUDE_DIR}
${PROJECT_SOURCE_DIR}/src
${PROJECT_SOURCE_DIR}/thirdparty/Sophus
${CSPARSE_INCLUDE_DIR} #Has been set by SuiteParse
${CHOLMOD_INCLUDE_DIR} #Has been set by SuiteParse
)
# build shared library.
rosbuild_add_library(lsdslam SHARED ${SOURCE_FILES})
target_link_libraries(lsdslam ${FABMAP_LIB} g2o_core g2o_stuff csparse cxsparse g2o_solver_csparse g2o_csparse_extension g2o_types_sim3 g2o_types_sba X11 opencv_core opencv_imgproc opencv_highgui opencv_imgcodecs)
rosbuild_link_boost(lsdslam thread)
# build live ros node
rosbuild_add_executable(live_slam src/main_live_odometry.cpp)
target_link_libraries(live_slam lsdslam)
# build image node
rosbuild_add_executable(dataset_slam src/main_on_images.cpp)
target_link_libraries(dataset_slam lsdslam)
Do you have multi-versions Opencv? if you have, maybe you should add the path to OpenCVConfig.cmake into CmakeList.txt. Just under the cmake_minimum_required(VERSION 2.8.12),like so:
set(OpenCV_DIR "/home/ubuntu/src/opencv-3.1.0/build")
That's all.
I also had the samme issue. Could not comment Osian's solution due to lack of rep, but this is the procedure I used:
sudo apt-get remove libopencv*
If you for some reason have OpenCV installed from source, enter your build directory and do:
sudo make uninstall
Then finally
sudo apt-get install ros-indigo-desktop-full

How to make Cmake to include gl/GL.h?

Hello I am new to Linux development, and just recently switched from Windows MSVS c++ development to Linux-based vim+cmake+gcc. I am using Debian Sid(unstable).
I am trying to get code on subdivision, I have gotten from a friend to run. I am not really used to Cmake, and googling for help often is troublesome, since every other dist seems to have different packages and different solutions.
cmake_minimum_required (VERSION 2.6) project (Benchmark)
Find_Package(Qt4 REQUIRED)
Include(${QT_USE_FILE})
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
set(CORELIBS ${QT_LIBRARY} ${OPENGL_LIBRARY} )
File(GLOB SRC ".cpp")
File(GLOB HEAD ".h")
add_executable(Benchmark ${SRC})
target_link_libraries(Benchmark ${CORELIBS})
That is my current Cmake, I want to use find_package(), GLOB etc to make it as dynamic as possible, and not use absolute paths.
I get the following error when trying to build.
subdivbench/Matrix4x4.h:4:19: fatal error: gl/GL.h: No such file or directory #include gl/GL.h
compilation terminated. make[2]: [CMakeFiles/Benchmark.dir/Matrix4x4.cpp.o] Error 1 make[1]: [CMakeFiles/Benchmark.dir/all] Error 2
The code is fairly irrelevant, since it's working perfectly in windows, all I need to do is to make the include etc work for Linux.
Include GL/gl.h instead of gl/GL.h
From what hanslovsky said:
I have mesa installed on my system and made a small sample
CMakeLists.txt: FIND_PACKAGE(OpenGL REQUIRED)
MESSAGE("${OPENGL_INCLUDE_DIR}") The output is: /usr/include --
Configuring done -- Generating done -- Build files have been written
to: /home/phil/local/tmp/opengl So your cmake code appears correct to
me.
What I found out: I need to include GL/gl.h, not gl/GL.h. edit:
Sorry for that formatting, I did not know it does not work in
comments.
This worked. Thanks a tons hanslovsky, it was just a capitalization problem.