Generating the wheels for a package that needs Boost #989
-
| Hello, I am currently trying to generate the wheels for a library that requires  To provide more details, in the current CI, I use the github action install-boost to install boost dependency on each runner. I am then able to build and test the packages without any issues. A different workflow then takes care of generating the wheels, the wheels are generated using [       - name: Install boost
        uses: MarkusJx/install-boost@v2.1.0
        id: install-boost
        with:
          boost_version: 1.76.0
          boost_install_dir: ${{ matrix.boost_install_dir }}
      - name: Build wheels
        uses: pypa/cibuildwheel@v2.3.1
        env:
          CIBW_BUILD: "cp36-* cp37-* cp38-* cp39-*"
          # Skip 32 bit architectures, musllinux, and i686
          CIBW_SKIP: "*-win32 *-musllinux_x86_64 *_i686"
          CIBW_BEFORE_BUILD: python -m pip install cmake
          CIBW_TEST_COMMAND: python -m pytest --rootdir={package} {package}
          CIBW_TEST_REQUIRES: pytest
          CIBW_ENVIRONMENT: BOOST_ROOT=${{ steps.install-boost.outputs.BOOST_ROOT }}
          CIBW_ENVIRONMENT_WINDOWS: BOOST_ROOT_PIPELINE=${{ steps.install-boost.outputs.BOOST_ROOT }}
          CIBW_ENVIRONMENT_PASS_LINUX: BOOST_ROOTThe current behavior I am observing is as follow: 
 Questions: 
 As additional information, I paste here the printed information in github action when loading cibuildwheels: For mac: For linux: For windows: Thank you for any help you can provide me with. Best, | 
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
| On macOS, you are using the system libraries, so this works. Windows should be too, so this might possibly be a bug with  On linux, you are inside a docker container (manylinux, specifically), so you need to set it up there (in CIBW_BEFORE_ALL). You will need to use the system library one (very old), or build it yourself, or possibly use a separate build for it somewhere (someone else might know if there is one). Just to verify, are you sure you need a built boost? A lot of boost is header only, and can easily be used without building anything at all - see boost-histogram, for example, which wraps a header only boost library with 6 dependent boost libraries and pybind11; no binaries required, and everything is even packed into the SDist. | 
Beta Was this translation helpful? Give feedback.
-
| I am having the same problem as described above, but in my case I do need to install the Boost library. Is there a solution to use Boost with cibuildwheel? Is there a repo example where this is done? | 
Beta Was this translation helpful? Give feedback.
-
| So I had some success with this setup here: https://github.com/AlmondBread/gestalt-motion-planner-test/blob/main/.github/workflows/build.yml It builds for linux-intel and mac-intel (14+). I also got Windows to start compiling cpp files (so cmake found boost) but there were so many errors (since the code was only developed on G++ before) that I gave up. It might work if the code is CL-compatible. The semi success with Windows is here: Note that I needed to set cmake's CMP0167 policy to OLD. | 
Beta Was this translation helpful? Give feedback.
On macOS, you are using the system libraries, so this works. Windows should be too, so this might possibly be a bug with
\being treated as a escape (not sure if it's on our side, or YAML). You might be better off with CIBW_ENVIRONMENT_PASS (and/or using static TOML configuration instead).On linux, you are inside a docker container (manylinux, specifically), so you need to set it up there (in CIBW_BEFORE_ALL). You will need to use the system library one (very old), or build it yourself, or possibly use a separate build for it somewhere (someone else might know if there is one).
Just to verify, are you sure you need a built boost? A lot of boost is header only, and can easily be used with…