conda-forge / conda-forge/conda-forge.github.io

Usage of `host_platform` in compiler activation scripts

Open
#2,691 1 comment 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
170
Forks
320
Avg merge
2d 10h
Merged PRs (30d)
5

Description

### 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](https://github.com/conda-forge/clang-compiler-activation-feedstock/blob/main/recipe/activate-clang.sh)
```bash
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
```yaml
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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.