Search code examples
linuxcmakebuildroot

Buildroot: `CMake Error at FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Boost (missing: thread) (found version "1.80.0")`


Buildroot: CMake Error at /home/gabriel/repos/my_repo/output/board/host/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message): Could NOT find Boost (missing: thread) (found version "1.80.0")

I'm trying to build a host-ros-cpp-common package in Buildroot for an embedded Linux board, containing the contents of this folder here: https://github.com/ros/roscpp_core/tree/noetic-devel/cpp_common

I'm building that folder above at version tag 0.5.8, actually: https://github.com/ros/roscpp_core/tree/0.5.8/cpp_common

I'm building on Ubuntu 22.04 with gcc-11, migrating from Ubuntu 18.04 with gcc-8. Any idea how to solve this error? Also, what does (missing: thread) mean?:

CMake Error at /home/gabriel/repos/my_repo/output/board/host/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: thread) (found version "1.80.0")

Here is the larger context:

$ make
...[stuff removed]...
>>> host-ros-cpp-common 0.5.8 Configuring
(mkdir -p /home/gabriel/repos/my_repo/output/board/build/host-ros-cpp-common-0.5.8/cpp_common && cd /home/gabriel/repos/my_repo/output/board/build/host-ros-cpp-common-0.5.8/cpp_common && rm -f CMakeCache.txt && PATH="/home/gabriel/repos/my_repo/output/board/host/bin:/home/gabriel/repos/my_repo/output/board/host/sbin:/home/gabriel/Downloads/Install_Files/gcloud/google-cloud-sdk/bin:/home/gabriel/.local/bin:/home/gabriel/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin:/usr/local/go/bin" PKG_CONFIG="/home/gabriel/repos/my_repo/output/board/host/bin/pkg-config" PKG_CONFIG_SYSROOT_DIR="/" PKG_CONFIG_LIBDIR="/home/gabriel/repos/my_repo/output/board/host/lib/pkgconfig:/home/gabriel/repos/my_repo/output/board/host/share/pkgconfig" PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1 PKG_CONFIG_ALLOW_SYSTEM_LIBS=1  /home/gabriel/repos/my_repo/output/board/host/bin/cmake /home/gabriel/repos/my_repo/output/board/build/host-ros-cpp-common-0.5.8/cpp_common -DCMAKE_INSTALL_SO_NO_EXE=0 -DCMAKE_FIND_ROOT_PATH="/home/gabriel/repos/my_repo/output/board/host" -DCMAKE_FIND_ROOT_PATH_MODE_PROGRAM="BOTH" -DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY="BOTH" -DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE="BOTH" -DCMAKE_INSTALL_PREFIX="/home/gabriel/repos/my_repo/output/board/host" -DCMAKE_C_FLAGS="-O2 -I/home/gabriel/repos/my_repo/output/board/host/include" -DCMAKE_CXX_FLAGS="-O2 -I/home/gabriel/repos/my_repo/output/board/host/include" -DCMAKE_EXE_LINKER_FLAGS="-L/home/gabriel/repos/my_repo/output/board/host/lib -Wl,-rpath,/home/gabriel/repos/my_repo/output/board/host/lib" -DCMAKE_SHARED_LINKER_FLAGS="-L/home/gabriel/repos/my_repo/output/board/host/lib -Wl,-rpath,/home/gabriel/repos/my_repo/output/board/host/lib" -DCMAKE_ASM_COMPILER="/usr/bin/as" -DCMAKE_C_COMPILER="/home/gabriel/repos/my_repo/output/board/host/bin/ccache" -DCMAKE_CXX_COMPILER="/home/gabriel/repos/my_repo/output/board/host/bin/ccache"  -DCMAKE_C_COMPILER_ARG1="/usr/bin/gcc" -DCMAKE_CXX_COMPILER_ARG1="/usr/bin/g++"  -DCMAKE_COLOR_MAKEFILE=OFF -DBUILD_DOC=OFF -DBUILD_DOCS=OFF -DBUILD_EXAMPLE=OFF -DBUILD_EXAMPLES=OFF -DBUILD_TEST=OFF -DBUILD_TESTS=OFF -DBUILD_TESTING=OFF  -DCMAKE_PREFIX_PATH="/home/gabriel/repos/my_repo/output/board/host//opt/ros/indigo/;/home/gabriel/repos/my_repo/output/board/host/usr" -DCMAKE_INSTALL_PREFIX="/home/gabriel/repos/my_repo/output/board/host//opt/ros/indigo/" )
CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.


-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/gabriel/repos/my_repo/output/board/host/bin/ccache - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/gabriel/repos/my_repo/output/board/host/bin/ccache - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
CMake Error at /home/gabriel/repos/my_repo/output/board/host/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: thread) (found version "1.80.0")
Call Stack (most recent call first):
  /home/gabriel/repos/my_repo/output/board/host/share/cmake-3.25/Modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
  /home/gabriel/repos/my_repo/output/board/host/share/cmake-3.25/Modules/FindBoost.cmake:2376 (find_package_handle_standard_args)
  CMakeLists.txt:4 (find_package)


-- Configuring incomplete, errors occurred!
See also "/home/gabriel/repos/my_repo/output/board/build/host-ros-cpp-common-0.5.8/cpp_common/CMakeFiles/CMakeOutput.log".
make[2]: *** [package/pkg-generic.mk:259: /home/gabriel/repos/my_repo/output/board/build/host-ros-cpp-common-0.5.8/.stamp_configured] Error 1
make[1]: *** [Makefile:84: _all] Error 2
make[1]: Leaving directory '/home/gabriel/repos/my_repo/buildroot'
make: *** [Makefile:209: /home/gabriel/repos/my_repo/output/board/images/image.swu] Error 2

I recently upgraded the Boost package to the latest from Buildroot, here: https://github.com/buildroot/buildroot/tree/master/package/boost, because boost itself was failing to build on my new build system of gcc-11 and Ubuntu 22.04 prior to doing that.

I also opened an issue about this here: https://github.com/ros/roscpp_core/issues/134

And I left a comment here: https://github.com/ethz-asl/kalibr/issues/566#issuecomment-1376788400

My research attempts:

  1. Google search for Could NOT find Boost (missing: thread) (found version "1.80.0")

Update: I think the problem has something to do with this CMake line, but I don't know CMake: https://github.com/ros/roscpp_core/blob/0.5.8/cpp_common/CMakeLists.txt#L4:

find_package(Boost REQUIRED COMPONENTS system thread)

Solution

  • After 1 hr of research and trial and error...

    My host is the build machine, which is Ubuntu 22.04. It is building stuff for my host (host-ros-cpp-common), and therefore needs the Boost libs for my host. So, the buildroot target (for the embedded Linux ARM-core device) boost package I just upgraded has nothing to do with my host I think! It's for the target. So, the solution appears to be to simply install libboost-thread-dev onto Ubuntu 22.04, which is my host. The package libboost-all-dev, contains libboost-thread-dev plus more, so just install that instead:

    sudo apt update
    sudo apt install libboost-all-dev
    

    Now make gets past that previous error and onto the next one!

    That must be it!

    Credit: I had a conversation with ChatGPT to stumble upon this information. I tested the commands above myself. All words here are my own.