GitHub user alinaliBQ created a discussion: Fix for `Could not find PATCH using 
the following names: patch` error on Windows MSVC

I started having build problems with error `Could not find PATCH using the 
following names: patch` after the commit 
https://github.com/apache/arrow/commit/e1f727cbb447d2385949a54d8f4be2fdc6cefe29.
 I found it is because my system path doesn't have `patch.exe` on it. I wanted 
to share the fix that worked for me:

1. ensure you have `git` downloaded

2. check that `patch.exe` is inside `C:\Program Files\Git\usr\bin` on your 
machine

3. add `C:\Program Files\Git\usr\bin` to your PATH variable. 

 - I have added to both user and system PATH variable just to be safe

4. open terminal, run command `patch --version` and it should return 
successfully

5. rebuild arrow project, the build should succeed without the `Could not find 
PATCH` error

## Build error:

```
101>-- Building (vendored) mimalloc from source
101>CMake Error at cmake_modules/ThirdpartyToolchain.cmake:2292 (find_program):
101>  Could not find PATCH using the following names: patch
101>Call Stack (most recent call first):
101>  CMakeLists.txt:523 (include)
101>
101>
101>-- Configuring incomplete, errors occurred!
101>C:\Program Files\Microsoft Visual 
Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5):
 error MSB8066: Custom build for 'C:\path\to\arrow\cpp\CMakeLists.txt' exited 
with code 1.
101>Done building project "ALL_BUILD.vcxproj" -- FAILED.
```


Code that gave the error if `patch.exe` is not on your system `PATH` variable:
https://github.com/apache/arrow/blob/541cba859c3cdb4cc6cb3f456aaae79f67c7d57d/cpp/cmake_modules/ThirdpartyToolchain.cmake#L2292




GitHub link: https://github.com/apache/arrow/discussions/47829

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to