uhd
uhd copied to clipboard
Failed 4.3.0.0 Source Build with Custom Prefix-Installed Boost Due To CMake Issue
Issue Description
The newest 4.3.0.0 release fails to build from source when attempting to process UHDAtomics.cmake.
Setup Details
UHD 4.3.0.0 (Downloaded directly from Releases tar.gz) Xubuntu (Ubuntu 20.04.4 LTS) Boost 1.80.0, compiled from source using ./bootstrap.sh --prefix=/my/custom/path
Expected Behavior
Build should complete.
Actual Behaviour
Build fails here:
Configuring atomics support... Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB Performing Test HAVE_CXX_ATOMICS_WITHOUT_LIB - Success Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB Performing Test HAVE_CXX_ATOMICS64_WITHOUT_LIB - Success BOOST ATOMICS COMPILE INCLUDE: /home/seoxubuntu/boost_1_80_0-install/include CMAKE_REQUIRED_INCLUDES: Performing Test HAVE_CXX_BOOST_ATOMICS_WITHOUT_LIB Performing Test HAVE_CXX_BOOST_ATOMICS_WITHOUT_LIB - Failed Looking for __atomic_fetch_add_4 in atomic Looking for __atomic_fetch_add_4 in atomic - found BOOST ATOMICS COMPILE INCLUDE: /home/seoxubuntu/boost_1_80_0-install/include CMAKE_REQUIRED_INCLUDES: Performing Test HAVE_CXX_BOOST_ATOMICS_WITH_LIB Performing Test HAVE_CXX_BOOST_ATOMICS_WITH_LIB - Failed CMake Error at cmake/Modules/UHDAtomics.cmake:105 (message): Host compiler must support std::atomic! Call Stack (most recent call first): lib/utils/CMakeLists.txt:187 (CHECK_ATOMICS_LIB_REQUIRED) lib/CMakeLists.txt:46 (include) lib/CMakeLists.txt:93 (INCLUDE_SUBDIRECTORY)
Steps to reproduce the problem
Download Boost 1.80.0, run bootstrap.sh with custom prefix. Add prefix to Boost_INCLUDE_DIR during cmake of UHD 4.3.0.0. Observe error.
Additional Information
It appears that according to here the try_compile()
used by CMake does not acquire the included directories. Hence the fix is to simply set the environment variable CMAKE_REQUIRED_INCLUDES
appropriately. I have done this internally, and it appears to fix the problem. Pull request is linked below.