Skip to content

Set Python{,3}_CROSSCOMPILING_EMULATOR in CMAKE_ARGS - #113

Merged
isuruf merged 1 commit into
conda-forge:mainfrom
isuruf:machine
Nov 26, 2026
Merged

isuruf merged 1 commit into
conda-forge:mainfrom
isuruf:machine

Conversation

@isuruf

@isuruf isuruf commented Nov 25, 2026

Copy link
Copy Markdown
Member

With CMake >= 4.1 and policy CMP0190 set to NEW, cross-compiling a project that does

find_package(Python3 REQUIRED COMPONENTS Interpreter Development.Module)

fails with

Python3: When cross-compiling, Interpreter and/or Compiler components
cannot be searched when Python3_CROSSCOMPILING_EMULATOR or
CMAKE_CROSSCOMPILING_EMULATOR variable is not specified (see policy CMP0190).

FindPython only checks if (DEFINED Python3_CROSSCOMPILING_EMULATOR ...), and with cross-python $PREFIX/bin/python is a shim that runs natively, so this defines the emulator as empty for both the Python and Python3 prefixes. CMake then runs the interpreter directly.

  • The activation script appends -DPython_CROSSCOMPILING_EMULATOR= -DPython3_CROSSCOMPILING_EMULATOR= to CMAKE_ARGS, unless the recipe already set it. Our script (activate_z-*) runs after the compiler activation scripts (activate-*), so it appends to their CMAKE_ARGS.
  • The deactivation script restores the previous CMAKE_ARGS.
  • Build number bumped to 57.

I reproduced the error with a minimal CMake project and CMake 4.5.1. Passing -DPython3_CROSSCOMPILING_EMULATOR= fixes it.

🤖 Generated with Claude Code

CMake >= 4.1 with policy CMP0190 errors out when cross-compiling and
FindPython is asked for Interpreter together with Development components
unless an emulator is defined. The python in $PREFIX is a shim that runs
natively, so define the emulator as empty.
@isuruf
isuruf requested a review from chrisburr as a code owner November 25, 2026 18:48
@conda-forge-admin

Copy link
Copy Markdown
Contributor

Hi! This is the friendly automated conda-forge-linting service.

I just wanted to let you know that I linted all conda-recipes in your PR (recipe/recipe.yaml) and found it was in an excellent condition.

@isuruf
isuruf merged commit 67c6915 into conda-forge:main Nov 26, 2026
140 of 141 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants