conda-forge.github.io icon indicating copy to clipboard operation
conda-forge.github.io copied to clipboard

Usage of `host_platform` in compiler activation scripts

Open claudiushaag opened this issue 11 months ago • 1 comments

Your question:

This issue stems from a discussion had during the v1-migration of tzdata: https://github.com/conda-forge/tzdata-feedstock/pull/34

Rattler-build sets the target_platform to noarch for a noarch: generic recipe. conda-build does not do that. This leads to the compiler-activation script

if [ "${CONDA_BUILD_STATE:-0}" = "BUILD" ] && [ "${target_platform:-@TARGET_PLATFORM@}" != "@TARGET_PLATFORM@" ]; then
  echo "Not activating environment because this compiler is not expected."
else
  activate_clang
fi

not being run, and therefore the wrong compilers being used.

For tzdata we ended up using the workaround of defining

build:
  noarch: generic
  script:
      file: build.sh
      env: { target_platform: "${{ host_platform }}" }

From the discussion the question

what should be the value of $target_platform for a noarch recipe be?

arose which is to be picked up in this seperate issue.

claudiushaag avatar Dec 11 '25 10:12 claudiushaag

https://github.com/conda-forge/conda-forge-ci-setup-feedstock/pull/414 improves this situation somewhat, but does not handle the target_platform: noarch that rattler uses.

h-vetinari avatar Jan 02 '26 22:01 h-vetinari