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

vcbuild.bat is somewhat broken on Windows #29417

Closed
targos opened this issue Sep 3, 2019 · 10 comments
Closed

vcbuild.bat is somewhat broken on Windows #29417

targos opened this issue Sep 3, 2019 · 10 comments
Labels
build Issues and PRs related to build files or the CI. windows Issues and PRs related to the Windows platform.

Comments

@targos
Copy link
Member

targos commented Sep 3, 2019

On my machine:

D:\Git\nodejs\node>.\vcbuild.bat
Looking for Python
Le système ne trouve pas le nom de fichier de commandes - found-python
Le système ne trouve pas le nom de fichier de commandes - found-python

Sorry for the error message in French. Is there a way I can get a more verbose output?

@targos targos added build Issues and PRs related to build files or the CI. windows Issues and PRs related to the Windows platform. labels Sep 3, 2019
@targos
Copy link
Member Author

targos commented Sep 3, 2019

I'm on Windows 10, version 1903 (18362.329) with Visual Studio 2019 (16.2.3).

@bzoz
Copy link
Contributor

bzoz commented Sep 3, 2019

Use set DEBUG_HELPER=1, it will make vcbuild far more verbose.

@targos
Copy link
Member Author

targos commented Sep 3, 2019

output
D:\Git\nodejs\node>set DEBUG_HELPER=1

D:\Git\nodejs\node>.\vcbuild.bat

D:\Git\nodejs\node>endlocal

D:\Git\nodejs\node>if /I "" == "help" goto help

D:\Git\nodejs\node>if /I "" == "--help" goto help

D:\Git\nodejs\node>if /I "" == "-help" goto help

D:\Git\nodejs\node>if /I "" == "/help" goto help

D:\Git\nodejs\node>if /I "" == "?" goto help

D:\Git\nodejs\node>if /I "" == "-?" goto help 

D:\Git\nodejs\node>if /I "" == "--?" goto help

D:\Git\nodejs\node>if /I "" == "/?" goto help

D:\Git\nodejs\node>cd D:\Git\nodejs\node\

D:\Git\nodejs\node>set config=Release 

D:\Git\nodejs\node>set target=Build

D:\Git\nodejs\node>set target_arch=x64

D:\Git\nodejs\node>set ltcg=

D:\Git\nodejs\node>set target_env=

D:\Git\nodejs\node>set noprojgen=

D:\Git\nodejs\node>set projgen=

D:\Git\nodejs\node>set nobuild=

D:\Git\nodejs\node>set sign=

D:\Git\nodejs\node>set nosnapshot=

D:\Git\nodejs\node>set cctest_args=

D:\Git\nodejs\node>set test_args=

D:\Git\nodejs\node>set stage_package=

D:\Git\nodejs\node>set package=

D:\Git\nodejs\node>set msi=

D:\Git\nodejs\node>set upload=

D:\Git\nodejs\node>set licensertf=

D:\Git\nodejs\node>set lint_js=

D:\Git\nodejs\node>set lint_cpp=

D:\Git\nodejs\node>set lint_md=

D:\Git\nodejs\node>set lint_md_build=

D:\Git\nodejs\node>set noetw=

D:\Git\nodejs\node>set noetw_msi_arg=

D:\Git\nodejs\node>set i18n_arg=

D:\Git\nodejs\node>set download_arg=

D:\Git\nodejs\node>set build_release=

D:\Git\nodejs\node>set enable_vtune_arg=

D:\Git\nodejs\node>set configure_flags=

D:\Git\nodejs\node>set build_addons= 

D:\Git\nodejs\node>set dll=

D:\Git\nodejs\node>set enable_static=

D:\Git\nodejs\node>set build_js_native_api_tests=

D:\Git\nodejs\node>set build_node_api_tests=

D:\Git\nodejs\node>set test_node_inspect=

D:\Git\nodejs\node>set test_check_deopts=

D:\Git\nodejs\node>set js_test_suites=default

D:\Git\nodejs\node>set v8_test_options=

D:\Git\nodejs\node>set v8_build_options=

D:\Git\nodejs\node>set "common_test_suites=default doctool addons js-native-api node-api&set build_addons=1&set build_js_native_api_tests=1&set build_node_api_tests=1"

D:\Git\nodejs\node>set http2_debug=

D:\Git\nodejs\node>set nghttp2_debug=

D:\Git\nodejs\node>set link_module=

D:\Git\nodejs\node>set no_cctest=

D:\Git\nodejs\node>set cctest=

D:\Git\nodejs\node>set openssl_no_asm=

D:\Git\nodejs\node>set doc=

D:\Git\nodejs\node>set extra_msbuild_args=

D:\Git\nodejs\node>if "" == "" goto args-done

D:\Git\nodejs\node>if "" == "lint" (goto lint-cpp )

D:\Git\nodejs\node>if defined build_release (
set config=Release
 set package=1
 set msi=1
 set licensertf=1
 set download_arg="--download=all"  
 set i18n_arg=small-icu
 set projgen=1
 set cctest=1
 set ltcg=1
)

D:\Git\nodejs\node>if defined msi set stage_package=1

D:\Git\nodejs\node>if defined package set stage_package=1

D:\Git\nodejs\node>set "node_exe=Release\node.exe"

D:\Git\nodejs\node>set "node_gyp_exe="Release\node.exe" deps\npm\node_modules\node-gyp\bin\node-gyp"

D:\Git\nodejs\node>set "npm_exe="D:\Git\nodejs\node\Release\node.exe" D:\Git\nodejs\node\deps\npm\bin\npm-cli.js"

D:\Git\nodejs\node>if "" == "vs2017" set "node_gyp_exe="Release\node.exe" deps\npm\node_modules\node-gyp\bin\node-gyp --msvs_version=2017" 

D:\Git\nodejs\node>if "" == "vs2019" set "node_gyp_exe="Release\node.exe" deps\npm\node_modules\node-gyp\bin\node-gyp --msvs_version=2019"

D:\Git\nodejs\node>if "Release" == "Debug" set configure_flags= --debug

D:\Git\nodejs\node>if defined nosnapshot set configure_flags= --without-snapshot

D:\Git\nodejs\node>if defined noetw set configure_flags= --without-etw  & set noetw_msi_arg=/p:NoETW=1

D:\Git\nodejs\node>if defined ltcg set configure_flags= --with-ltcg

D:\Git\nodejs\node>if defined release_urlbase set configure_flags= --release-urlbase=

D:\Git\nodejs\node>if defined download_arg set configure_flags=

D:\Git\nodejs\node>if defined enable_vtune_arg set configure_flags= --enable-vtune-profiling

D:\Git\nodejs\node>if defined dll set configure_flags= --shared 

D:\Git\nodejs\node>if defined enable_static set configure_flags= --enable-static

D:\Git\nodejs\node>if defined no_NODE_OPTIONS set configure_flags= --without-node-options 

D:\Git\nodejs\node>if defined link_module set configure_flags=

D:\Git\nodejs\node>if defined i18n_arg set configure_flags= --with-intl=

D:\Git\nodejs\node>if defined config_flags set configure_flags=  

D:\Git\nodejs\node>if defined target_arch set configure_flags= --dest-cpu=x64

D:\Git\nodejs\node>if defined openssl_no_asm set configure_flags= --dest-cpu=x64 --openssl-no-asm

D:\Git\nodejs\node>if defined DEBUG_HELPER set configure_flags= --dest-cpu=x64 --verbose

D:\Git\nodejs\node>if "x64" == "x86" if "AMD64" == "AMD64" set configure_flags= --dest-cpu=x64 --verbose --no-cross-compiling

D:\Git\nodejs\node>if not exist "D:\Git\nodejs\node\deps\icu" goto no-depsicu

D:\Git\nodejs\node>if "Build" == "TestClean" (
echo deleting test/.tmp*
 if exist "test\.tmp*" for /F %i in ('dir /a:d /s /b test\.tmp*') do rmdir /S /Q "%i"  
 goto exit
)

D:\Git\nodejs\node>call tools\msvs\find_python.cmd

D:\Git\nodejs\node>echo Looking for Python 
Looking for Python

D:\Git\nodejs\node>setlocal enabledelayedexpansion

D:\Git\nodejs\node>FOR /F "delims=" %a IN ('where python.exe 2> NUL') DO (
SET need_path=0
 SET p=%~dpa
 CALL :validate-v2
 IF NOT ERRORLEVEL 1 GOTO :found-python2
 GOTO :done-path-v2
)

D:\Git\nodejs\node>(
SET need_path=0
 SET p=C:\Users\targo\AppData\Local\Programs\Python\Python37\
 CALL :validate-v2
 IF NOT ERRORLEVEL 1 GOTO :found-python2
 GOTO :done-path-v2
)

D:\Git\nodejs\node>IF NOT EXIST "C:\Users\targo\AppData\Local\Programs\Python\Python37\\python.exe" EXIT /B 1

D:\Git\nodejs\node>"C:\Users\targo\AppData\Local\Programs\Python\Python37\\python.exe" -V   2>&1  | findstr /R "^Python.2.*"  1>NUL

D:\Git\nodejs\node>EXIT /B 1

D:\Git\nodejs\node>FOR %K IN ("HKCU\Software" "HKLM\SOFTWARE" "HKLM\Software\Wow6432Node") DO (
SET need_path=1
 CALL :find-versions-v2 %K
 IF NOT ERRORLEVEL 1 CALL :validate-v2
 IF NOT ERRORLEVEL 1 GOTO :found-python2 
)

D:\Git\nodejs\node>(
SET need_path=1
 CALL :find-versions-v2 "HKCU\Software"
 IF NOT ERRORLEVEL 1 CALL :validate-v2  
 IF NOT ERRORLEVEL 1 GOTO :found-python2
)

D:\Git\nodejs\node>for /F "delims=" %a in ('reg query "HKCU\Software\Python\PythonCore" /f * /k 2> nul | findstr /r ^HK | findstr "\\2\."') do (
call :read-installpath %a
 if not errorlevel 1 exit /b 0
)

D:\Git\nodejs\node>exit /b 1 

D:\Git\nodejs\node>(
SET need_path=1
 CALL :find-versions-v2 "HKLM\SOFTWARE"
 IF NOT ERRORLEVEL 1 CALL :validate-v2
 IF NOT ERRORLEVEL 1 GOTO :found-python2
)

D:\Git\nodejs\node>for /F "delims=" %a in ('reg query "HKLM\SOFTWARE\Python\PythonCore" /f * /k 2> nul | findstr /r ^HK | findstr "\\2\."') do (
call :read-installpath %a
 if not errorlevel 1 exit /b 0
)

D:\Git\nodejs\node>(
call :read-installpath HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7
 if not errorlevel 1 exit /b 0
)

D:\Git\nodejs\node>for /F "skip=2 tokens=3*" %a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath" /ve /t REG_SZ 2> nul') do (
set "head=%a"
 set "tail=%b"
 set "p=!head!"
 if not "!tail!" == "" set "p=!head! !tail!"
 exit /b 0
)

D:\Git\nodejs\node>(
set "head=REG_SZ"
 set "tail=C:\Python27\"
 set "p=!head!"
 if not "!tail!" == "" set "p=!head! !tail!"
 exit /b 0 
)

D:\Git\nodejs\node>IF NOT EXIST "REG_SZ C:\Python27\\python.exe" EXIT /B 1

D:\Git\nodejs\node>(
SET need_path=1
 CALL :find-versions-v2 "HKLM\Software\Wow6432Node"
 IF NOT ERRORLEVEL 1 CALL :validate-v2
 IF NOT ERRORLEVEL 1 GOTO :found-python2
) 

D:\Git\nodejs\node>for /F "delims=" %a in ('reg query "HKLM\Software\Wow6432Node\Python\PythonCore" /f * /k 2> nul | findstr /r ^HK | findstr "\\2\."') do (
call :read-installpath %a
 if not errorlevel 1 exit /b 0
)

D:\Git\nodejs\node>exit /b 1

D:\Git\nodejs\node>set need_path=0

D:\Git\nodejs\node>for /F "delims=" %a in ('where python.exe 2> nul') do (
set p=%~dpa
 goto :found-python
)

D:\Git\nodejs\node>(
set p=C:\Users\targo\AppData\Local\Programs\Python\Python37\
 goto :found-python
)
Le système ne trouve pas le nom de fichier de commandes - found-python

D:\Git\nodejs\node>(
set p=C:\Users\targo\AppData\Local\Microsoft\WindowsApps\
 goto :found-python
)
Le système ne trouve pas le nom de fichier de commandes - found-python

I do have Python 2 installed in C:\Python27.

@bzoz
Copy link
Contributor

bzoz commented Sep 3, 2019

/cc @refack @joaocgreis @nodejs/platform-windows

@joaocgreis
Copy link
Member

@targos what is the output of

reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath" /ve

@targos
Copy link
Member Author

targos commented Sep 3, 2019

@joaocgreis :

C:\Users\targo>reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath" /ve

HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.7\InstallPath
    (par défaut)    REG_SZ    C:\Python27\

@joaocgreis
Copy link
Member

@targos thanks! I see the issue, I'll prepare a PR.

I'm wondering how this worked before, there might be another issue in the new code. Can you paste the output of:

git checkout ab841d5fbab1a9d2f8323d1ae3f71f37c6f636a1
set DEBUG_HELPER=1
.\tools\msvs\find_python.cmd

@targos
Copy link
Member Author

targos commented Sep 3, 2019

PS D:\Git\nodejs\node> .\tools\msvs\find_python.cmd
Looking for Python 2.x
Python found in C:\Users\targo\AppData\Local\Programs\Python\Python37\, but it is not v2.x.

joaocgreis added a commit to JaneaSystems/node that referenced this issue Sep 3, 2019
This code previously assumed the default value was always printed to
the console by reg.exe as "(default)", but this is not true on
localized versions of Windows and can contain spaces.

Fixes: nodejs#29417
@joaocgreis
Copy link
Member

This should fix the issue: #29423

@targos the previous code didn't work either, so I'm assuming you installed Python 3 recently or somehow Python 2 was before in the PATH. Can you test #29423 to make sure there are no more issues? Thanks!

@targos
Copy link
Member Author

targos commented Sep 3, 2019

@joaocgreis I confirm it works on my computer. Thanks a lot for the help and fix!

@Trott Trott closed this as completed in 7bff962 Sep 6, 2019
targos pushed a commit that referenced this issue Sep 20, 2019
This code previously assumed the default value was always printed to
the console by reg.exe as "(default)", but this is not true on
localized versions of Windows and can contain spaces.

Fixes: #29417

PR-URL: #29423
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants