rattler-build icon indicating copy to clipboard operation
rattler-build copied to clipboard

CONDA_BUILD_CROSS_COMPILATION is always defined and set to 1 for noarch: python builds, while it is not defined in conda-build

Open traversaro opened this issue 5 months ago • 3 comments

I am not sure if this is an actually build as I am not sure what is the proper definition of CONDA_BUILD_CROSS_COMPILATION , but while migrating a non-trivial recipe, I noticed that rattler-build always defines the CONDA_BUILD_CROSS_COMPILATION to 1 in noarch: python builds, while conda-build does not define it.

Reproducer available at https://gist.github.com/traversaro/7bc2f2cc45c6dd48ba953cf2669bfc4b (courtesy of Claude 4):

git clone https://gist.github.com/traversaro/7bc2f2cc45c6dd48ba953cf2669bfc4b repr1784
cd repr1784
# Success (CONDA_BUILD_CROSS_COMPILATION  is not defined)
pixi run reproduce-conda-build
# Failure (CONDA_BUILD_CROSS_COMPILATION is defined to 1)
pixi run reproduce-rattler-build

traversaro avatar Jul 18 '25 12:07 traversaro

As a possibibly related (but perhaps different issues) the target_platform env variable on conda-build is linux-64, osx-64 etc etc, while on rattler-build is noarch, so any check if [[ "${target_platform}" == osx-* ]]; then will not behave in the same way in conda-build and in rattler-build.

traversaro avatar Jul 18 '25 13:07 traversaro

As a possibibly related (but perhaps different issues) the target_platform env variable on conda-build is linux-64, osx-64 etc etc, while on rattler-build is noarch, so any check if [[ "${target_platform}" == osx-* ]]; then will not behave in the same way in conda-build and in rattler-build.

This change in turns prevent to properly have compiler defined in noarch: python builds on macos, due to https://github.com/conda-forge/clang-compiler-activation-feedstock/blob/d38f407ad59486b674e7789ef9f408b7425cdbcc/recipe/activate-clang%2B%2B.sh#L125 .

traversaro avatar Jul 18 '25 14:07 traversaro

As a possibibly related (but perhaps different issues) the target_platform env variable on conda-build is linux-64, osx-64 etc etc, while on rattler-build is noarch, so any check if [[ "${target_platform}" == osx-* ]]; then will not behave in the same way in conda-build and in rattler-build.

This change in turns prevent to properly have compiler defined in noarch: python builds on macos, due to conda-forge/clang-compiler-activation-feedstock@d38f407/recipe/activate-clang%2B%2B.sh#L125 .

ah yes, that makes sense of what I have been seeing too

lucascolley avatar Jul 18 '25 14:07 lucascolley