Page MenuHomePhabricator

Build error: Could not find git for clone of qRestAPI
Closed, ResolvedPublic

Description

When configuring and building MITK with cmake via command line, I get the following error, if I build a second time using the same build-directory that was used before for building:

cmake --build . --target ALL_BUILD --config Release
Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
Copyright (C) Microsoft Corporation. All rights reserved.

  Creating directories for 'CTK'
  Building Custom Rule D:/MITK-BSQ/src/CMakeLists.txt
  CMake does not need to re-run because D:/MITK-BSQ/build2/CMakeFiles/generate.stamp is up-to-date.
  Performing download step (download, verify and extract) for 'CTK'
  -- verifying file...
         file='D:/MITK-BSQ/build2/ep/src/CTK_kislinsk_fix-pythonlibs-handling.tar.gz'
  -- File already exists and hash match (skip download):
    file='D:/MITK-BSQ/build2/ep/src/CTK_kislinsk_fix-pythonlibs-handling.tar.gz'
    MD5='49e1652cc505bdf3f77210976df97d63'
  -- extracting...
       src='D:/MITK-BSQ/build2/ep/src/CTK_kislinsk_fix-pythonlibs-handling.tar.gz'
       dst='D:/MITK-BSQ/build2/ep/src/CTK'
  -- extracting... [tar xfz]
  -- extracting... [analysis]
  -- extracting... [rename]
  -- extracting... [clean up]
  -- extracting... done
  No update step for 'CTK'
  No patch step for 'CTK'
  Performing configure step for 'CTK'
  loading initial cache file D:/MITK-BSQ/build2/ep/tmp/CTK-cache-Release.cmake
  -- Selecting Windows SDK version 10.0.17763.0 to target Windows 10.0.10240.
  -- Generated: D:/MITK-BSQ/build2/ep/src/CTK-build/DGraphInput-alldep.txt
  CMake Error at C:/Program Files/CMake/share/cmake-3.14/Modules/ExternalProject.cmake:2427 (message):
CUSTOMBUILD : error : could not find git for clone of qRestAPI [D:\MITK-BSQ\build2\CTK.vcxproj]
  Call Stack (most recent call first):
    C:/Program Files/CMake/share/cmake-3.14/Modules/ExternalProject.cmake:3211 (_ep_add_download_command)
    CMakeExternals/qRestAPI.cmake:60 (ExternalProject_Add)
    CMake/ctkMacroCheckExternalProjectDependency.cmake:795 (include)
    CMake/ctkMacroCheckExternalProjectDependency.cmake:858 (ExternalProject_Include_Dependencies)
    CMake/ctkBlockCheckDependencies.cmake:134 (ExternalProject_Include_Dependencies)
    CMakeLists.txt:979 (include)


  -- Generated: D:/MITK-BSQ/build2/ep/src/CTK-build/DGraphInput-alldep-withext.txt
  -- Generated: D:/MITK-BSQ/build2/ep/src/CTK-build/DGraphInput.txt
  -- SuperBuild - First pass
  -- SuperBuild - First pass - done
  -- SuperBuild - Log4Qt[OPTIONAL]
  -- SuperBuild - VTK[OPTIONAL]
  -- SuperBuild - PythonQt[OPTIONAL]
  -- SuperBuild - ZMQ[OPTIONAL]
  -- SuperBuild - QtSOAP[OPTIONAL]
  -- SuperBuild - qxmlrpc[OPTIONAL]
  -- SuperBuild - OpenIGTLink[OPTIONAL]
  -- SuperBuild - ITK[OPTIONAL]
  -- SuperBuild - QtTesting[OPTIONAL]
  -- SuperBuild - CTK => Requires DCMTK, qRestAPI,
  -- SuperBuild -   DCMTK[OK]
  -- SuperBuild -   qRestAPI[OK]
  -- Configuring incomplete, errors occurred!
  See also "D:/MITK-BSQ/build2/ep/src/CTK-build/CMakeFiles/CMakeOutput.log".

This happened using Windows and Linux with CMake 3.14.5

Event Timeline

kalali triaged this task as Normal priority.Dec 5 2019, 10:08 AM
kalali created this task.

Happens with VM and Azure. Local windows works (for now).

Using my local windows I get the output message:

CUSTOMBUILD : CMake warning :  [D:\MITK-BSQ\build2\CTK.vcxproj]
    Manually-specified variables were not used by the project:

      Git_EXECUTABLE


  -- Build files have been written to: D:/MITK-BSQ/build2/ep/src/CTK-build
  Performing build step for 'CTK'
  Microsoft (R) Build Engine version 15.9.21+g9802d43bc3 for .NET Framework
  Copyright (C) Microsoft Corporation. All rights reserved.

    Checking Build System
    CMake does not need to re-run because D:/MITK-BSQ/build2/ep/src/CTK-build/CMakeFiles/generate.stamp is up-to-date.
    Creating directories for 'DCMTK'
    Building Custom Rule D:/MITK-BSQ/build2/ep/src/CTK/CMakeLists.txt
    CMake does not need to re-run because D:/MITK-BSQ/build2/ep/src/CTK-build/CMakeFiles/generate.stamp is up-to-date.
    No download step for 'DCMTK'
    No update step for 'DCMTK'
    No patch step for 'DCMTK'
    No configure step for 'DCMTK'
    No build step for 'DCMTK'
    No install step for 'DCMTK'
    Completed 'DCMTK'
    Creating directories for 'qRestAPI'
    Building Custom Rule D:/MITK-BSQ/build2/ep/src/CTK/CMakeLists.txt
    CMake does not need to re-run because D:/MITK-BSQ/build2/ep/src/CTK-build/CMakeFiles/generate.stamp is up-to-date.
    Performing download step (git clone) for 'qRestAPI'
    Cloning into 'qRestAPI'...
    Note: checking out 'ddc0cfcc220d0ccd02b4afdd699d1e780dac3fa3'.

I have the same error on my local Ubuntu VM. But only if configure via CMake command line. If I use the CMake gui and set the same values, then everything works fine.
Generator does not matter I have the problem with make and ninja; with one and multiple jobs.

Using CMake command line I get this error with my local windows, if I build it the second time.

I have managed to compile now just using cmake cli, when doing the following:

  1. Run: cmake -G "Ninja" ../source
  2. Run: cmake -DQt5_DIR:PATH=<myQt5path> -G "Ninja" ../source
  3. Run: cmake -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_TESTING:BOOL=OFF -DMITK_BUILD_CONFIGURATION:STRING=FlowBenchSegmentationRelease -G "Ninja" ../source

So emulating the cmake gui, by first doing a plain configure. Then adding Qt5. And then the rest.

Did not check so far if it can condensed to two steps. But it seems that something in our superbuild needs a rerun to be correctly configured or does not like to have all parameter set at onces.

@gaoh Could also be of interest for your compile issues ?!?

A two step build also works:

RUN cmake -DQt5_DIR:PATH=<myQt5path> ../source
RUN cmake \
  -DCMAKE_BUILD_TYPE:STRING=Release  \
  -DBUILD_TESTING:BOOL=OFF  \
  -DMITK_BUILD_CONFIGURATION:STRING=FlowBenchSegmentationRelease \
  -DCMAKE_INSTALL_PREFIX=/opt/install \
  ../source \
  && make -j"$(nproc)"

There seems to be a problem with the -DBUILD_TESTING:BOOL=OFF option.
If you use CMake-GUI the variable is ON per default when first configured and is then set to OFF (if you choose so) and re-configured.

That's why the two-step-build (three-step-build) works. The testing-variable is enabled initially and sets some configuration parameters(?).
Check if the two step build does not work if you do:

  1. cmake -DQt5_DIR:PATH=<myQt5path> -DBUILD_TESTING:BOOL=OFF -G "Ninja" ../source
  2. cmake -DCMAKE_BUILD_TYPE:STRING=Release -DMITK_BUILD_CONFIGURATION:STRING=FlowBenchSegmentationRelease -G "Ninja" ../source

When building CTK, the output writes:

Manually-specified variables were not used by the project:
[...]
Git_EXECUTABLE

This just occurred on my ubuntu dartclients. Any idea how to fix this in MITKDashboardScript.cmake?
https://cdash.mitk.org/index.php?project=MITK-Diffusion

May be completely unrelated but who knows: https://cmake.org/pipermail/cmake-developers/2015-November/027082.html

@neher Do you use OpenStack instances? Because than we have a good base line for comparison as my instances build without trouble.

Seems to be resolved by setting

"GIT_EXECUTABLE:FILEPATH=/usr/bin/git"

in MITKDashboardScript.cmake

Now I get a different error, but probably unrelated:
https://cdash.mitk.org/viewBuildError.php?buildid=7567

I noticed a few things that may be related or not but we should clean them anyway:

  • MITK has its own FindGit module but we should delete it in favor of CMake's FindGit module.
  • We work with GIT_EXECUTABLE but we pass both GIT_EXECUTABLE and Git_EXECUTABLE to CTK. CTK is using only the former one. The latter one should be removed.

I wonder how this is related to our findings from December last year.

I wonder how this is related to our findings from December last year.

Haha, an idea just hit my head like a brick. 💡 You wrote that it is somehow related to MITK_BUILD_TESTING and as I just looked into a few functions that fiddle around with git to assemble the MITK version string, I noticed that every function had its own local call to find_package(Git). That's a good hint that we do not have a global call but I bet we pass GIT_EXECUTABLE anyway to CTK even if it is empty. It "magically" somehow works when MITK_BUILD_TESTING is ON because it is the only (?) external project actually using Git instead of downloads and then the GIT_EXECUTABLE is set before it is passed to CTK.

I will double-check but I am very confident this is exactly what happens. 😃

kislinsk claimed this task.

Should be fixed now.

Deleted branch bugfix/T26897-RemoveCustomFindGitModule.