Search code examples
pythong++condaccconda-forge

Conda-forge package build fails with: CC required but not found even though compiler is added


I want to create a conda-forge package for https://github.com/uber/h3-py and have followed the instructions of https://conda-forge.org/docs/maintainer/adding_pkgs.html#staging-test-locally.

The recipe can be found here: https://github.com/geoHeil/staged-recipes/blob/h3-py/recipes/h3/meta.yaml

When trying to execute a local build using:

/.circleci/run_docker_build.sh

it fails with:

echo 'cc required but not found.'

Where the important part of the meta.yml looks like:

requirements:
  build:
    # If your project compiles code (such as a C extension) then add the required compilers as separate entries here.
    # Compilers are named 'c', 'cxx' and 'fortran'.
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - cmake
    - make
  host:
    - python
    - pip
  run:
    - python

How can I get it to work to submit it to conda-forge?

cc is a general reference to a compiler, how can I add such a reference/symlink to the conda provided c, c++ compilers (presumably cxx/gcc) without forking the source repository /and their installation script?

Shouldn't

- {{ compiler('c') }}
- {{ compiler('cxx') }}

add this?

The error is caused from https://github.com/uber/h3-py/blob/master/.install.sh#L25

command -v cc >/dev/null 2>&1 || { echo "cc required but not found."; exit 1; }

Solution

  • I had to create a custom build.sh file:

    where instead of relying on some $CC, cmake automatically uses the right environment. https://github.com/conda-forge/staged-recipes/pull/8467/files