MarkusJx / install-boost

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

Use boost::filesystem on windows failed #15

Closed MGuillaumeF closed 2 years ago

MGuillaumeF commented 2 years ago

Hello,

when add find_package (Boost COMPONENTS system filesystem REQUIRED) in my CMakeFile.txt, it's works well on MacOSX and Ubuntu in Job but failed with on Windows

(on local it works with the same CMakeList.txt windows)

The code in job :

 job-name:
    runs-on: windows-latest
    steps:
    - uses: actions/checkout@v2
    - name: Install boost
      uses: MarkusJx/install-boost@v2.3.0
      id: install-boost
      with:
        boost_version: ${{env.BOOST_VERSION}}
        platform_version: 2019
        boost_install_dir: 'D:/'

The error :

CMake Error at D:/boost/boost/lib/cmake/Boost-1.79.0/BoostConfig.cmake:141 (find_package):
  Found package configuration file:

    D:/boost/boost/lib/cmake/boost_system-1.79.0/boost_system-config.cmake

  but it set boost_system_FOUND to FALSE so package "boost_system" is
  considered to be NOT FOUND.  Reason given by package:

  No suitable build variant has been found.

  The following variants have been tried and rejected:

  * libboost_system-mgw8-mt-d-x32-1_79.a (32 bit, need 64)

  * libboost_system-mgw8-mt-d-x64-1_79.a (mgw8, detected vc143, set
  Boost_COMPILER to override)
-- Configuring incomplete, errors occurred!

See also "D:/a/cpp-coso/cpp-coso/bin/CMakeFiles/CMakeOutput.log".
  * libboost_system-mgw8-mt-s-x32-1_79.a (32 bit, need 64)
See also "D:/a/cpp-coso/cpp-coso/bin/CMakeFiles/CMakeError.log".

  * libboost_system-mgw8-mt-s-x64-1_79.a (mgw8, detected vc143, set
  Boost_COMPILER to override)

  * libboost_system-mgw8-mt-sd-x32-1_79.a (32 bit, need 64)

  * libboost_system-mgw8-mt-sd-x64-1_79.a (mgw8, detected vc143, set
  Boost_COMPILER to override)

  * libboost_system-mgw8-mt-x32-1_79.a (32 bit, need 64)

  * libboost_system-mgw8-mt-x64-1_79.a (mgw8, detected vc143, set
  Boost_COMPILER to override)

I don't know if Windows need extra parameters to works with boost::filesystem usage, have you ever encountered this problem ?

MarkusJx commented 2 years ago

You've installed boost for mingw but you are trying to compile using msvc. You should set the toolset parameter to msvc to install the proper binaries. There should also be a warning issued about the toolset parameter being unset.

Let me know if that fixed your problem or if you need further instructions :)

MGuillaumeF commented 2 years ago

Thank you it works 😊

MarkusJx commented 2 years ago

Great!

cyberium commented 2 years ago

It doesn't fix mine, i still have the issue. 1.78.0 work but not 1.79.0 workflow https://github.com/cyberium/mangos-wotlk/blob/master/.github/workflows/windows-release.yml#L71

msvc is set https://github.com/cyberium/mangos-wotlk/runs/6422426953?check_suite_focus=true#step:6:4

fail https://github.com/cyberium/mangos-wotlk/runs/6422426953?check_suite_focus=true#step:8:116

i checked if something changed in boost api and i dont see anything in changelog related to this.

It work with my local version of boost and i have that file localy. So iam wondering if the filesystem support is correctly set on your images.

MarkusJx commented 2 years ago

You might be able to fix this issue by adding

include_directories(${Boost_INCLUDE_DIRS})

to your CMakeLists.txt after FindBoost is invoked.

But clearly, the project you are trying to build is not meant to be built with boost 1.79:

CMake Warning at C:/Program Files/CMake/share/cmake-3.22/Modules/FindBoost.cmake:1369 (message): New Boost version may have incorrect or missing dependencies and imported targets

cyberium commented 2 years ago

Thank for your suggestion The include should be correctly done here

The build work on my local as i said, the only difference is the boost binaries and cmake version. I use latest one.

So i just went further and here is the content of your boost folder image

Here is what i get on my local install image

So issue is clearly in your image.

MGuillaumeF commented 2 years ago

My test was with the version 1.78.0, i confirm with 1.79.0 the error is present,

See also "D:/a/cpp-coso/cpp-coso/bin/CMakeFiles/CMakeError.log".

  * libboost_system-vc142-mt-gd-x32-1_79.lib (32 bit, need 64)

  * libboost_system-vc142-mt-gd-x64-1_79.lib (vc142, detected vc143, set

  Boost_COMPILER to override)

  * libboost_system-vc142-mt-x32-1_79.lib (32 bit, need 64)

  * libboost_system-vc142-mt-x64-1_79.lib (vc142, detected vc143,
  * 

it could be the arch of x64 / x86

like toolset it’s required to set value of arch on install step ?

MarkusJx commented 2 years ago

Oh, you just tried to install binaries compiled for windows 2019 on a windows 2022 machine, this is unrelated

MarkusJx commented 2 years ago

But 1.79.0 seems to cause issues, so I'll keep this open until I can find a fix

MarkusJx commented 2 years ago

@cyberium You may want to try boost version 1.79.0.beta1, this version should fix your Problem. The issue seems to be the folder structure of the include directory (windows requires another build layout, of course it does), which doesn't work with boost 1.79.0 and CMake, for some reason. The structure is exactly the same as with previous versions, but this one just doesn't work that way. That's probably why CMake emits the warning about newer boost versions...whatever.

When moving the include directory, this seems to work fine, so let me know if that fix works for you (seems to work fine with your repository on my local machine) and I'll re-compile the binaries for version 1.79.0 🙂

cyberium commented 2 years ago

I can confirm that 1.79.0.beta1 is working. Thank you very much.

MarkusJx commented 2 years ago

Boost version 1.79.0 is now rebuilt. I'll close this issue, reopen if the issue still persists