I cd to the build directory and execute D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe to get into the interactive environment of python. Execute
import pyexpat
Repeated the same error.
Then I cd to "D:\vcpkg\downloads\tools\python\python-3.12.7-x64" and execute python again to get into the interactive environment of python. Execute
import pyexpat
The error disappeared.
After that, I was able to reproduce the error by locating a random directory different from "D:\vcpkg\downloads\tools\python\python-3.12.7-x64".
After consulting the python documentation, I found that setting both PYTHONHOME and PYTHONPATH can affect sys.path. I tried changing PYTHONHOME and PYTHONPATH to "D:\vcpkg\downloads\tools\python\ python-3.12.7-x64", and found that only changing PYTHONHOME can fix the error.
So far I have found a solution.
But now I'm facing a new problem, how to pass the modified PYTHONHOME to ninja. after googling, I found out that ninja doesn't support environment variables, and I changed the environment variables in vcpkg_install_meson.cmake, but still no effect!
I don't think vcpkg builds should be affected by the host machine's python installation, you can't ask everyone using vcpkg to uninstall their local python environment
Package: glib:x64-windows@2.80.0#1
Host Environment
To Reproduce
vcpkg install
Failure logsD:\vcpkg\buildtrees\glib\package-x64-windows-dbg-out.log
``` [1/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/buildtrees/glib/src/glib-2-0931cd8d4d.clean/tools/gen-visibility-macros.py" "2.80.0" "visibility-macros" "GLIB" "glib/glib-visibility.h" [2/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "../src/glib-2-0931cd8d4d.clean/gio/data-to-c.py" "../src/glib-2-0931cd8d4d.clean/gio/../glib/gconstructor.h" "gconstructor_code" "gio/gconstructor_as_data.h" [3/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/buildtrees/glib/src/glib-2-0931cd8d4d.clean/tools/gen-visibility-macros.py" "2.80.0" "visibility-macros" "GI" "girepository/gi-visibility.h" [4/661] "C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/rc.exe" "-c65001" "-DWIN32" "-D_DEBUG" "/nologo" "/foglib/glib_glib.rc_glib.res" "glib/glib.rc" [5/661] "C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/rc.exe" "-c65001" "-DWIN32" "-D_DEBUG" "/nologo" "/fogobject/gobject_gobject.rc_gobject.res" "gobject/gobject.rc" [6/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/buildtrees/glib/src/glib-2-0931cd8d4d.clean/tools/gen-visibility-macros.py" "2.80.0" "visibility-macros" "GOBJECT" "gobject/gobject-visibility.h" [7/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/buildtrees/glib/src/glib-2-0931cd8d4d.clean/tools/gen-visibility-macros.py" "2.80.0" "visibility-macros" "GMODULE" "gmodule/gmodule-visibility.h" [8/661] "C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/rc.exe" "-c65001" "-DWIN32" "-D_DEBUG" "/nologo" "/fogmodule/gmodule_gmodule.rc_gmodule.res" "gmodule/gmodule.rc" [9/661] "C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/rc.exe" "-c65001" "-DWIN32" "-D_DEBUG" "/nologo" "/fogthread/gthread_gthread.rc_gthread.res" "gthread/gthread.rc" [10/661] "C:/Program Files (x86)/Windows Kits/10/bin/10.0.22621.0/x64/rc.exe" "-c65001" "-DWIN32" "-D_DEBUG" "/nologo" "/fogio/gio_gio.rc_gio.res" "gio/gio.rc" [11/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/be@latin/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/be@latin.po" [12/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/buildtrees/glib/src/glib-2-0931cd8d4d.clean/tools/gen-visibility-macros.py" "2.80.0" "visibility-macros" "GIO" "gio/gio-visibility.h" [13/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/af/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/af.po" [14/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/be/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/be.po" [15/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/ast/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/ast.po" [16/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/an/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/an.po" [17/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/az/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/az.po" [18/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/downloads/tools/meson-1.6.0-ac58a9/meson.py" "--internal" "copy" "../src/glib-2-0931cd8d4d.clean/gio/gdbus-2.0/codegen/codegen_rst.py" "gio/gdbus-2.0/codegen/codegen_rst.py" [19/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/downloads/tools/meson-1.6.0-ac58a9/meson.py" "--internal" "copy" "../src/glib-2-0931cd8d4d.clean/gio/gdbus-2.0/codegen/codegen.py" "gio/gdbus-2.0/codegen/codegen.py" [20/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/downloads/tools/meson-1.6.0-ac58a9/meson.py" "--internal" "copy" "../src/glib-2-0931cd8d4d.clean/gio/gdbus-2.0/codegen/__init__.py" "gio/gdbus-2.0/codegen/__init__.py" [21/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/downloads/tools/meson-1.6.0-ac58a9/meson.py" "--internal" "copy" "../src/glib-2-0931cd8d4d.clean/gio/gdbus-2.0/codegen/codegen_md.py" "gio/gdbus-2.0/codegen/codegen_md.py" [22/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/downloads/tools/meson-1.6.0-ac58a9/meson.py" "--internal" "copy" "../src/glib-2-0931cd8d4d.clean/gio/gdbus-2.0/codegen/parser.py" "gio/gdbus-2.0/codegen/parser.py" [23/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/en_CA/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/en_CA.po" [24/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/am/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/am.po" [25/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/ar/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/ar.po" [26/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/downloads/tools/meson-1.6.0-ac58a9/meson.py" "--internal" "copy" "../src/glib-2-0931cd8d4d.clean/gio/gdbus-2.0/codegen/utils.py" "gio/gdbus-2.0/codegen/utils.py" [27/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/as/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/as.po" [28/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/downloads/tools/meson-1.6.0-ac58a9/meson.py" "--internal" "copy" "../src/glib-2-0931cd8d4d.clean/gio/gdbus-2.0/codegen/codegen_main.py" "gio/gdbus-2.0/codegen/codegen_main.py" [29/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/downloads/tools/meson-1.6.0-ac58a9/meson.py" "--internal" "copy" "../src/glib-2-0931cd8d4d.clean/gio/gdbus-2.0/codegen/codegen_docbook.py" "gio/gdbus-2.0/codegen/codegen_docbook.py" [30/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:/vcpkg/downloads/tools/meson-1.6.0-ac58a9/meson.py" "--internal" "copy" "../src/glib-2-0931cd8d4d.clean/gio/gdbus-2.0/codegen/dbustypes.py" "gio/gdbus-2.0/codegen/dbustypes.py" [31/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/ab/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/ab.po" [32/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/bg/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/bg.po" [33/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/bs/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/bs.po" [34/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/dz/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/dz.po" [35/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/da/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/da.po" [36/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/de/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/de.po" [37/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/cy/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/cy.po" [38/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/ca@valencia/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/ca@valencia.po" [39/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/cs/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/cs.po" [40/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/bn/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/bn.po" [41/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/en@shaw/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/en@shaw.po" [42/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/ca/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/ca.po" [43/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/bn_IN/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/bn_IN.po" [44/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/eu/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/eu.po" [45/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/el/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/el.po" [46/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/eo/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/eo.po" [47/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/es/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/es.po" [48/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "D:\vcpkg\downloads\tools\meson-1.6.0-ac58a9\meson.py" "--internal" "exe" "--capture" "gobject\glib-enumtypes.h" "--" "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "gobject/glib-mkenums" "--template" "../src/glib-2-0931cd8d4d.clean/gobject/glib-enumtypes.h.template" "../src/glib-2-0931cd8d4d.clean/gobject/../glib/gunicode.h" [49/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/fi/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/fi.po" [50/661] "D:/projects/conference-go-client/build/vcpkg_installed/x64-windows/tools/gettext/bin\msgfmt.EXE" "-o" "po/fa/LC_MESSAGES/glib20.mo" "../src/glib-2-0931cd8d4d.clean/po/fa.po" [51/661] "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "gio/gdbus-2.0/codegen/gdbus-codegen" "--interface-prefix" "org." "--output-directory" "gio" "--generate-c-code" "gdbus-daemon-generated" "--c-namespace" "_G" "../src/glib-2-0931cd8d4d.clean/gio/dbus-daemon.xml" FAILED: gio/gdbus-daemon-generated.h gio/gdbus-daemon-generated.c "D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe" "gio/gdbus-2.0/codegen/gdbus-codegen" "--interface-prefix" "org." "--output-directory" "gio" "--generate-c-code" "gdbus-daemon-generated" "--c-namespace" "_G" "../src/glib-2-0931cd8d4d.clean/gio/dbus-daemon.xml" Traceback (most recent call last): File "D:\vcpkg\buildtrees\glib\x64-windows-dbg\gio\gdbus-2.0\codegen\gdbus-codegen", line 53, inAdditional context
vcpkg.json
``` { "$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", "name": "cgclient", "version": "0.1.0", "dependencies": [ "asiochan", "boost-asio", "boost-beast", "boost-core", "boost-uuid", "boost-circular-buffer", "boost-algorithm", "boost-url", "yamc", "cuda", "cuda-api-wrappers", "fmt", "cpptrace", "spdlog", "nlohmann-json", "libuvc", { "name": "opencv", "features": [ "ffmpeg" ] }, { "name": "ffmpeg", "features": [ "swscale", "x264", "x265", "nvcodec" ] }, { "name": "libdatachannel", "features": [ "srtp" ] }, { "name": "gstreamer", "features": [ "plugins-good", "nvcodec" ] }, "gtest", { "name": "libunwind", "platform": "linux" } ] } ```After digging deeper, I realized that it was a problem with python's sys.path. According to the log above, the command that went wrong was
I cd to the build directory and execute
D:\vcpkg\downloads\tools\python\python-3.12.7-x64\python.exe
to get into the interactive environment of python. ExecuteRepeated the same error. Then I cd to "D:\vcpkg\downloads\tools\python\python-3.12.7-x64" and execute
python
again to get into the interactive environment of python. ExecuteThe error disappeared. After that, I was able to reproduce the error by locating a random directory different from "D:\vcpkg\downloads\tools\python\python-3.12.7-x64". After consulting the python documentation, I found that setting both PYTHONHOME and PYTHONPATH can affect sys.path. I tried changing PYTHONHOME and PYTHONPATH to "D:\vcpkg\downloads\tools\python\ python-3.12.7-x64", and found that only changing PYTHONHOME can fix the error. So far I have found a solution. But now I'm facing a new problem, how to pass the modified PYTHONHOME to ninja. after googling, I found out that ninja doesn't support environment variables, and I changed the environment variables in vcpkg_install_meson.cmake, but still no effect!
By the way, if not set PYTHONHOME, my sys.path is
After set PYTHONHOME, my sys.path is
So I think the problem is by default my global python is detected, and usd by meson.
update: Changing the environment variable PYTHONHOME in vcpkg_install_meson.cmake works
vcpkg_configure_meson.cmake should be changed as well