MarkusJx / install-boost

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

Provide boost binaries for MinGW #8

Closed ReenigneArcher closed 2 years ago

ReenigneArcher commented 2 years ago

Hello, I am attempting to build an app using github runners. I am using Windows Server 2019. I have tried various versions of boost (1.72.0, 1.73.0, 1.77.0) and back to the oldest one in the legacy option.

My yaml syntax:

  build_win:
    name: Windows
    runs-on: windows-2019

    steps:
      - name: Checkout
        uses: actions/checkout@v2
        with:
          submodules: recursive

      - name: Install boost
        uses: MarkusJx/install-boost@v2.0.0
        id: install-boost
        with:
          # REQUIRED: Specify the required boost version
          # A list of supported versions can be found here:
          # https://github.com/actions/boost-versions/blob/main/versions-manifest.json
          boost_version: 1.73.0
          # OPTIONAL: Specify a custon install location
          #boost_install_dir: 'C:'
          # OPTIONAL: Specify a platform version
          platform_version: 2019

          # NOTE: If a boost version matching all requirements cannot be found,
          # this build step will fail
      - name: Setup Windows
        run: |
          C:\msys64\usr\bin\bash -lc "pacman --needed --noconfirm -S mingw-w64-x86_64-binutils mingw-w64-x86_64-openssl mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-opus mingw-w64-x86_64-x265 mingw-w64-x86_64-boost git yasm nasm diffutils make"
      - name: Build Windows
        env:
          BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
        run: |
          mkdir sunshine-windows-build && cd sunshine-windows-build
          set PATH=C:\msys64\mingw64\bin
          cmake -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=assets -G "MinGW Makefiles" ..
          #cmake -DBOOST_ROOT=${{ steps.install-boost.outputs.BOOST_ROOT }} -DBOOST_INCLUDEDIR=${{ steps.install-boost.outputs.BOOST_ROOT }}/include -DBOOST_LIBRARYDIR=${{ steps.install-boost.outputs.BOOST_ROOT }}/lib -DCMAKE_BUILD_TYPE=Release -DSUNSHINE_ASSETS_DIR=assets -G "MinGW Makefiles" ..
          mingw32-make -j2

I also tried with the commented out cmake command instead. Below is the output.

CMake Warning (dev) at third-party/Simple-Web-Server/CMakeLists.txt:31 (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:

    D:\a\Sunshine\Sunshine\boost\boost

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

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

    D:/a/Sunshine/Sunshine/boost/boost/lib/cmake/boost_system-1.73.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-vc142-mt-gd-x32-1_73.lib (32 bit, need 64)

  * libboost_system-vc142-mt-gd-x64-1_73.lib (vc142, detected mgw8, set
  Boost_COMPILER to override)

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

  * libboost_system-vc142-mt-x64-1_73.lib (vc142, detected mgw8, set
  Boost_COMPILER to override)

Call Stack (most recent call first):
  boost/boost/lib/cmake/Boost-1.73.0/BoostConfig.cmake:258 (boost_find_component)
  C:/Program Files/CMake/share/cmake-3.22/Modules/FindBoost.cmake:594 (find_package)
  third-party/Simple-Web-Server/CMakeLists.txt:31 (find_package)

-- Configuring incomplete, errors occurred!
See also "D:/a/Sunshine/Sunshine/sunshine-windows-build/CMakeFiles/CMakeOutput.log".
See also "D:/a/Sunshine/Sunshine/sunshine-windows-build/CMakeFiles/CMakeError.log".
mingw32-make: *** No targets specified and no makefile found.  Stop.

I did see this issue, which seems to be just about identical (I think besides vc142 versus vc141); however I already have the platform_version set to 2019 (same as my job is running on). https://github.com/MarkusJx/install-boost/issues/7

I am fairly new to building anything on windows. Any idea how to solve this?

MarkusJx commented 2 years ago

Hi!

You actually did everything right regarding the platform version, so this would actually work if you wouldn't be using mingw as your compiler. This action currently only supports compiling using msvc as the prebuilt boost versions are compiled using that compiler (see vc142, detected mgw8). Is there any specific reason for using mingw?

Please let me know if you'll need boost compiled using mingw, I could look into that.

ReenigneArcher commented 2 years ago

To be honest, I am not sure if it's required or not. I am attempting to create PR checks for a project to help make maintenance easier. The original developer hasn't been heard from in months, but the community is wanting to revive it.

So the reason I used mingw above is because that is what the original project used in their appveyor config. They used appveyor for building, but I would like to do everything in github workflows if possible. Mingw is listed in a couple of my commands above (pacman, cmake, and the final make command). Would all of these need to be changed in order to use msvc? (Probably a dumb question, I assume they'll all need to be changed.)

The original readme actually has a slightly different cmake command, this seems like a typo to me but I haven't verified yet.

### Requirements:

First you need to install [MSYS2](https://www.msys2.org), then startup "MSYS2 MinGW 64-bit" and install the following packages using `pacman -S`:

    mingw-w64-x86_64-binutils mingw-w64-x86_64-openssl mingw-w64-x86_64-cmake mingw-w64-x86_64-toolchain mingw-w64-x86_64-opus mingw-w64-x86_64-x265 mingw-w64-x86_64-boost git mingw-w64-x86_64-make cmake make gcc

### Compilation:
- `git clone https://github.com/loki-47-6F-64/sunshine.git --recursive`
- `cd sunshine && mkdir build && cd build`
- `cmake -G"Unix Makefiles" ..`
- `mingw32-make`
MarkusJx commented 2 years ago

Ah, I see.

So they were probably using mingw to build the app as it probably doesn't natively support compiling on windows, so this may be a dead end.

And the build command in the readme may actually work as mingw should support compiling using Unix Makefiles. Anyways, I'll look into providing prebuilt boost binaries for mingw.

ReenigneArcher commented 2 years ago

Anyways, I'll look into providing prebuilt boost binaries for mingw.

That would be great if you could!

Otherwise I'm going to look into trying automate this (https://gist.github.com/zrsmithson/0b72e0cb58d0cb946fc48b5c88511da8#install-boost) in a step of the workflow; however that would require it to build boost each time, so probably would need to look into an alternative on that as well.

MarkusJx commented 2 years ago

I've added the required code to make this work with mingw and also compiled boost 1.78.0 with that toolset. This issue will be closed once that all is merged. Do you need a(nother) specific version of boost or would 1.78.0 do the job?

ReenigneArcher commented 2 years ago

I've added the required code to make this work with mingw and also compiled boost 1.78.0 with that toolset. This issue will be closed once that all is merged. Do you need a(nother) specific version of boost or would 1.78.0 do the job?

That is awesome, thank you! I have just built the exe using the branch and mingw. I didn't get a successful build but, at this point, I don't believe the errors are related to the version of boost. Thanks again!