microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
23.38k stars 6.46k forks source link

[python3] Python3 needs Pyhon3 to build Python3 #33131

Closed TrueBrain closed 1 year ago

TrueBrain commented 1 year ago

Till four days ago, it was possible to install Python3 in vcpkg without having Python3 system-wide installed. Since 4 days ago (and specifically, this commit and line: https://github.com/microsoft/vcpkg/commit/c6928dfb9eb7f333f988d2ce70d1e771b7606849#diff-f682e6e46ef0d0dae2ceba81d191975da58a84cbdab4811a0e84683442265461R245 ) that is no longer the case.

We use vcpkg to build a linux-generic binary with a very old libc so as many people as possible can run it on their system. Basically, it based on quay.io/pypa/manylinux2014_x86_64. Sadly, having a system-wide Python3 on that is very challenging, one that vcpkg was resolving for us. But .. no longer :(

Would be really appreciated if Python3 can be build again without needing Python3 to start with! Tnx :)

Package: python3:x64-linux -> 3.11.4#1

Host Environment

To Reproduce

vcpkg install python3 Failure logs

-- Downloading https://github.com/python/cpython/archive/v3.11.4.tar.gz -> python-cpython-v3.11.4.tar.gz...
-- Extracting source /vcpkg/downloads/python-cpython-v3.11.4.tar.gz
-- Applying patch 0001-only-build-required-projects.patch
-- Applying patch 0003-use-vcpkg-zlib.patch
-- Applying patch 0004-devendor-external-dependencies.patch
-- Applying patch 0005-dont-copy-vcruntime.patch
-- Applying patch 0008-python.pc.patch
-- Applying patch 0010-dont-skip-rpath.patch
-- Applying patch 0012-force-disable-curses.patch
-- Applying patch 0014-fix-get-python-inc-output.patch
-- Applying patch 0015-dont-use-WINDOWS-def.patch
-- Applying patch 0002-static-library.patch
-- Applying patch 0011-gcc-ldflags-fix.patch
-- Using source at /vcpkg/buildtrees/python3/src/v3.11.4-101b2af427.clean
CMake Error at scripts/cmake/vcpkg_find_acquire_program.cmake:163 (message):
  Could not find python3.  Please install it via your package manager:

      sudo apt-get install python3
Call Stack (most recent call first):
  ports/python3/portfile.cmake:254 (vcpkg_find_acquire_program)
  scripts/ports.cmake:147 (include)
TrueBrain commented 1 year ago

Disabling the following lines fixes my issue:

https://github.com/microsoft/vcpkg/blob/c6928dfb9eb7f333f988d2ce70d1e771b7606849/ports/python3/portfile.cmake#L245-L246

After which Python builds and functions as expected.

Osyotr commented 1 year ago

Since we don't touch stuff that needs regeneration, we don't need to set PYTHON_FOR_REGEN. Please test #33132

TrueBrain commented 1 year ago

As that is exactly the patch I am currently applying to my builds, can confirm, fixes the issue :)