View Issue Details

IDProjectCategoryView StatusLast Update
0004411Slicer4Core: Building (CMake, Superbuild)public2018-03-02 11:01
Reporterlassoan Assigned Tojcfr  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product VersionSlicer 4.7.0 
Target VersionSlicer 4.7.0Fixed in VersionSlicer 4.7.0 
Summary0004411: Slicer build on Windows fails due to patch tool not not found
Description

For profiling (improve performance) Slicer has to be build in RelWithDebInfo mode. However, building of latest trunk version in RelWithDebInfo fails on Windows.

It turned out that release mode build failed, too, so it is not related to build mode. Something has changed in the build system that fails now, due to patch.exe application not found.

TagsNo tags attached.

Activities

lassoan

lassoan

2017-08-10 13:45

developer   ~0015035

Last edited: 2017-08-10 13:45

View 2 revisions

Build log:

<pre>
...

No patch step for 'python'

Performing configure step for 'python'

loading initial cache file C:/D/S4RD/python-prefix/tmp/python-cache-RelWithDebInfo.cmake

-- The C compiler identification is MSVC 18.0.40629.0

-- The ASM compiler identification is MSVC

-- Found assembler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe

-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe

-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/bin/x86_amd64/cl.exe -- works

-- Detecting C compiler ABI info

-- Detecting C compiler ABI info - done

CUSTOMBUILD : -- warning : Did not find file Compiler/MSVC-ASM [C:\D\S4RD\python.vcxproj]

-- Looking for CMake command configure_package_config_file

-- Looking for CMake command configure_package_config_file - found

-- Looking for CMake command write_basic_package_version_file

-- Looking for CMake command write_basic_package_version_file - found

-- Looking for CMake command target_compile_definitions

-- Looking for CMake command target_compile_definitions - found

-- Looking for CMake property POSITION_INDEPENDENT_CODE

-- Looking for CMake property POSITION_INDEPENDENT_CODE - found

-- SRC_DIR: C:/D/S4RD/Python-2.7.13

-- PY_VERSION: 2.7.13

CMake Error at cmake/PythonApplyPatches.cmake:13 (message):

Could NOT find patch (missing: PATCH_EXECUTABLE)

Call Stack (most recent call first):

CMakeLists.txt:258 (include)

-- Configuring incomplete, errors occurred!

See also "C:/D/S4RD/python-build/CMakeFiles/CMakeOutput.log".

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppCommon.targets(170,5): error MSB6006: "cmd.exe" exited with code 1. [C:\D\S4RD\python.vcxproj]

Done Building Project "C:\D\S4RD\python.vcxproj" (default targets) -- FAILED.

Done Building Project "C:\D\S4RD\VTKv7.vcxproj" (default targets) -- FAILED.

Done Building Project "C:\D\S4RD\ITKv4.vcxproj" (default targets) -- FAILED.

Done Building Project "C:\D\S4RD\CTK.vcxproj" (default targets) -- FAILED.

...

</pre>

jcfr

jcfr

2017-08-10 14:13

administrator   ~0015036

Thanks for the report.

Look like the issue is independent of the build type.

<pre>
CMake Error at cmake/PythonApplyPatches.cmake:13 (message):

Could NOT find patch (missing: PATCH_EXECUTABLE)

</pre>

Are you able to build in Release ?

Is the Git installed ? It should have installed patch executable. See https://git-scm.com/download/win

Otherwise here is the code looking up the "patch" executable.
See https://github.com/python-cmake-buildsystem/python-cmake-buildsystem/blob/849e5968b9f7b0e0faf4a5b5ba6e9daa0a3a9542/cmake/PythonApplyPatches.cmake#L2-L14

lassoan

lassoan

2017-08-10 14:35

developer   ~0015037

Last edited: 2017-08-10 14:36

View 2 revisions

I build using the exact same batch file, just change

...
%CTEST_EXE% -D Experimental
...

to

...
%CTEST_EXE% -D Experimental -C RelWithDebInfo
...

I test it again with Release now.

jcfr

jcfr

2017-08-10 14:40

administrator   ~0015038

Very strange.

I do not understand how it affects the code copied below.

Could you check that "patch" executable can be found in any of the directory associated with PATHS ?

What if you copy this code in test.cmake and then try to run cmake -P test.cmake

set(_x86 &quot;(x86)&quot;)  # Indirection required to avoid error related to CMP0053
find_program(PATCH_EXECUTABLE
  NAME patch
  PATHS &quot;$ENV{ProgramFiles}/Git/usr/bin&quot;
        &quot;$ENV{ProgramFiles${_x86}}/Git/usr/bin&quot;
        &quot;$ENV{ProgramFiles}/GnuWin32/bin&quot;
        &quot;$ENV{ProgramFiles${_x86}}/GnuWin32/bin&quot;
        &quot;$ENV{ProgramFiles}/Git/bin&quot;
        &quot;$ENV{ProgramFiles${_x86}}/Git/bin&quot;
  )
if(NOT PATCH_EXECUTABLE)
  message(FATAL_ERROR &quot;Could NOT find patch (missing: PATCH_EXECUTABLE)&quot;)
endif()
message(&quot;PATCH_EXECUTABLE: ${PATCH_EXECUTABLE}&quot;)
lassoan

lassoan

2017-08-10 14:47

developer   ~0015039

git is here on my PC: "C:/Users/msliv/AppData/Local/Programs/Git/usr/bin"

patch is not found using the code snippet you referred to

jcfr

jcfr

2017-08-10 14:55

administrator   ~0015040

Thanks for checking.

This probably means that building Slicer on this same machine using one of these would fail:

%CTEST_EXE% -D Experimental
%CTEST_EXE% -D Experimental -C RelWithDebInfo

That said, could you try with the following snippet:

set(_x86 &quot;(x86)&quot;)  # Indirection required to avoid error related to CMP0053
find_program(PATCH_EXECUTABLE
  NAME patch
  PATHS &quot;$ENV{ProgramFiles}/Git/usr/bin&quot;
        &quot;$ENV{ProgramFiles${_x86}}/Git/usr/bin&quot;
        &quot;$ENV{ProgramFiles}/GnuWin32/bin&quot;
        &quot;$ENV{ProgramFiles${_x86}}/GnuWin32/bin&quot;
        &quot;$ENV{ProgramFiles}/Git/bin&quot;
        &quot;$ENV{ProgramFiles${_x86}}/Git/bin&quot;
        &quot;$ENV{LOCALAPPDATA}/Programs/Git/bin&quot;
        &quot;$ENV{LOCALAPPDATA}/Programs/Git/usr/bin&quot;
        &quot;$ENV{APPDATA}/Programs/Git/bin&quot;
        &quot;$ENV{APPDATA}/Programs/Git/usr/bin&quot;
  )
if(NOT PATCH_EXECUTABLE)
  message(FATAL_ERROR &quot;Could NOT find patch (missing: PATCH_EXECUTABLE)&quot;)
endif()
message(&quot;PATCH_EXECUTABLE: ${PATCH_EXECUTABLE}&quot;)
lassoan

lassoan

2017-08-10 18:05

developer   ~0015042

Release build has the same errors. This is a recent regression (although I'm not sure when I did a completely clean build) because the exact same script worked a couple of weeks or maybe 1-2 months ago.

Is requirement of patch tool is new? Do we need to really use it (cannot we just use CMake string replacement features)?

"$ENV{APPDATA}/Programs/Git/usr/bin" would probably work many times, but it would be better to find a more reliable solution than just improving the heuristics. Maybe we could deduce it from git.exe path (but that would be heuristics, too)? Or have a way of explicitly providing a patch.exe path? Or require patch.exe to be in one of the directories of PATH environment variable?

jcfr

jcfr

2017-08-10 18:15

administrator   ~0015043

Is requirement of patch tool is new?

Patch is indeed a new requirement. It is part of the patch management system integrated in python-cmake-buildsystem.
See https://github.com/python-cmake-buildsystem/python-cmake-buildsystem/tree/master/patches

Using replace string is simply not feasible or practical and would add a lot of overhead to get right.

find a more reliable solution than just improving the heuristics

Agreed. The time being I suggest we move forward with that approach.

Do you confirm my last snippet worked ?

could deduce it from git.exe path

An additional hint could indeed be provided based on the location of Git executable...
For reference, here is how Git is found on windows: https://github.com/Kitware/CMake/blob/14b2f85cd411ee9d7e19a28d5e2ea7958ab845ee/Modules/FindGit.cmake#L33-L64

lassoan

lassoan

2017-08-10 18:19

developer   ~0015044

Last edited: 2017-08-10 18:22

View 2 revisions

Now I'm trying a build after adding C:\Users\msliv\AppData\Local\Programs\Git\usr\bin to the path. So far there are no errors.

Instead of just improving hints (which may never be perfect and break at any time), we could try to find patch.exe in the Slicer top-level CMakeLists.txt and report the error early and allow the user to specify patch.exe location manually. Then we could pass this on to the Python build. Similarly how we do it with other tools:
<pre>
#-----------------------------------------------------------------------------

Prerequisites

#-----------------------------------------------------------------------------
find_package(Subversion)
if(NOT Subversion_FOUND)
message(FATAL_ERROR "error: Install SVN and try to re-configure")
endif()
mark_as_superbuild(Subversion_SVN_EXECUTABLE)

find_package(Git)
if(NOT GIT_FOUND)
message(FATAL_ERROR "error: Install Git and try to re-configure")
endif()
mark_as_superbuild(GIT_EXECUTABLE)
</pre>

jcfr

jcfr

2017-08-10 18:32

administrator   ~0015045

we could try to find patch.exe in the Slicer top-level CMakeLists.txt

Great idea.

I will patch python-cmake-buildsystem adding the hint as well as adding an early check in Slicer.

Look like we need a proper FindPatch.cmake in upstream cmake ... or a built-in patch function. (already discussed in the past ... but without an bsd like cross-platform implementation, nothing made its way to CMake code based)

jcfr

jcfr

2017-08-24 14:49

administrator   ~0015076

See https://github.com/python-cmake-buildsystem/python-cmake-buildsystem/pull/192

jcfr

jcfr

2017-08-24 15:47

administrator   ~0015077

Fixed integrated in r26302
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&amp;revision=26302

jcfr

jcfr

2017-08-24 17:09

administrator   ~0015078

See https://github.com/Slicer/Slicer/pull/781

jcfr

jcfr

2017-08-24 18:40

administrator   ~0015079

Fixed in r26304
See http://viewvc.slicer.org/viewvc.cgi/Slicer4?view=revision&amp;revision=26304

Issue History

Date Modified Username Field Change
2017-08-10 13:45 lassoan New Issue
2017-08-10 13:45 lassoan Status new => assigned
2017-08-10 13:45 lassoan Assigned To => jcfr
2017-08-10 13:45 lassoan Note Added: 0015035
2017-08-10 13:45 lassoan Note Edited: 0015035 View Revisions
2017-08-10 14:13 jcfr Note Added: 0015036
2017-08-10 14:35 lassoan Note Added: 0015037
2017-08-10 14:36 lassoan Note Edited: 0015037 View Revisions
2017-08-10 14:40 jcfr Note Added: 0015038
2017-08-10 14:47 lassoan Note Added: 0015039
2017-08-10 14:55 jcfr Note Added: 0015040
2017-08-10 18:05 lassoan Note Added: 0015042
2017-08-10 18:07 lassoan Summary Windows build in RelWithDebInfo mode fails => Slicer build on Windows fails due to patch tool not not found
2017-08-10 18:07 lassoan Description Updated View Revisions
2017-08-10 18:15 jcfr Note Added: 0015043
2017-08-10 18:19 lassoan Note Added: 0015044
2017-08-10 18:22 lassoan Note Edited: 0015044 View Revisions
2017-08-10 18:32 jcfr Note Added: 0015045
2017-08-24 14:49 jcfr Note Added: 0015076
2017-08-24 15:47 jcfr Note Added: 0015077
2017-08-24 17:09 jcfr Note Added: 0015078
2017-08-24 18:40 jcfr Status assigned => resolved
2017-08-24 18:40 jcfr Resolution open => fixed
2017-08-24 18:40 jcfr Fixed in Version => Slicer 4.7.0
2017-08-24 18:40 jcfr Note Added: 0015079
2018-03-02 11:01 jcfr Status resolved => closed