MarkusJx / install-boost

Install boost on Github actions
MIT License
62 stars 3 forks source link

Could NOT find Boost (missing: system filesystem thread date_time chrono regex serialization program_options) (found version "1.74.0") #24

Closed mjovanc closed 1 year ago

mjovanc commented 1 year ago

Not sure if I'm doing something wrong here. But Using the code below it simply cannot find Boost:

      - name: Install Dependencies
        if: matrix.config.os == 'windows-2019'
        uses: microsoft/setup-msbuild@v1.1
        with:
          msbuild-architecture: x64

      - name: Install boost
        uses: MarkusJx/install-boost@v2.3.1
        if: matrix.config.os == 'windows-2019'
        id: install-boost
        with:
            boost_version: 1.74.0
            boost_install_dir: C:\boost_1_74_0
            platform_version: 2019

      - name: Build windows Target using Visual C++
        if: matrix.config.os == 'windows-2019'
        run: |
          Get-ChildItem -Path ${{ steps.install-boost.outputs.BOOST_ROOT }}
          cmake . -G "Visual Studio 16 2019" -B build -DCMAKE_BUILD_TYPE=Release -DBoost_LIBRARY_DIRS=${{ steps.install-boost.outputs.BOOST_ROOT }}\lib -DBoost_INCLUDE_DIR=${{ steps.install-boost.outputs.BOOST_ROOT }}\include -DBOOST_ROOT=${{ steps.install-boost.outputs.BOOST_ROOT }}
        env:
          BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}

The error I get is:

-- The C compiler identification is MSVC 19.29.30146.0
-- The CXX compiler identification is MSVC 19.29.30146.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - 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: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE  
CMake Warning (dev) at CMakeLists.txt:43 (set):
  implicitly converting 'TYPE' to 'STRING' type.
This warning is for project developers.  Use -Wno-dev to suppress it.
-- FORCE_USE_HEAP: ENABLED

-- HW AES: ENABLED
-- OPTIMIZED_ARM_MULTIPLICATION: ENABLED
-- Found Git: C:/Program Files/Git/bin/git.exe
CMake Warning (dev) at CMakeLists.txt:261 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Environment variable Boost_ROOT is set to:

    C:\boost_1_74_0\boost\boost

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1825 (file):
  file STRINGS file "C:\boost_1_74_0\boost\boost\include/boost/version.hpp"
  cannot be read.
Call Stack (most recent call first):
  CMakeLists.txt:261 (find_package)

CMake Warning at C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1015 (message):
  Imported targets and dependency information not available for Boost version
  0.0.0 (all versions older than 1.33)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1[50](https://github.com/kryptokrona/kryptokrona/actions/runs/3084897755/jobs/4987575888#step:5:51)7 (_Boost_COMPONENT_DEPENDENCIES)
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:261 (find_package)

CMake Warning at C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1015 (message):
  Imported targets and dependency information not available for Boost version
  0.0.0 (all versions older than 1.33)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:261 (find_package)

CMake Warning at C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1015 (message):
  Imported targets and dependency information not available for Boost version
  0.0.0 (all versions older than 1.33)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:261 (find_package)

CMake Warning at C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1015 (message):
  Imported targets and dependency information not available for Boost version
  0.0.0 (all versions older than 1.33)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:261 (find_package)

CMake Warning at C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1015 (message):
  Imported targets and dependency information not available for Boost version
  0.0.0 (all versions older than 1.33)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:261 (find_package)

CMake Warning at C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1015 (message):
  Imported targets and dependency information not available for Boost version
  0.0.0 (all versions older than 1.33)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:261 (find_package)

CMake Warning at C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1015 (message):
  Imported targets and dependency information not available for Boost version
  0.0.0 (all versions older than 1.33)
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1507 (_Boost_COMPONENT_DEPENDENCIES)
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:2118 (_Boost_MISSING_DEPENDENCIES)
  CMakeLists.txt:261 (find_package)

CMake Error at C:/Program Files/CMake/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
  Could NOT find Boost (missing: filesystem thread date_time chrono regex
-- Configuring incomplete, errors occurred!
See also "D:/a/kryptokrona/kryptokrona/build/CMakeFiles/CMakeOutput.log".
  serialization program_options) (found version "0.0.0")
See also "D:/a/kryptokrona/kryptokrona/build/CMakeFiles/CMakeError.log".
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:[59](https://github.com/kryptokrona/kryptokrona/actions/runs/3084897755/jobs/4987575888#step:5:60)4 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:2376 (find_package_handle_standard_args)
  CMakeLists.txt:2[61](https://github.com/kryptokrona/kryptokrona/actions/runs/3084897755/jobs/4987575888#step:5:62) (find_package)
mjovanc commented 1 year ago

It seems like it cannot be read with forward slash? As below trying to get informaton about the version from version.hpp:

CMake Error at C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:1825 (file):
  file STRINGS file "C:\boost_1_74_0\boost\boost\include/boost/version.hpp"
  cannot be read.
MarkusJx commented 1 year ago

version.hpp seems to be located at C:\boost_1_74_0\boost\boost\include\boost-1_74\boost for some reason, try setting -DBoost_INCLUDE_DIR=${{ steps.install-boost.outputs.BOOST_ROOT }}\include\boost-1_74\

mjovanc commented 1 year ago

I tried setting that and I got the following error:

Run Get-ChildItem -Path C:\boost_1_74_0\boost\boost

    Directory: C:\boost_1_74_0\boost\boost

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
d----           8/29/2021 10:30 AM                .circleci
d----           8/29/2021 10:45 AM                boost
d----           8/29/2021 10:30 AM                doc
d----           8/29/2021 10:43 AM                include
d----           8/29/2021 10:59 AM                lib
d----           8/29/2021 10:30 AM                libs
d----           8/29/2021 10:34 AM                more
d----           8/29/2021 10:45 AM                stage
d----           8/29/2021 10:30 AM                status
d----           8/29/2021 10:30 AM                tools
-a---           8/29/2021 10:30 AM           4013 .gitattributes
-a---           8/29/2021 10:30 AM            173 .gitignore
-a---           8/29/2021 10:30 AM          18430 .gitmodules
-a---           8/29/2021 10:30 AM           2665 .travis.yml
-a---           8/29/2021 10:30 AM           [12](https://github.com/kryptokrona/kryptokrona/actions/runs/3085119960/jobs/4988045761#step:5:13)53 appveyor.yml
-a---           8/29/2021 10:35 AM         493568 b2.exe
-a---           8/29/2021 10:30 AM           1054 boost.css
-a---           8/29/2021 10:30 AM           6308 boost.png
-a---           8/29/2021 10:30 AM            867 boost-build.jam
-a---           8/29/2021 10:30 AM          19909 boostcpp.jam
-a---           8/29/2021 10:30 AM           2547 bootstrap.bat
-a---           8/29/2021 10:35 AM           2029 bootstrap.log
-a---           8/29/2021 10:30 AM          10629 bootstrap.sh
-a---           8/29/2021 10:30 AM            484 CMakeLists.txt
-a---           8/29/2021 10:30 AM            794 index.htm
-a---           8/29/2021 10:30 AM           6172 index.html
-a---           8/29/2021 10:30 AM            298 INSTALL
-a---           8/29/2021 10:30 AM          12263 Jamroot
-a---           8/29/2021 10:30 AM           [13](https://github.com/kryptokrona/kryptokrona/actions/runs/3085119960/jobs/4988045761#step:5:14)61 LICENSE_1_0.txt
-a---           8/29/2021 10:35 AM            154 project-config.jam
-a---           8/29/2021 10:30 AM            552 README.md
-a---           8/29/2021 10:30 AM           2757 rst.css
-- The C compiler identification is MSVC 19.29.30[14](https://github.com/kryptokrona/kryptokrona/actions/runs/3085119960/jobs/4988045761#step:5:15)6.0
-- The CXX compiler identification is MSVC [19](https://github.com/kryptokrona/kryptokrona/actions/runs/3085119960/jobs/4988045761#step:5:20).29.30146.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/[20](https://github.com/kryptokrona/kryptokrona/actions/runs/3085119960/jobs/4988045761#step:5:21)19/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - 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: C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - not found
-- Found Threads: TRUE  
CMake Warning (dev) at CMakeLists.txt:43 (set):
  implicitly converting 'TYPE' to 'STRING' type.
This warning is for project developers.  Use -Wno-dev to suppress it.
-- FORCE_USE_HEAP: ENABLED

-- HW AES: ENABLED
-- OPTIMIZED_ARM_MULTIPLICATION: ENABLED
-- Found Git: C:/Program Files/Git/bin/git.exe
CMake Warning (dev) at CMakeLists.txt:261 (find_package):
  Policy CMP0074 is not set: find_package uses <PackageName>_ROOT variables.
  Run "cmake --help-policy CMP0074" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  Environment variable Boost_ROOT is set to:

    C:\boost_1_74_0\boost\boost

  For compatibility, CMake is ignoring the variable.
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Error at C:/Program Files/CMake/share/cmake-3.24/Modules/FindPackageHandleStandardArgs.cmake:[23](https://github.com/kryptokrona/kryptokrona/actions/runs/3085119960/jobs/4988045761#step:5:24)0 (message):
  Could NOT find Boost (missing: system filesystem thread date_time chrono
  regex serialization program_options) (found version "1.74.0")
-- Configuring incomplete, errors occurred!
See also "D:/a/kryptokrona/kryptokrona/build/CMakeFiles/CMakeOutput.log".
Call Stack (most recent call first):
See also "D:/a/kryptokrona/kryptokrona/build/CMakeFiles/CMakeError.log".
  C:/Program Files/CMake/share/cmake-3.[24](https://github.com/kryptokrona/kryptokrona/actions/runs/3085119960/jobs/4988045761#step:5:25)/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
  C:/Program Files/CMake/share/cmake-3.24/Modules/FindBoost.cmake:2376 (find_package_handle_standard_args)
  CMakeLists.txt:[26](https://github.com/kryptokrona/kryptokrona/actions/runs/3085119960/jobs/4988045761#step:5:27)1 (find_package)
MarkusJx commented 1 year ago

I've taken the liberty of testing your project setup locally and when setting the flag Boost_USE_STATIC_RUNTIME to OFF, boost is found successfully.

I'm not quite sure what this flag does but it seems like I'd have to provide additional binaries to make this work. Or would it be possible for you to not use this flag, maybe even just for ci runs?

mjovanc commented 1 year ago

Cool! Thanks for taking a look at the project. Were they found with the flags I provided before? Or should I just use this below along with that flag you tested:

env:
          BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}

One interesting thing is that it works fine to find Boost libraries with the settings I had on macOS and Ubuntu.

mjovanc commented 1 year ago

I'm not 100 percent sure what the effect would be, but in our CMakeLists.txt we set:

set(Boost_NO_BOOST_CMAKE ON)
set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_STATIC_RUNTIME ON)
mjovanc commented 1 year ago

I don't know if I did something wrong here or forgot something but it does not seem to work for me here: https://github.com/kryptokrona/kryptokrona/actions/runs/3090946887/jobs/5000403358

MarkusJx commented 1 year ago

At this point I'm pretty sure you need to change the parameter in your CMakeLists.txt

set(Boost_USE_STATIC_LIBS OFF)

But if you only want to change this for your ci pipeline and windows, you probably could do something like this:

if(DEFINED ENV{CI} AND MSVC)
    set(Boost_USE_STATIC_RUNTIME OFF)
else()
    set(Boost_USE_STATIC_RUNTIME ON)
endif()
mjovanc commented 1 year ago

Ah great, that seemed to be it! now it was able to find Boost! Big thanks for this. I put a star on this repo. It is well deserved!

MarkusJx commented 1 year ago

Awesome! Always happy to help. I'll close this for now but feel free to open another issue if you encounter any more problems 🙂