MarkusJx / install-boost

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

Ask possibility to expose option to select cross-compilation toolchain #13

Closed MGuillaumeF closed 2 years ago

MGuillaumeF commented 2 years ago

an interesting option would be to be able to cross-compile boost for an arm target

https://www.boost.org/build/doc/html/bbv2/tasks/crosscompile.html

to permit continus delivery from GitHub action to raspberry pi 😊

MarkusJx commented 2 years ago

I'll see what I can do :)

MarkusJx commented 2 years ago

I'll try building for arm64, is that ok?

MGuillaumeF commented 2 years ago

Yes with newest raspberry ip (3 or 4) it will be ok, thank you 😊

MarkusJx commented 2 years ago

So, we should be all set. You can try out the new changes with the following code:

- name: Install Boost
  uses: MarkusJx/install-boost@ebe4e0e3c10a85635247dc7f6f89b72a4a162b2d
  id: install-boost
  with:
    boost_version: 1.79.0 # Currently only works with boost v1.79.0
    platform_version: 20.04 # The images are built on ubuntu 20.04, but this option isn't really required
    arch: aarch64 # Note the new 'arch' option

Please let me know if this works for you, since I haven't tested this, but it should work.

MGuillaumeF commented 2 years ago

Currently, the boost version seems to have installed well, however in my generation cmake it is not found, I do not know why, I will continue to test

Install logs :

Run MarkusJx/install-boost@ebe4e0e3c10a85635247dc7f6f89b72a4a162b2d
  with:
    boost_version: 1.79.0
    platform_version: 20.04
    arch: aarch64
Starting install-boost@2.1.0
Downloading versions-manifest.json...
Parsing versions-manifest.json...
Create /home/runner/work/hangman-game/hangman-game/boost
  /home/runner/work/hangman-game/hangman-game/boost does not exist, creating it
  Done.
Download Boost
  Download progress: 0.00%
  Download progress: 22.68%
  Download progress: 45.50%
  Download progress: 63.46%
  Download progress: 72.84%
  Download progress: 82.21%
  Download progress: 89.83%
  Download progress: 97.44%
  Download finished
Extract boost-1.79.0-ubuntu-20.04-gcc-static+shared-aarch64.tar.gz
  /home/runner/work/hangman-game/hangman-game/boost/boost-1.79.0-ubuntu-20.04-gcc-static+shared-aarch64 does not exist, creating it
  Done.
  Tar exited with code 0
Clean up
  Attempting to delete 1 file(s)...
  /home/runner/work/hangman-game/hangman-game/boost/boost-1.79.0-ubuntu-20.04-gcc-static+shared-aarch64.tar.gz exists, deleting it
Set output variables
  Setting BOOST_ROOT to '/home/runner/work/hangman-game/hangman-game/boost/boost'
  Setting BOOST_VER to 'boost-1.79.0-ubuntu-20.04-gcc-static+shared-aarch64'
install-boost@2.1.0 finished successfully

Generate target:

    - name: Generate Target
      run: cmake -S ${{github.workspace}}/server -B ${{github.workspace}}/server/bin -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=${{github.workspace}}/tools/toolchains/Toolchain-RaspberryPi.cmake -D Boost_NO_SYSTEM_PATHS=TRUE
      env:
        BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}

error result :

Could NOT find Boost (missing: Boost_INCLUDE_DIR) 
CMake Error at CMakeLists.txt:114 (message):
  Boost not found
MGuillaumeF commented 2 years ago

If i add explicit path of boost includes it’s compile with success, currently i haven’t deploy compiled file to the raspberry i will try in the week

    - name: Generate Target
      run: cmake -S ${{github.workspace}}/server -B ${{github.workspace}}/server/bin -D CMAKE_BUILD_TYPE=Release -D CMAKE_TOOLCHAIN_FILE=${{github.workspace}}/tools/toolchains/Toolchain-RaspberryPi.cmake -D Boost_NO_SYSTEM_PATHS=TRUE -D Boost_INCLUDE_DIR=${{ steps.install-boost.outputs.BOOST_ROOT }}/include
      env:
        BOOST_ROOT: ${{ steps.install-boost.outputs.BOOST_ROOT }}
MarkusJx commented 2 years ago

Yes, sometimes, for some reason, you'll have to pass the path to the library and include directories to cmake. I'll add this to the docs :)

MGuillaumeF commented 2 years ago

Ok, thank you 😊

MGuillaumeF commented 2 years ago

I just tested the result of the compilation on the raspberry pi, it works perfectly, thank you very much 😊

MarkusJx commented 2 years ago

Ok, great, so I can close this. Thank you for your suggestion!