Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: Incorrect python interpreter found by python.cmake on Nix #66236

Closed
teburd opened this issue Dec 6, 2023 · 11 comments
Closed

build: Incorrect python interpreter found by python.cmake on Nix #66236

teburd opened this issue Dec 6, 2023 · 11 comments
Assignees
Labels
area: Build System bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug

Comments

@teburd
Copy link
Collaborator

teburd commented Dec 6, 2023

Describe the bug

TL;DR: CMake's FindPython module has 3kloc to handle many edge cases, and carefully does things with find_program that we are not doing. I happened to find an edge case seemingly.

I'd expect python.cmake to choose the first python in my path, it instead seems to choose somewhat at random a python interpreter on my path.

find_package(Python COMPONENT INTERPRETER) seems to do this just fine, the current find_program() usage does not.

I've added some message() outputs in python.cmake and west.cmake to try and provide some clues, diff attached

output from this...

(env) tburdick@zefire ~/z/z/doc (main)> make html-fast
make html DT_TURBO_MODE=1
make[1]: Entering directory '/home/tburdick/z/zephyr/doc'
cmake \
	-GNinja \
	-B_build \
	-S. \
	-DDOC_TAG=development \
	-DSPHINXOPTS="-j auto -W --keep-going -T" \
	-DSPHINXOPTS_EXTRA="" \
	-DLATEXMKOPTS="-halt-on-error -no-shell-escape" \
	-DDT_TURBO_MODE=1
Loading Zephyr module(s) (Zephyr base): doc
Python currently , 
python found /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/bin/python
python found /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/bin/python version 3.10
python3 found /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/bin/python
python3 found /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/bin/python version 3.10
Calling find_package Python3, /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/bin/python
-- Found Python3: /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/bin/python (found suitable version "3.10.13", minimum required is "3.8") found components: Interpreter 
Called find_package Python3, /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/bin/python
-- Cache files will be written to: /home/tburdick/.cache/zephyr
-- Zephyr base: /home/tburdick/z/zephyr
-- Found Doxygen: /nix/store/xknvdvpqg40cnd10gbyr3q29imgsra4k-doxygen-1.9.6/bin/doxygen (found version "1.9.6") found components: doxygen dot 
CMake Error at CMakeLists.txt:33 (message):
  The 'sphinx-build' command was not found


-- Configuring incomplete, errors occurred!
See also "/home/tburdick/z/zephyr/doc/_build/CMakeFiles/CMakeOutput.log".
make[1]: *** [Makefile:24: configure] Error 1
make[1]: Leaving directory '/home/tburdick/z/zephyr/doc'
make: *** [Makefile:18: html-fast] Error 2
(env) tburdick@zefire ~/z/z/doc (main) [2]> which python
/home/tburdick/z/env/bin/python
(env) tburdick@zefire ~/z/z/doc (main)> ls -alh /home/tburdick/z/env/bin/python
lrwxrwxrwx 1 tburdick users 74 Dec  1 13:03 /home/tburdick/z/env/bin/python -> /nix/store/c3cjxhn73xa5s8fm79w95d0879bijp04-python3-3.10.13/bin/python3.10
(env) tburdick@zefire ~/z/z/doc (main)> ls -alh /nix/store/c3cjxhn73xa5s8fm79w95d0879bijp04-python3-3.10.13/bin/python3.10
-r-xr-xr-x 1 root root 16K Dec 31  1969 /nix/store/c3cjxhn73xa5s8fm79w95d0879bijp04-python3-3.10.13/bin/python3.10

I'd note that which python points at my virtual environment, which itself holds a static link to a nix install of python with various python packages (nix will generate a virtualenv like wrapper itself), and that links to a real python interpreter. None of those are actually selected though. Instead it appears that, at perhaps random or some undefined ordering, another python in my PATH var is selected. That's seemingly, to me, the wrong behavior and very unexpected.

If I replace all of python.cmake with a simple find_package(Python COMPONENT INTERPRETER) as seen in #65995 the symlinked python in my virtualenv is found correctly.

Some other useful environment variables perhaps give some clues

nix will set PATH, CMAKE_, and other environment variables when being used to enable builds with its unique filesystem layout.

env | grep python3-3.10.13 shows... (sorry for the large text blob here)

XDG_DATA_DIRS=/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/share:/nix/store/n7nrikml13ipr3gishnbf2x0g3zbia16-minicom-2.8/share:/nix/store/04p9vxaplyd4a1m4q8qyh371dfmny3pl-ninja-1.11.1/share:/nix/store/sj207xd8h848inbwqpqz9lq89yii08sj-gperf-3.1/share:/nix/store/h8q4r7f1j906rlffj96dlbbmwc9zbirk-cmake-3.25.3/share:/nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/share:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/share:/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/share:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/share:/nix/store/xbm2s7589mswrgngv8ci1zcqfh1l6v2w-xxd-vim-9.0.1441/share:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/share:/nix/store/gw2ql840xwh37fp7dv430mrxc1bgyxsz-lldb-16.0.6/share:/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/share:/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/share:/nix/store/b8gwvz4hiq9227321s3lqbk3c6pv22kz-llvm-16.0.6/share:/nix/store/k6ssc7alckmv6gbympghw365ribdlj31-rustup-1.26.0/share:/nix/store/gwf21xyl0x0bhgapi66avzf6qmddr44s-patchelf-0.15.0/share:/nix/store/1wbc95psbpyzlc8s20qpmbic1706dfhk-gnome-console-45.0/share:/nix/store/n1qj6nna92xldmqxdqfwj8b4naxiznaj-gsettings-desktop-schemas-45.0/share/gsettings-schemas/gsettings-desktop-schemas-45.0:/nix/store/k11r1l1q236cjim5piz6gp8xs1y7ir2k-gtk4-4.12.3/share/gsettings-schemas/gtk4-4.12.3:/nix/store/1wbc95psbpyzlc8s20qpmbic1706dfhk-gnome-console-45.0/share/gsettings-schemas/gnome-console-45.0:/nix/store/cv38v8k6nf1ng6cr9mjfqq1as3vnb43w-gnome-mimeapps/share:/nix/store/cib1rhpk4653hbf8hqwlw9hanf11yhig-desktops/share:/home/tburdick/.nix-profile/share:/nix/profile/share:/home/tburdick/.local/state/nix/profile/share:/etc/profiles/per-user/tburdick/share:/nix/var/nix/profiles/default/share:/run/current-system/sw/share:/nix/store/ja4xq4ra1w9j4g6cnvkkmmhjyh1qxpbh-gnome-shell-45.1/share/gsettings-schemas/gnome-shell-45.1:/nix/store/78yrfskcsbds6876kgwjdja2ws3d2p1d-gnome-shell-extensions-45.1/share/gsettings-schemas/gnome-shell-extensions-45.1:/nix/store/gl3sw9c9hkhkn5mqi7s2aj1y30fy8h2i-gnome-session-45.0/share:/nix/store/n1qj6nna92xldmqxdqfwj8b4naxiznaj-gsettings-desktop-schemas-45.0/share/gsettings-schemas/gsettings-desktop-schemas-45.0:/nix/store/1jkmjwd4d5c9x520kw2wzpw09bfcldcq-gtk+3-3.24.38/share/gsettings-schemas/gtk+3-3.24.38:/nix/store/bf6d3mj74kmffq97fliq4084fvcr5hq0-gnome-settings-daemon-45.0/share/gsettings-schemas/gnome-settings-daemon-45.0:/nix/store/gl3sw9c9hkhkn5mqi7s2aj1y30fy8h2i-gnome-session-45.0/share/gsettings-schemas/gnome-session-45.0:/nix/store/ja4xq4ra1w9j4g6cnvkkmmhjyh1qxpbh-gnome-shell-45.1/share
NIX_CFLAGS_COMPILE= -frandom-seed=nhccmaiznb -isystem /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include -isystem /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include -isystem /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include -isystem /nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include -isystem /nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include -isystem /nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include -isystem /nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include -isystem /nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include -isystem /nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include -isystem /nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include -isystem /nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include -isystem /nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include -isystem /nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include -isystem /nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include -isystem /nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include -isystem /nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include -isystem /nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include -isystem /nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include -isystem /nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include -isystem /nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include -isystem /nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include -isystem /nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include -isystem /nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include -isystem /nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include -isystem /nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include -isystem /nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include -isystem /nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include -isystem /nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include -isystem /nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include -isystem /nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include -isystem /nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include -isystem /nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include -isystem /nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include -isystem /nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include -isystem /nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include -isystem /nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include -isystem /nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include -isystem /nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include -isystem /nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include -isystem /nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include -isystem /nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include -isystem /nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include -isystem /nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include -isystem /nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include -isystem /nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include -isystem /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include -isystem /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include -isystem /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include -isystem /nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include -isystem /nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include -isystem /nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include -isystem /nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include -isystem /nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include -isystem /nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include -isystem /nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include -isystem /nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include -isystem /nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include -isystem /nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include -isystem /nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include -isystem /nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include -isystem /nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include -isystem /nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include -isystem /nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include -isystem /nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include -isystem /nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include -isystem /nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include -isystem /nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include -isystem /nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include -isystem /nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include -isystem /nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include -isystem /nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include -isystem /nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include -isystem /nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include -isystem /nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include -isystem /nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include -isystem /nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include -isystem /nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include -isystem /nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include -isystem /nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include -isystem /nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include -isystem /nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include -isystem /nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include -isystem /nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include -isystem /nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include -isystem /nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include -isystem /nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include -isystem /nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include -isystem /nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include -isystem /nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include -isystem /nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include
_OLD_VIRTUAL_PATH=/nix/store/y033c1zj8h064wm8kbnpmfcf6w54cn3z-zephyr-sdk/bin:/nix/store/21096vzf5ljl6lhplmfd301kb8zyvj05-rimage/bin:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/bin:/nix/store/n7nrikml13ipr3gishnbf2x0g3zbia16-minicom-2.8/bin:/nix/store/04p9vxaplyd4a1m4q8qyh371dfmny3pl-ninja-1.11.1/bin:/nix/store/sj207xd8h848inbwqpqz9lq89yii08sj-gperf-3.1/bin:/nix/store/dp3ghxdzqfqpzkvmsay2026lhjn19lg7-ccache-4.8/bin:/nix/store/h8q4r7f1j906rlffj96dlbbmwc9zbirk-cmake-3.25.3/bin:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/bin:/nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/bin:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/bin:/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/bin:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/bin:/nix/store/xbm2s7589mswrgngv8ci1zcqfh1l6v2w-xxd-vim-9.0.1441/bin:/nix/store/7rm5784szfma17yklz4dmds20ws8g5v9-nixpkgs-fmt-1.3.0/bin:/nix/store/xnklwbh91g7if2mzy5mh4zcsg818jfls-gcc-wrapper-12.2.0/bin:/nix/store/6504znvqq8hb7qaf5hnfxiccc0g3zmbb-gcc-12.2.0/bin:/nix/store/wskdac6dzswp59qrf8p213ld23l1p0bf-glibc-2.37-45-bin/bin:/nix/store/aifz5nf4xvl2m94ayap13ys48drkhmzk-coreutils-9.1/bin:/nix/store/39x21ag4yfahwjm24a3zrqyhp1rc5mvm-binutils-wrapper-2.40/bin:/nix/store/drdpyvbbp0vylmzmlra408fyj6zv22lq-binutils-2.40/bin:/nix/store/xknvdvpqg40cnd10gbyr3q29imgsra4k-doxygen-1.9.6/bin:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/bin:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/bin:/nix/store/nnjs5w63rc54fg33myzmvx6qknymiksj-clang-tools-14.0.6/bin:/nix/store/gw2ql840xwh37fp7dv430mrxc1bgyxsz-lldb-16.0.6/bin:/nix/store/zfdj9lm7rqizrjj8lk9bkxq4djxkbjh7-clang-wrapper-16.0.6/bin:/nix/store/bmcs67kwf560sv434jaycqdpwg3vivw4-clang-16.0.6/bin:/nix/store/sb5sf8pnbb5dxgr5p8qm344ky8k7f62r-glibc-2.37-45-bin/bin:/nix/store/w8vm09hri2zz7yacryzzzxvsapik4ps4-coreutils-9.1/bin:/nix/store/88bh6zy2sbkj83jcpvmzgqf74213wk2f-binutils-wrapper-2.40/bin:/nix/store/3r87a2wq1w4l66wnsm7rqvy608mx23h6-binutils-2.40/bin:/nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/bin:/nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/bin:/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/bin:/nix/store/b8gwvz4hiq9227321s3lqbk3c6pv22kz-llvm-16.0.6/bin:/nix/store/k6ssc7alckmv6gbympghw365ribdlj31-rustup-1.26.0/bin:/nix/store/gwf21xyl0x0bhgapi66avzf6qmddr44s-patchelf-0.15.0/bin:/nix/store/vaqs26d33rgz2acf81n35v809g8g27vh-clang-wrapper-11.1.0/bin:/nix/store/7wqhmdl4cd8yh7xi32c2ss7l6804i1p7-clang-11.1.0/bin:/nix/store/ximnbjgjqkmyp88hjz9bgsfdfy431ilp-binutils-wrapper-2.40/bin:/nix/store/hf6q72gb3nj3fbfh7j2a14vfjmsgbg25-compiler-rt-libc-16.0.6/bin:/nix/store/82fqlfr6d9s3yvhxp0zv0zswl5w12n19-compiler-rt-libc-11.1.0/bin:/nix/store/w8vm09hri2zz7yacryzzzxvsapik4ps4-coreutils-9.1/bin:/nix/store/4cxs4cigh2zdxvma52ygm3mh2igq70iw-findutils-4.9.0/bin:/nix/store/vikpb6rhmi8zzgsx8syjng9dic8dplm7-diffutils-3.9/bin:/nix/store/4mca20b13q88s6llkr8mc468rh9l9bmr-gnused-4.9/bin:/nix/store/b4in4hmq54h6l34a0v6ha40z97c0lzw2-gnugrep-3.7/bin:/nix/store/p7v8rc82yi4zngjw2z7isgqvfi32l1aj-gawk-5.2.1/bin:/nix/store/2gcfy5f68y7gkryp3wrjmvlci42qb61a-gnutar-1.35/bin:/nix/store/5xzh0z66hpcd3k578my76lx4qgra334q-gzip-1.12/bin:/nix/store/6d9vlwwy7kvxjqmqg4cldgg9mr8nflff-bzip2-1.0.8-bin/bin:/nix/store/qlcm8dzsaa6wyycmx7in8rz6x3pzf6zf-gnumake-4.4.1/bin:/nix/store/0rwyq0j954a7143p0wzd4rhycny8i967-bash-5.2-p15/bin:/nix/store/0g52i0ih3h0d9s40m84gksi2jjm4k3bf-patch-2.7.6/bin:/nix/store/agry2lhy6ilgyacx75w2ycqsdfwr513f-xz-5.4.3-bin/bin:/nix/store/rgg874xkzlfmkzkm7911dwnihswkf54g-file-5.44/bin:/run/wrappers/bin:/home/tburdick/.nix-profile/bin:/nix/profile/bin:/home/tburdick/.local/state/nix/profile/bin:/etc/profiles/per-user/tburdick/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin
CMAKE_INCLUDE_PATH=/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include:/nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include:/nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include:/nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include:/nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include:/nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include:/nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include:/nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include:/nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include:/nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include:/nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include:/nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include:/nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include:/nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include:/nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include:/nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include:/nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include:/nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include:/nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include:/nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include:/nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include:/nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include:/nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include:/nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include:/nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include:/nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include:/nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include:/nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/include:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/include:/nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include:/nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include:/nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/include:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/include:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/include:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/include:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/include:/nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include:/nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include:/nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev/include:/nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include:/nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include:/nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev/include:/nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include:/nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include:/nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/include:/nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include:/nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include:/nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/include:/nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include:/nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include:/nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev/include:/nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include:/nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include:/nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev/include:/nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include:/nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include:/nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev/include:/nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include:/nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include:/nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev/include
NIX_LDFLAGS=-rpath /home/tburdick/z/outputs/out/lib64 -rpath /home/tburdick/z/outputs/out/lib  -L/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib -L/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib -L/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib -L/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib -L/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib -L/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib -L/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib -L/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib -L/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib -L/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib -L/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib -L/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib -L/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib -L/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib -L/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib -L/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib -L/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib -L/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib -L/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib -L/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib -L/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib -L/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib -L/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib -L/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib -L/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib -L/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib -L/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib -L/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib -L/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib -L/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib -L/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib -L/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib -L/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib -L/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib -L/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib -L/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib -L/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib -L/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib -L/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib -L/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib -L/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib -L/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib -L/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib -L/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib -L/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib -L/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib -L/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib -L/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib -L/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib -L/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib -L/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib -L/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib -L/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib -L/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib -L/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib -L/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib -L/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib -L/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib -L/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib -L/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib -L/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib -L/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib -L/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib -L/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib -L/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib -L/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib -L/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib -L/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib -L/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib -L/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib -L/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib -L/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib
PATH=/home/tburdick/z/env/bin:/nix/store/y033c1zj8h064wm8kbnpmfcf6w54cn3z-zephyr-sdk/bin:/nix/store/21096vzf5ljl6lhplmfd301kb8zyvj05-rimage/bin:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/bin:/nix/store/n7nrikml13ipr3gishnbf2x0g3zbia16-minicom-2.8/bin:/nix/store/04p9vxaplyd4a1m4q8qyh371dfmny3pl-ninja-1.11.1/bin:/nix/store/sj207xd8h848inbwqpqz9lq89yii08sj-gperf-3.1/bin:/nix/store/dp3ghxdzqfqpzkvmsay2026lhjn19lg7-ccache-4.8/bin:/nix/store/h8q4r7f1j906rlffj96dlbbmwc9zbirk-cmake-3.25.3/bin:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/bin:/nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1/bin:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/bin:/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/bin:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/bin:/nix/store/xbm2s7589mswrgngv8ci1zcqfh1l6v2w-xxd-vim-9.0.1441/bin:/nix/store/7rm5784szfma17yklz4dmds20ws8g5v9-nixpkgs-fmt-1.3.0/bin:/nix/store/xnklwbh91g7if2mzy5mh4zcsg818jfls-gcc-wrapper-12.2.0/bin:/nix/store/6504znvqq8hb7qaf5hnfxiccc0g3zmbb-gcc-12.2.0/bin:/nix/store/wskdac6dzswp59qrf8p213ld23l1p0bf-glibc-2.37-45-bin/bin:/nix/store/aifz5nf4xvl2m94ayap13ys48drkhmzk-coreutils-9.1/bin:/nix/store/39x21ag4yfahwjm24a3zrqyhp1rc5mvm-binutils-wrapper-2.40/bin:/nix/store/drdpyvbbp0vylmzmlra408fyj6zv22lq-binutils-2.40/bin:/nix/store/xknvdvpqg40cnd10gbyr3q29imgsra4k-doxygen-1.9.6/bin:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/bin:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/bin:/nix/store/nnjs5w63rc54fg33myzmvx6qknymiksj-clang-tools-14.0.6/bin:/nix/store/gw2ql840xwh37fp7dv430mrxc1bgyxsz-lldb-16.0.6/bin:/nix/store/zfdj9lm7rqizrjj8lk9bkxq4djxkbjh7-clang-wrapper-16.0.6/bin:/nix/store/bmcs67kwf560sv434jaycqdpwg3vivw4-clang-16.0.6/bin:/nix/store/sb5sf8pnbb5dxgr5p8qm344ky8k7f62r-glibc-2.37-45-bin/bin:/nix/store/w8vm09hri2zz7yacryzzzxvsapik4ps4-coreutils-9.1/bin:/nix/store/88bh6zy2sbkj83jcpvmzgqf74213wk2f-binutils-wrapper-2.40/bin:/nix/store/3r87a2wq1w4l66wnsm7rqvy608mx23h6-binutils-2.40/bin:/nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev/bin:/nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev/bin:/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/bin:/nix/store/b8gwvz4hiq9227321s3lqbk3c6pv22kz-llvm-16.0.6/bin:/nix/store/k6ssc7alckmv6gbympghw365ribdlj31-rustup-1.26.0/bin:/nix/store/gwf21xyl0x0bhgapi66avzf6qmddr44s-patchelf-0.15.0/bin:/nix/store/vaqs26d33rgz2acf81n35v809g8g27vh-clang-wrapper-11.1.0/bin:/nix/store/7wqhmdl4cd8yh7xi32c2ss7l6804i1p7-clang-11.1.0/bin:/nix/store/ximnbjgjqkmyp88hjz9bgsfdfy431ilp-binutils-wrapper-2.40/bin:/nix/store/hf6q72gb3nj3fbfh7j2a14vfjmsgbg25-compiler-rt-libc-16.0.6/bin:/nix/store/82fqlfr6d9s3yvhxp0zv0zswl5w12n19-compiler-rt-libc-11.1.0/bin:/nix/store/w8vm09hri2zz7yacryzzzxvsapik4ps4-coreutils-9.1/bin:/nix/store/4cxs4cigh2zdxvma52ygm3mh2igq70iw-findutils-4.9.0/bin:/nix/store/vikpb6rhmi8zzgsx8syjng9dic8dplm7-diffutils-3.9/bin:/nix/store/4mca20b13q88s6llkr8mc468rh9l9bmr-gnused-4.9/bin:/nix/store/b4in4hmq54h6l34a0v6ha40z97c0lzw2-gnugrep-3.7/bin:/nix/store/p7v8rc82yi4zngjw2z7isgqvfi32l1aj-gawk-5.2.1/bin:/nix/store/2gcfy5f68y7gkryp3wrjmvlci42qb61a-gnutar-1.35/bin:/nix/store/5xzh0z66hpcd3k578my76lx4qgra334q-gzip-1.12/bin:/nix/store/6d9vlwwy7kvxjqmqg4cldgg9mr8nflff-bzip2-1.0.8-bin/bin:/nix/store/qlcm8dzsaa6wyycmx7in8rz6x3pzf6zf-gnumake-4.4.1/bin:/nix/store/0rwyq0j954a7143p0wzd4rhycny8i967-bash-5.2-p15/bin:/nix/store/0g52i0ih3h0d9s40m84gksi2jjm4k3bf-patch-2.7.6/bin:/nix/store/agry2lhy6ilgyacx75w2ycqsdfwr513f-xz-5.4.3-bin/bin:/nix/store/rgg874xkzlfmkzkm7911dwnihswkf54g-file-5.44/bin:/run/wrappers/bin:/home/tburdick/.nix-profile/bin:/nix/profile/bin:/home/tburdick/.local/state/nix/profile/bin:/etc/profiles/per-user/tburdick/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin
CMAKE_PREFIX_PATH=/nix/store/y033c1zj8h064wm8kbnpmfcf6w54cn3z-zephyr-sdk:/nix/store/21096vzf5ljl6lhplmfd301kb8zyvj05-rimage:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env:/nix/store/n7nrikml13ipr3gishnbf2x0g3zbia16-minicom-2.8:/nix/store/04p9vxaplyd4a1m4q8qyh371dfmny3pl-ninja-1.11.1:/nix/store/sj207xd8h848inbwqpqz9lq89yii08sj-gperf-3.1:/nix/store/dp3ghxdzqfqpzkvmsay2026lhjn19lg7-ccache-4.8:/nix/store/h8q4r7f1j906rlffj96dlbbmwc9zbirk-cmake-3.25.3:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0:/nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1:/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0:/nix/store/xbm2s7589mswrgngv8ci1zcqfh1l6v2w-xxd-vim-9.0.1441:/nix/store/7rm5784szfma17yklz4dmds20ws8g5v9-nixpkgs-fmt-1.3.0:/nix/store/xnklwbh91g7if2mzy5mh4zcsg818jfls-gcc-wrapper-12.2.0:/nix/store/39x21ag4yfahwjm24a3zrqyhp1rc5mvm-binutils-wrapper-2.40:/nix/store/xknvdvpqg40cnd10gbyr3q29imgsra4k-doxygen-1.9.6:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12:/nix/store/nnjs5w63rc54fg33myzmvx6qknymiksj-clang-tools-14.0.6:/nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev:/nix/store/gv2cl6qvvslz5h15vqd89f1rpvrdg5yc-stdenv-linux:/nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev:/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib:/nix/store/gw2ql840xwh37fp7dv430mrxc1bgyxsz-lldb-16.0.6:/nix/store/zfdj9lm7rqizrjj8lk9bkxq4djxkbjh7-clang-wrapper-16.0.6:/nix/store/88bh6zy2sbkj83jcpvmzgqf74213wk2f-binutils-wrapper-2.40:/nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev:/nix/store/pzis69n8rva6rxkkp5vp4c4mklxgp5yf-ncurses-6.4-dev:/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4:/nix/store/j0zwp9zygvadcly9dxpm0f4ga7h0n8c9-zlib-1.2.13-dev:/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13:/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib:/nix/store/b8gwvz4hiq9227321s3lqbk3c6pv22kz-llvm-16.0.6:/nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev:/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6:/nix/store/k6ssc7alckmv6gbympghw365ribdlj31-rustup-1.26.0:/nix/store/gwf21xyl0x0bhgapi66avzf6qmddr44s-patchelf-0.15.0:/nix/store/vaqs26d33rgz2acf81n35v809g8g27vh-clang-wrapper-11.1.0:/nix/store/ximnbjgjqkmyp88hjz9bgsfdfy431ilp-binutils-wrapper-2.40:/nix/store/xbdp4qia936b7bkq1axr89r7f2isjn10-compiler-rt-libc-16.0.6-dev:/nix/store/hf6q72gb3nj3fbfh7j2a14vfjmsgbg25-compiler-rt-libc-16.0.6:/nix/store/yjnzgabj270d1v5ppygbhw5lrshlywa8-compiler-rt-libc-11.1.0-dev:/nix/store/82fqlfr6d9s3yvhxp0zv0zswl5w12n19-compiler-rt-libc-11.1.0
CMAKE_LIBRARY_PATH=/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib:/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib:/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib:/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib:/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib:/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib:/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib:/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib:/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib:/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib:/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib:/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib:/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib:/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib:/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib:/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib:/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib:/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib:/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib:/nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env/lib:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib:/nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0/lib:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib:/nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1/lib:/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib:/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib:/nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766/lib:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib:/nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0/lib:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib:/nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0/lib:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib:/nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12/lib:/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib:/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib:/nix/store/cwlwbcpkji2mgdb0vcxj878n4051qdac-lldb-16.0.6-lib/lib:/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib:/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib:/nix/store/wnblw3rp0qr0z6wyzhaahch3mkk42gmi-ncurses-6.4/lib:/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib:/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib:/nix/store/8mw6ssjspf8k1ija88cfldmxlbarl1bb-zlib-1.2.13/lib:/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib:/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib:/nix/store/3wljiz2pj44sj63hzjr6b0ni60r8897a-llvm-16.0.6-lib/lib:/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib:/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib:/nix/store/z2wwdfrh2wyrf2xkbm0di5pi55szbfrz-libcxx-16.0.6/lib
nativeBuildInputs=/nix/store/y033c1zj8h064wm8kbnpmfcf6w54cn3z-zephyr-sdk /nix/store/21096vzf5ljl6lhplmfd301kb8zyvj05-rimage /nix/store/d9h22m8c7irvn866jmc6ilkk8j460bxg-python3-3.10.13-env /nix/store/n7nrikml13ipr3gishnbf2x0g3zbia16-minicom-2.8 /nix/store/04p9vxaplyd4a1m4q8qyh371dfmny3pl-ninja-1.11.1 /nix/store/sj207xd8h848inbwqpqz9lq89yii08sj-gperf-3.1 /nix/store/dp3ghxdzqfqpzkvmsay2026lhjn19lg7-ccache-4.8 /nix/store/h8q4r7f1j906rlffj96dlbbmwc9zbirk-cmake-3.25.3 /nix/store/kzwn4zngw9h10k2msk3cm5n2yp07qz96-dtc-1.7.0 /nix/store/lqwlz76ns9c46qj9lcihb6vzxp3gmy0q-gnumake-4.4.1 /nix/store/ld4wra61gxq0spf16p0a6z3pcklagg6f-gdb-13.1 /nix/store/047yg0alvlwlx2k7nf3qilq3hp0rb7z4-segger-jlink-766 /nix/store/89af5sqf1rcjd7x149mwbcbzvsr8wcny-nrf-command-line-tools-10.16.0 /nix/store/xbm2s7589mswrgngv8ci1zcqfh1l6v2w-xxd-vim-9.0.1441 /nix/store/7rm5784szfma17yklz4dmds20ws8g5v9-nixpkgs-fmt-1.3.0 /nix/store/xnklwbh91g7if2mzy5mh4zcsg818jfls-gcc-wrapper-12.2.0 /nix/store/xknvdvpqg40cnd10gbyr3q29imgsra4k-doxygen-1.9.6 /nix/store/pq8mdg40n1ggphcicx3ymvbxq56vkyx7-graphviz-7.1.0 /nix/store/hq9gk0b60w877fbmqhq95xv5kxz3p3mp-protobuf-3.21.12 /nix/store/nnjs5w63rc54fg33myzmvx6qknymiksj-clang-tools-14.0.6 /nix/store/xp3d0pv6rzsliy5sizxw3h5qj1c61ny4-glibc-multi-2.37-45-dev /nix/store/gv2cl6qvvslz5h15vqd89f1rpvrdg5yc-stdenv-linux /nix/store/b5b05l62zs5gifwx87pm8ii9vrw5xn1v-lldb-16.0.6-dev /nix/store/zfdj9lm7rqizrjj8lk9bkxq4djxkbjh7-clang-wrapper-16.0.6 /nix/store/745cgiby2z7gy05iwv938vzv6s7yw9sp-llvm-16.0.6-dev /nix/store/h9ksqivblnqc6pakafffvgpz0m82cb0z-libcxx-16.0.6-dev /nix/store/k6ssc7alckmv6gbympghw365ribdlj31-rustup-1.26.0

If you look carefully PATH shows my virtualenv as the first path in the list, /home/tburdick/z/env/bin

BUT

The found cmake interpreter is the first thing in CMAKE_LIBRARY_PATH, CMAKE_PREFIX_PATH, CMAKE_INLCUDE_PATH

Perhaps find_program is somehow looking at those paths first despite my PATH, the thing I actually care about, having the virtualenv correctly there? So I tried and I found...

(env) tburdick@zefire ~/z/z/doc (main)> export CMAKE_PREFIX_PATH=$HOME/z/env/bin/:$CMAKE_PREFIX_PATH
(env) tburdick@zefire ~/z/z/doc (main)> rm -rf _build
(env) tburdick@zefire ~/z/z/doc (main)> rm -rf ~/.cache/zephyr
(env) tburdick@zefire ~/z/z/doc (main)> make html-fast
make html DT_TURBO_MODE=1
make[1]: Entering directory '/home/tburdick/z/zephyr/doc'
cmake \
	-GNinja \
	-B_build \
	-S. \
	-DDOC_TAG=development \
	-DSPHINXOPTS="-j auto -W --keep-going -T" \
	-DSPHINXOPTS_EXTRA="" \
	-DLATEXMKOPTS="-halt-on-error -no-shell-escape" \
	-DDT_TURBO_MODE=1
Loading Zephyr module(s) (Zephyr base): doc
Python currently , 
python found /home/tburdick/z/env/bin/python
python found /home/tburdick/z/env/bin/python version 3.10
python3 found /home/tburdick/z/env/bin/python
python3 found /home/tburdick/z/env/bin/python version 3.10
Calling find_package Python3, /home/tburdick/z/env/bin/python
-- Found Python3: /home/tburdick/z/env/bin/python (found suitable version "3.10.13", minimum required is "3.8") found components: Interpreter 
Called find_package Python3, /home/tburdick/z/env/bin/python
-- Cache files will be written to: /home/tburdick/.cache/zephyr
-- Found west (found suitable version "1.2.0", minimum required is "1.0.0")
-- Zephyr base: /home/tburdick/z/zephyr
-- Found Doxygen: /nix/store/xknvdvpqg40cnd10gbyr3q29imgsra4k-doxygen-1.9.6/bin/doxygen (found version "1.9.6") found components: doxygen dot 
-- Could NOT find LATEX (missing: LATEX_COMPILER PDFLATEX) 
CMake Warning at CMakeLists.txt:39 (message):
  LaTeX components not found.  PDF build will not be available.


-- Configuring done
-- Generating done
-- Build files have been written to: /home/tburdick/z/zephyr/doc/_build
cmake --build _build --target html
[0/2] Generating Devicetree bindings documentation...
[1/2] Running Sphinx HTML build...
Running Sphinx v6.2.1
Building Kconfig database...... done
Preparing Doxyfile...
Checking if Doxygen needs to be run...
Running Doxygen...
Syncing Doxygen output...
building [mo]: targets for 0 po files that are out of date
writing output... 
building [html]: targets for 1 source files that are out of date
updating environment: [new config] 1603 added, 0 changed, 0 removed
reading sources... [ 66%] samples/basic/basic .. samples/bluetooth/central_gatt_write/README     

So to me, it appears like CMAKE_PREFIX_PATH is taking precedence over my shell path for find_program. It seems this is just the expected behavior of CMake which... seems incredibly wrong and unintuitive.

So much so that FindPython.cmake finds the correct python! It does that by...

https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindPython/Support.cmake#L1846

Avoiding all the cmake environment variables, ignoring all the cmake paths...

So we have a bug in our python.cmake that does not exist in cmake's own FindPython support package.

To Reproduce

I suppose try adding a bogus python install to CMAKE_PREFIX_PATH and watch everything fail oddly.

Expected behavior
The first python interpreter in my PATH var is used.

Impact
Building docs is broken for me

@teburd teburd added the bug The issue is a bug, or the PR is fixing a bug label Dec 6, 2023
@teburd teburd changed the title build: Incorrect python interpret found by python.cmake on Nix build: Incorrect python interpreter found by python.cmake on Nix Dec 6, 2023
@teburd
Copy link
Collaborator Author

teburd commented Dec 6, 2023

Diff of my cmake changes to print out a few variables that helped me... I couldn't attach as a file because github hates patches

diff --git a/cmake/modules/python.cmake b/cmake/modules/python.cmake
index 78a29959b8b..c5fae4ebc8c 100644
--- a/cmake/modules/python.cmake
+++ b/cmake/modules/python.cmake
@@ -13,10 +13,13 @@ endif()
 
 set(PYTHON_MINIMUM_REQUIRED 3.8)
 
+
+message("Python currently ${PYTHON_EXECUTABLE}, ${Python3_EXECUTABLE}")
 find_package(Deprecated COMPONENTS PYTHON_PREFER)
 
 if(NOT DEFINED Python3_EXECUTABLE AND DEFINED WEST_PYTHON)
   set(Python3_EXECUTABLE "${WEST_PYTHON}")
+  message("python.cmake using WEST_PYTHON ${WEST_PYTHON}")
 endif()
 
 if(NOT Python3_EXECUTABLE)
@@ -26,6 +29,7 @@ if(NOT Python3_EXECUTABLE)
   # and not finding a valid python3.
   foreach(candidate "python" "python3")
     find_program(Python3_EXECUTABLE ${candidate})
+    message("${candidate} found ${Python3_EXECUTABLE}")
     if(Python3_EXECUTABLE)
         execute_process (COMMAND "${Python3_EXECUTABLE}" -c
                                  "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:2]]))"
@@ -34,6 +38,7 @@ if(NOT Python3_EXECUTABLE)
                          ERROR_QUIET
                          OUTPUT_STRIP_TRAILING_WHITESPACE)
 
+       message("${candidate} found ${Python3_EXECUTABLE} version ${version}")
        if(version VERSION_LESS PYTHON_MINIMUM_REQUIRED)
          set(Python3_EXECUTABLE "Python3_EXECUTABLE-NOTFOUND" CACHE INTERNAL "Path to a program")
        endif()
@@ -41,7 +46,9 @@ if(NOT Python3_EXECUTABLE)
   endforeach()
 endif()
 
+message("Calling find_package Python3, ${Python3_EXECUTABLE}")
 find_package(Python3 ${PYTHON_MINIMUM_REQUIRED} REQUIRED)
+message("Called find_package Python3, ${Python3_EXECUTABLE}")
 
 # Zephyr internally used Python variable.
 set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
diff --git a/cmake/modules/west.cmake b/cmake/modules/west.cmake
index f35e7a3c3f8..3c3dd0603cf 100644
--- a/cmake/modules/west.cmake
+++ b/cmake/modules/west.cmake
@@ -29,6 +29,8 @@ if(DEFINED WEST_PYTHON)
   else()
     set(python_realpath_msg "")
   endif()
+  MESSAGE("WEST_PYTHON and realpath: ${WEST_PYTHON}, ${west_realpath}")
+  MESSAGE("PYTHON_EXECUTABLE and realpath: ${PYTHON_EXECUTABLE}, ${python_realpath}")
 endif()
 
 execute_process(
(env) tburdick@zefire ~/z/zephyr (main)> git diff > cmake_python_msgs.diff
(env) tburdick@zefire ~/z/zephyr (main)> cat cmake_python_msgs.diff 
diff --git a/cmake/modules/python.cmake b/cmake/modules/python.cmake
index 78a29959b8b..c5fae4ebc8c 100644
--- a/cmake/modules/python.cmake
+++ b/cmake/modules/python.cmake
@@ -13,10 +13,13 @@ endif()
 
 set(PYTHON_MINIMUM_REQUIRED 3.8)
 
+
+message("Python currently ${PYTHON_EXECUTABLE}, ${Python3_EXECUTABLE}")
 find_package(Deprecated COMPONENTS PYTHON_PREFER)
 
 if(NOT DEFINED Python3_EXECUTABLE AND DEFINED WEST_PYTHON)
   set(Python3_EXECUTABLE "${WEST_PYTHON}")
+  message("python.cmake using WEST_PYTHON ${WEST_PYTHON}")
 endif()
 
 if(NOT Python3_EXECUTABLE)
@@ -26,6 +29,7 @@ if(NOT Python3_EXECUTABLE)
   # and not finding a valid python3.
   foreach(candidate "python" "python3")
     find_program(Python3_EXECUTABLE ${candidate})
+    message("${candidate} found ${Python3_EXECUTABLE}")
     if(Python3_EXECUTABLE)
         execute_process (COMMAND "${Python3_EXECUTABLE}" -c
                                  "import sys; sys.stdout.write('.'.join([str(x) for x in sys.version_info[:2]]))"
@@ -34,6 +38,7 @@ if(NOT Python3_EXECUTABLE)
                          ERROR_QUIET
                          OUTPUT_STRIP_TRAILING_WHITESPACE)
 
+       message("${candidate} found ${Python3_EXECUTABLE} version ${version}")
        if(version VERSION_LESS PYTHON_MINIMUM_REQUIRED)
          set(Python3_EXECUTABLE "Python3_EXECUTABLE-NOTFOUND" CACHE INTERNAL "Path to a program")
        endif()
@@ -41,7 +46,9 @@ if(NOT Python3_EXECUTABLE)
   endforeach()
 endif()
 
+message("Calling find_package Python3, ${Python3_EXECUTABLE}")
 find_package(Python3 ${PYTHON_MINIMUM_REQUIRED} REQUIRED)
+message("Called find_package Python3, ${Python3_EXECUTABLE}")
 
 # Zephyr internally used Python variable.
 set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE})
diff --git a/cmake/modules/west.cmake b/cmake/modules/west.cmake
index f35e7a3c3f8..3c3dd0603cf 100644
--- a/cmake/modules/west.cmake
+++ b/cmake/modules/west.cmake
@@ -29,6 +29,8 @@ if(DEFINED WEST_PYTHON)
   else()
     set(python_realpath_msg "")
   endif()
+  MESSAGE("WEST_PYTHON and realpath: ${WEST_PYTHON}, ${west_realpath}")
+  MESSAGE("PYTHON_EXECUTABLE and realpath: ${PYTHON_EXECUTABLE}, ${python_realpath}")
 endif()
 
 execute_process(

@tejlmand tejlmand added the priority: low Low impact/importance bug label Dec 11, 2023
@tejlmand
Copy link
Collaborator

@teburd thanks a lot for this useful information.

I already now have some idea of what might be happening, but need to do some testing on this, but unfortunately not having time atm for further investigation.

Marked as priority: low, as this is impacting a very specific setup and a workaround does exist (setting Python3_EXECUTABLE)

@tejlmand
Copy link
Collaborator

So to me, it appears like CMAKE_PREFIX_PATH is taking precedence over my shell path for find_program. It seems this is just the expected behavior of CMake which... seems incredibly wrong and unintuitive.

It's documented here:

https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html

https://cmake.org/cmake/help/latest/command/find_package.html
https://cmake.org/cmake/help/latest/command/find_program.html

and exactly allows you to control behavior so that CMake looks up at those paths before the default locations.

@teburd
Copy link
Collaborator Author

teburd commented Dec 11, 2023

So to me, it appears like CMAKE_PREFIX_PATH is taking precedence over my shell path for find_program. It seems this is just the expected behavior of CMake which... seems incredibly wrong and unintuitive.

It's documented here:

https://cmake.org/cmake/help/latest/variable/CMAKE_PREFIX_PATH.html

https://cmake.org/cmake/help/latest/command/find_package.html
https://cmake.org/cmake/help/latest/command/find_program.html

and exactly allows you to control behavior so that CMake looks up at those paths before the default locations.

that’s not the way cmakes own find python module works though, it ignores the CMake environment variables. So this is confusing

@tejlmand
Copy link
Collaborator

that’s not the way cmakes own find python module works though, it ignores the CMake environment variables. So this is confusing

oh, then I misread your comment. I thought that if you defined CMAKE_PREFIX_PATH then Python was correctly discovered.
If that's not the case, then based on your description I agree with you that it is confusing.

@teburd
Copy link
Collaborator Author

teburd commented Dec 11, 2023

See https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindPython/Support.cmake#L1786 to start, the very first branch for virtualenvs ignores the cmake env vars.

cmake's FindPython module works well for me, but I can understand if there's confusing things that happen when it goes looking around registries and such for the latest python install.

@tejlmand did you try setting the strategy for FindPython? https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindPython.cmake#L314 seems like using the LOCATION strategy might be just fine?

@tejlmand
Copy link
Collaborator

@tejlmand did you try setting the strategy for FindPython? https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/FindPython.cmake#L314 seems like using the LOCATION strategy might be just fine?

Unfortunately its not. Been there, tried that.

The location still doesn't guarantee the order in which Python installations are tried (those in path which #24364 fixes).

@teburd
Copy link
Collaborator Author

teburd commented Feb 1, 2024

@tejlmand Setting Python3_EXECUTABLE doesn't seem to be possible when running twister unless I've missed something (very possible!). I'm carrying around a patch to do my work now which is kind of painful. It seems like in retrospect all the issues here are related to windows and python, can we use the cmake python module on all platforms but windows perhaps?

@teburd
Copy link
Collaborator Author

teburd commented Feb 1, 2024

@tejlmand Setting Python3_EXECUTABLE doesn't seem to be possible when running twister unless I've missed something (very possible!). I'm carrying around a patch to do my work now which is kind of painful. It seems like in retrospect all the issues here are related to windows and python, can we use the cmake python module on all platforms but windows perhaps?

Ok I figured it out, maybe somewhat amusingly... I do

-x Python3_EXECUTABLE="`which python`"

@marc-hb
Copy link
Collaborator

marc-hb commented Feb 1, 2024

It seems like in retrospect all the issues here are related to windows and python, can we use the cmake python module on all platforms but windows perhaps?

I think the "bigger" question is: if the real-world issues are (as expected) very different between Windows and Linux, then why is 100% of the workaround code shared between the two?

Zephyr's C code is (correctly) split between "arch/" code for arch-specific problems versus common code for common problems. So why does python.cmake's re-invention of FindPython insists on being 100% "portable" when (according to @teburd) most of the problems it tries to solve are not "portable" at all?

PS: we haven't even looked at macOS/brew yet...
PPS: I'm not suggesting "arch/" subdirectories for CMake code. I'm only suggesting OS-specific code. It can be all in the same file.

@teburd
Copy link
Collaborator Author

teburd commented Mar 15, 2024

Related, and probably better described in issue #70258

@teburd teburd closed this as completed Mar 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Build System bug The issue is a bug, or the PR is fixing a bug priority: low Low impact/importance bug
Projects
None yet
Development

No branches or pull requests

4 participants