Building the third party libraries. 'patch' is not recognized as an internal or external command

I have downloaded the source: GitHub - rdb/panda3d-thirdparty: Scripts to build the thirdparty packages for Panda3D

I changed CMakeLists.txt:

if(CMAKE_GENERATOR MATCHES "Ninja")
#  if(MSVC_TOOLSET_VERSION)
#    math(EXPR VCVER "${MSVC_TOOLSET_VERSION} / 10" OUTPUT_FORMAT DECIMAL)
#  elseif(NOT (MSVC_VERSION LESS 1900))
#    set(VCVER 14)
#  else()
#    string(REPLACE " " ";" WORDS ${CMAKE_GENERATOR})
#    list(GET WORDS 2 VCVER)
#  endif()

  set(THIRDPARTY_DIR ${CMAKE_SOURCE_DIR}/win-libs-vc${VCVER})

#  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
#    set(THIRDPARTY_DIR "${THIRDPARTY_DIR}-x64")
#  endif()

else()
  message(FATAL_ERROR "Unknown platform.")
endif()

Configuration is without errors:

mkdir dist
cd dist
cmake -GNinja ..

Output:

-- Configuring done (8.7s)
-- Generating done (0.4s)
-- Build files have been written to: C:/Users/8Observer8/Downloads/panda3d-thirdparty-main/dist

Building:

cmake --build . --config Release --target bullet

Output:

[2/9] Performing download step (git clone) for 'bullet'
Cloning into 'bullet'...
HEAD is now at 2fb92bc40 Merge pull request #557 from erwincoumans/master
[4/9] Performing patch step for 'bullet'
FAILED: bullet-prefix/src/bullet-stamp/bullet-patch C:/Users/8Observer8/Downloads/panda3d-thirdparty-main/dist/bullet-prefix/src/bullet-stamp/bullet-patch
cmd.exe /C "cd /D C:\Users\8Observer8\Downloads\panda3d-thirdparty-main\dist\bullet-prefix\src\bullet && patch -p1 < C:/Users/8Observer8/Downloads/panda3d-thirdparty-main/patches/bullet-btvector3-shuffle.patch && C:\Qt\Tools\CMake_64\bin\cmake.exe -E touch C:/Users/8Observer8/Downloads/panda3d-thirdparty-main/dist/bullet-prefix/src/bullet-stamp/bullet-patch"
'patch' is not recognized as an internal or external command,
operable program or batch file.
ninja: build stopped: subcommand failed.

What does this error mean: 'patch' is not recognized as an internal or external command

I have tried to use -G "NMake Makefiles" instead of -GNinja but I have the same error. My steps:

mkdir dist
cd dist
cmake -G "NMake Makefiles" ..
cmake --build . --config Release --target bullet

Output:

[ 25%] Creating directories for 'bullet'
[ 50%] Performing download step (git clone) for 'bullet'
Cloning into 'bullet'...
HEAD is now at 2fb92bc40 Merge pull request #557 from erwincoumans/master
[ 75%] Performing update step for 'bullet'
[ 75%] Performing patch step for 'bullet'
'patch' is not recognized as an internal or external command,
operable program or batch file.
NMAKE : fatal error U1077: 'patch -p1 < C:/Users/8Observer8/Downloads/panda3d-thirdparty-main/patches/bullet-btvector3-shuffle.patch' : return code '0x1'
Stop.
NMAKE : fatal error U1077: 'C:\msvc\msvc\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64\nmake.exe -s -f CMakeFiles\bullet.dir\build.make /nologo -SL                 CMakeFiles\bullet.dir\build' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'C:\msvc\msvc\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64\nmake.exe -s -f CMakeFiles\Makefile2 /nologo -SL                 CMakeFiles\bullet.dir\all' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'C:\msvc\msvc\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64\nmake.exe -s -f CMakeFiles\Makefile2 /nologo -LS                 bullet' : return code '0x2'
Stop.

I have installed Patch for Windows But the installation just stopped:

image

image

I have added this path to Path:
image

How to solve these errors:

>cmake --build . --config Release --target bullet
[ 25%] Creating directories for 'bullet'
[ 50%] Performing download step (git clone) for 'bullet'
Cloning into 'bullet'...
HEAD is now at 2fb92bc40 Merge pull request #557 from erwincoumans/master
[ 75%] Performing update step for 'bullet'
[ 75%] Performing patch step for 'bullet'
patching file src/LinearMath/btVector3.h
Assertion failed: hunk, file ../patch-2.5.9-src/patch.c, line 354
NMAKE : fatal error U1077: 'patch -p1 < C:/Users/8Observer8/Downloads/panda3d-thirdparty-main/patches/bullet-btvector3-shuffle.patch' : return code '0x3'
Stop.
NMAKE : fatal error U1077: 'C:\msvc\msvc\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64\nmake.exe -s -f CMakeFiles\bullet.dir\build.make /nologo -SL                 CMakeFiles\bullet.dir\build' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'C:\msvc\msvc\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64\nmake.exe -s -f CMakeFiles\Makefile2 /nologo -SL                 CMakeFiles\bullet.dir\all' : return code '0x2'
Stop.
NMAKE : fatal error U1077: 'C:\msvc\msvc\VC\Tools\MSVC\14.41.34120\bin\Hostx64\x64\nmake.exe -s -f CMakeFiles\Makefile2 /nologo -LS                 bullet' : return code '0x2'
Stop.

This belongs as an issue on the repository in question.

Note that rather than building it yourself you could also just grab the artifacts from the latest Actions build on the repository.

1 Like

How to download artifacts? There are no download buttons there:
image

Please, add support for Ninja and/or NMake because I don’t have Visual Studio. It is too much for my laptop to install Desktop development with C++ - it requires 6.75 GB:

image

image

image

I found this way Download MSVC compiler/linker & Windows SDK without installing full Visual Studio It requires ~1 GB.