emscripten-forge / recipes

Recipes to build the packages for the emscripten-forge distribution
BSD 3-Clause "New" or "Revised" License
54 stars 43 forks source link

Issue building Packages with `scikit-build` (Platform Version) #1271

Open michaelweinold opened 1 month ago

michaelweinold commented 1 month ago

I would like to add the rapidfuzz package to emscripten-forge.

One of the original build requirements is scikit-build:

requirements:
  build:
    - python                                 # [build_platform != target_platform]
    - cross-python_{{ target_platform }}     # [build_platform != target_platform]
    - {{ compiler('c') }}
    - {{ stdlib("c") }}
    - {{ compiler('cxx') }}
    - cmake
    - make
  host:
    - pip
    - python
    - scikit-build
    - wheel
    - setuptools
  run:
    - python
    - numpy

Using pixi to build the package locally, I get an error because scikit-build tries to infer the platform version - which in my case defaulted to macOS:

File "$BUILD_PREFIX/venv/lib/python3.11/site-packages/skbuild/constants.py", line 90, in _default_skbuild_plat_name
 │ │           major_macos, minor_macos = release.split(".")[:2]
 │ │           ^^^^^^^^^^^^^^^^^^^^^^^^
 │ │       ValueError: not enough values to unpack (expected 2, got 1)

I tried to check if other recipes are already using scikit-build. Indeed, awkward-cpp is using it:

requirements:
  build:
  - cross-python_${{ target_platform }}
  - python
  - pybind11
  - ${{ compiler('cxx') }}
  - cmake >=3.15
  - pip
  - scikit-build-core >=0.1.3

But building it with

pixi run build-emscripten-wasm32-pkg recipes/recipes_emscripten/awkward-cpp

gives me a similar error:

File "$BUILD_PREFIX/venv/lib/python3.11/site-packages/scikit_build_core/builder/macos.py", line 30, in <genexpr>
 │ │       major, minor = (int(d) for d in version.split(".")[:2])
 │ │                       ^^^^^^
 │ │   ValueError: invalid literal for int() with base 10: ''

Is there a way to use scikit-build during the build?

michaelweinold commented 1 month ago

...here is the recipe: