You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "raulcd (via GitHub)" <gi...@apache.org> on 2026/09/28 09:38:38 UTC

[PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

raulcd opened a new pull request, #51610:
URL: https://github.com/apache/arrow/pull/51610

   ## TBD
   
   ### Rationale for this change
   
   ### What changes are included in this PR?
   
   ### Are these changes tested?
   
   ### Are there any user-facing changes?
   
   **This PR includes breaking changes to public APIs.** (If there are any breaking changes to public APIs, please explain which changes are breaking. If not, you can remove this.)
   
   **This PR contains a "Critical Fix".** (If the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld), please provide explanation. If not, you can remove this.)
   
   ### Was AI used for this PR?
   
   In accordance to the [AI generation guidelines](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code), please disclose below whether and how AI was used in this PR.
   
   **PR code and description written by:**
   
   - [ ] Human
   - [ ] AI
   
   **Reviewed before submission by:**
   
   - [ ] Human
   - [ ] AI
   - [ ] Not reviewed
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

Posted by "raulcd (via GitHub)" <gi...@apache.org>.
raulcd commented on PR #51610:
URL: https://github.com/apache/arrow/pull/51610#issuecomment-5888270921

   @github-actions crossbow submit matlab


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #51610:
URL: https://github.com/apache/arrow/pull/51610#discussion_r4131097975


##########
dev/release/verify-release-candidate.bat:
##########
@@ -84,8 +84,9 @@ set PATH=%INSTALL_DIR%\bin;%PATH%
 mkdir !ARROW_SOURCE!\cpp\build
 pushd !ARROW_SOURCE!\cpp\build
 
-@rem This is the path for Visual Studio Community 2017
-call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
+@REM Setup MSVC environment. Find the Visual Studio Path first.
+for /f "usebackq delims=" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath`) do set "VS_INSTALL_PATH=%%i"
+call "%VS_INSTALL_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x64 || exit /B 1

Review Comment:
   This now selects the latest Visual Studio instance, but this script still configures CMake with `Visual Studio 17 2022` (see `GENERATOR` above). On the VS2026-only Windows image that motivated this change, `vcvarsall.bat` can succeed while CMake still fails because the VS17 generator is unavailable; please select a generator matching the discovered instance or constrain `vswhere` to a VS2022 installation for this script.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou commented on code in PR #51610:
URL: https://github.com/apache/arrow/pull/51610#discussion_r4127214240


##########
.github/workflows/cpp_windows.yml:
##########
@@ -115,12 +115,17 @@ jobs:
         with:
           path: ${{ steps.ccache-info.outputs.cache-dir }}
           key: cpp-ccache-windows-${{ inputs.arch }}
+      - name: Find Visual Studio
+        shell: bash
+        run: |
+          vs_path=$("/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -latest -property installationPath)
+          echo "VS_INSTALL_PATH=${vs_path}" >> "${GITHUB_ENV}"

Review Comment:
   We may be able to simplify this:
   
   ```suggestion
           shell: pwsh
           run: |
             "VS_INSTALL_PATH=$(vswhere -latest -property installationPath)" >> $env:GITHUB_ENV
   ```



##########
.github/workflows/cpp_windows.yml:
##########
@@ -115,12 +115,17 @@ jobs:
         with:
           path: ${{ steps.ccache-info.outputs.cache-dir }}
           key: cpp-ccache-windows-${{ inputs.arch }}
+      - name: Find Visual Studio
+        shell: bash
+        run: |
+          vs_path=$("/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -latest -property installationPath)
+          echo "VS_INSTALL_PATH=${vs_path}" >> "${GITHUB_ENV}"
       - name: Build
         shell: cmd
         env:
           VCVARS_ARCH: ${{ inputs.arch }}
         run: |
-          call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %VCVARS_ARCH%

Review Comment:
   Let's do it!
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #51610:
URL: https://github.com/apache/arrow/pull/51610#issuecomment-5867359561

   :warning: GitHub issue #51494 **has been automatically assigned in GitHub** to PR creator.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

Posted by "raulcd (via GitHub)" <gi...@apache.org>.
raulcd commented on code in PR #51610:
URL: https://github.com/apache/arrow/pull/51610#discussion_r4121355392


##########
.github/workflows/cpp_windows.yml:
##########
@@ -115,12 +115,17 @@ jobs:
         with:
           path: ${{ steps.ccache-info.outputs.cache-dir }}
           key: cpp-ccache-windows-${{ inputs.arch }}
+      - name: Find Visual Studio
+        shell: bash
+        run: |
+          vs_path=$("/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -latest -property installationPath)
+          echo "VS_INSTALL_PATH=${vs_path}" >> "${GITHUB_ENV}"

Review Comment:
   Not true, checked the logs:
   ```
   **********************************************************************
   ** Visual Studio 2026 Developer Command Prompt v18.10.1
   ** Copyright (c) 2026 Microsoft Corporation
   **********************************************************************
   [vcvarsall.bat] Environment initialized for: 'arm64'
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

Posted by "raulcd (via GitHub)" <gi...@apache.org>.
raulcd commented on code in PR #51610:
URL: https://github.com/apache/arrow/pull/51610#discussion_r4131866776


##########
dev/release/verify-release-candidate.bat:
##########
@@ -84,8 +84,9 @@ set PATH=%INSTALL_DIR%\bin;%PATH%
 mkdir !ARROW_SOURCE!\cpp\build
 pushd !ARROW_SOURCE!\cpp\build
 
-@rem This is the path for Visual Studio Community 2017
-call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
+@REM Setup MSVC environment. Find the Visual Studio Path first.
+for /f "usebackq delims=" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath`) do set "VS_INSTALL_PATH=%%i"
+call "%VS_INSTALL_PATH%\VC\Auxiliary\Build\vcvarsall.bat" x64 || exit /B 1

Review Comment:
   The Visual Studio 17 2022 generator is hardcoded independently of this change.
   What is proposing would have already failed so I'd rather keep it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

Posted by "pitrou (via GitHub)" <gi...@apache.org>.
pitrou commented on code in PR #51610:
URL: https://github.com/apache/arrow/pull/51610#discussion_r4122519083


##########
.github/workflows/cpp_windows.yml:
##########
@@ -115,12 +115,17 @@ jobs:
         with:
           path: ${{ steps.ccache-info.outputs.cache-dir }}
           key: cpp-ccache-windows-${{ inputs.arch }}
+      - name: Find Visual Studio
+        shell: bash
+        run: |
+          vs_path=$("/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -latest -property installationPath)
+          echo "VS_INSTALL_PATH=${vs_path}" >> "${GITHUB_ENV}"
       - name: Build
         shell: cmd
         env:
           VCVARS_ARCH: ${{ inputs.arch }}
         run: |
-          call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %VCVARS_ARCH%

Review Comment:
   I think this approach is neat as well. It's annoying to have to maintain those hard-coded, complicated, version-specific paths.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

Posted by "raulcd (via GitHub)" <gi...@apache.org>.
raulcd commented on code in PR #51610:
URL: https://github.com/apache/arrow/pull/51610#discussion_r4121286130


##########
.github/workflows/cpp_windows.yml:
##########
@@ -115,12 +115,17 @@ jobs:
         with:
           path: ${{ steps.ccache-info.outputs.cache-dir }}
           key: cpp-ccache-windows-${{ inputs.arch }}
+      - name: Find Visual Studio
+        shell: bash
+        run: |
+          vs_path=$("/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -latest -property installationPath)
+          echo "VS_INSTALL_PATH=${vs_path}" >> "${GITHUB_ENV}"
       - name: Build
         shell: cmd
         env:
           VCVARS_ARCH: ${{ inputs.arch }}
         run: |
-          call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %VCVARS_ARCH%

Review Comment:
   @kou there are 13 other places where we are hardcoding this path (`C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\`). Those seem all to use the `windows-2022` GitHub runner but we probably should update them too. If we are happy with the approach I can change them to use `vswhere` to detect the path.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #51610:
URL: https://github.com/apache/arrow/pull/51610#discussion_r4121306338


##########
.github/workflows/cpp_windows.yml:
##########
@@ -115,12 +115,17 @@ jobs:
         with:
           path: ${{ steps.ccache-info.outputs.cache-dir }}
           key: cpp-ccache-windows-${{ inputs.arch }}
+      - name: Find Visual Studio
+        shell: bash
+        run: |
+          vs_path=$("/c/Program Files (x86)/Microsoft Visual Studio/Installer/vswhere.exe" -latest -property installationPath)
+          echo "VS_INSTALL_PATH=${vs_path}" >> "${GITHUB_ENV}"

Review Comment:
   The ARM caller still passes `os: windows-11-arm`, but the linked runner-image announcement identifies `windows-11-vs2026-arm` as the image containing Visual Studio and lists Visual Studio as unavailable on the plain Windows 11 Arm64 image. On the current caller, `vswhere` will therefore be absent or return no installation, leaving `VS_INSTALL_PATH` empty and causing the subsequent `vcvarsall.bat` call to fail; please switch the ARM caller to a VS-equipped runner (or provision VS) as part of this fix.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #51610:
URL: https://github.com/apache/arrow/pull/51610#issuecomment-5888300767

   Revision: 5480dde8b00ac50070e079a04988d67b5a701dc9
   
   Submitted crossbow builds: [ursacomputing/crossbow @ actions-ca8792eab0](https://github.com/ursacomputing/crossbow/branches/all?query=actions-ca8792eab0)
   
   |Task|Status|
   |----|------|
   |matlab|[![GitHub Actions](https://github.com/ursacomputing/crossbow/actions/workflows/crossbow.yml/badge.svg?branch=actions-ca8792eab0-github-matlab)](https://github.com/ursacomputing/crossbow/actions/runs/36555137156/job/109362362522)|


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] GH-51494: [CI][C++] Detect Visual Studio installed path instead of hardcoding it [arrow]

Posted by "kou (via GitHub)" <gi...@apache.org>.
kou merged PR #51610:
URL: https://github.com/apache/arrow/pull/51610


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org