Closed JMoodyFWD closed 6 months ago
I uninstalled Visual Studio 2022, Installed Visual Studio 2019 and after installing the necessary components, I was able to build PHP without any issues. Self-closing for user error.
Hi @JMoodyFWD Fyi, you can install multiple Build Tools version in Visual Studio. For example in VS2022 to have both vc15, vs16 & vs17, respectively :
"Microsoft.VisualStudio.Component.VC.v141.x86.x64",
"Microsoft.VisualStudio.Component.VC.14.29.16.11.x86.x64",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
you can now init vcvarall.bat
with the one you want
call %PATH_VS%\VC\Auxiliary\Build\vcvarsall.bat %ARCH% -vcvars_ver=%vcvars_ver%
where vcvars_ver
in:
14.16
(vc15) 14.29
(vs16) 14.39
(vs17 latest)]this corresponds to this patch
diff --git a/bin/phpsdk_setshell.bat b/bin/phpsdk_setshell.bat
index f651a4e..6c291db 100644
--- a/bin/phpsdk_setshell.bat
+++ b/bin/phpsdk_setshell.bat
@@ -199,9 +199,9 @@ if "%HOST_ARCH_NAME%"=="%TARGET_ARCH_NAME%" (
set VCVARSALL_ARCH_NAME=%HOST_ARCH_NAME%_%TARGET_ARCH_NAME%
)
if 15 gtr %PHP_SDK_VS_NUM% (
- set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" !VCVARSALL_ARCH_NAME!
+ set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" !VCVARSALL_ARCH_NAME! -vcvars_ver=%vcvars_ver%
) else (
- set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" !VCVARSALL_ARCH_NAME!
+ set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" !VCVARSALL_ARCH_NAME! -vcvars_ver=%vcvars_ver%
)
set VCVARSALL_ARCH_NAME=
Hi @JMoodyFWD
Fyi, you can install multiple Build Tools version in Visual Studio.
For example in VS2022 to have both vc15, vs16 & vs17, respectively :
"Microsoft.VisualStudio.Component.VC.v141.x86.x64", "Microsoft.VisualStudio.Component.VC.14.29.16.11.x86.x64", "Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
you can now init
vcvarall.bat
with the one you want
call %PATH_VS%\VC\Auxiliary\Build\vcvarsall.bat %ARCH% -vcvars_ver=%vcvars_ver%
where
vcvars_ver
in:
14.16
(vc15)
14.29
(vs16)
14.39
(vs17 latest)]this corresponds to this patch
diff --git a/bin/phpsdk_setshell.bat b/bin/phpsdk_setshell.bat index f651a4e..6c291db 100644 --- a/bin/phpsdk_setshell.bat +++ b/bin/phpsdk_setshell.bat @@ -199,9 +199,9 @@ if "%HOST_ARCH_NAME%"=="%TARGET_ARCH_NAME%" ( set VCVARSALL_ARCH_NAME=%HOST_ARCH_NAME%_%TARGET_ARCH_NAME% ) if 15 gtr %PHP_SDK_VS_NUM% ( - set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" !VCVARSALL_ARCH_NAME! + set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\vcvarsall.bat" !VCVARSALL_ARCH_NAME! -vcvars_ver=%vcvars_ver% ) else ( - set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" !VCVARSALL_ARCH_NAME! + set PHP_SDK_VS_SHELL_CMD="!PHP_SDK_VC_DIR!\Auxiliary\Build\vcvarsall.bat" !VCVARSALL_ARCH_NAME! -vcvars_ver=%vcvars_ver% ) set VCVARSALL_ARCH_NAME=
Very cool! Thanks for letting me know 😃
I have Visual Studio 2022 Community on Windows 11 installed and tried following the directions, but I'm getting nowhere.
Following the instructions in this repo's readme, I tried to run
phpsdk-vs16-x64.bat
and I get the following output:Could not determine 'vs16' directory
Running
vswhere
from bothbin\vswhere
and globally both return the following output:If I try to run:
``bin\vswhere -nologo -version "[16,17)" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text
OR
bin\vswhere -nologo -version "[16,17)" -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath -format text
As mentioned in many issues posted here and on StackOverflow, It just returns nothing, so it seems like either I'm missing some sort of component in Visual Studio, or there is something that is lost in translation from the readme's directions that are somehow not applicable in 2024?
Any help would be appreciated.