error.external.build.failed

What happens

  • CMake fatal error with one of the messages:

    • [hunter ** FATAL ERROR **] Configure step failed (dir: ...)
    • [hunter ** FATAL ERROR **] Build step failed (dir: ...)

Explanation

  • Build of some external package failed for some reason

What to do

Fixable errors

Windows

  • “Path too long” error with message:
The specified path, file name, or both are too long.  The fully qualified
file name must be less than 260 characters, and the directory name must be
less than 248 characters.

Can be fixed by setting HUNTER_ROOT environment variable to some short path, like C:\_hunter. Alternatively you can set HUNTER_BINARY_DIR environment variable. In this case all installed packages will be kept in HUNTER_ROOT but all builds will be triggered in HUNTER_BINARY_DIR. Note that if several Hunter-ID will be send to HUNTER_BINARY_DIR they will block each other and will be build sequentially (builds in HUNTER_ROOT lock different directories so different Hunter-ID instances work in parallel). Note that the problem is about native build tool (like MSBuild) and not in CMake. CMake is already using \\?\C:\ extended-length path format (see source code).

Mac OS X

  • Runtime application error:

    Unknown class * in Interface Builder file at path *.nib
    

    Check you have next flags linked to your target:

    target_link_libraries(... "-all_load" "-ObjC")
    
  • Stackoverflow question

Reproduce and diagnose package building errors manually

Warning

This may not work always since Hunter can load extra environment variables in internal scripts.

Once you enabled HUNTER_STATUS_DEBUG, read the error output in order to find how to build the package manually and to reproduce the error. Read the output of CMake near the error:

[hunter ** FATAL ERROR **] Build step failed (dir: ~/.hunter/_Base/21f5129/d74d0a3/11f31d2/Build/PocoCpp
[hunter ** FATAL ERROR **] [Directory:~/.hunter/_Base/Download/Hunter/0.19.90/21f5129/Unpacked/cmake/projects/PocoCpp]

------------------------------ WIKI -------------------------------
    https://github.com/ruslo/hunter/wiki/error.external.build.failed
-------------------------------------------------------------------

CMake Error at ~/.hunter/_Base/Download/Hunter/0.19.90/21f5129/Unpacked/cmake/modules/hunter_wiki.cmake:12 (message):
Call Stack (most recent call first):
  ~/.hunter/_Base/Download/Hunter/0.19.90/21f5129/Unpacked/cmake/modules/hunter_fatal_error.cmake:20 (hunter_wiki)
  ...

Carefully note the directory that is given near the message “build step failed”, and build it, like shown below

# this is the directory given by the error message
cd ~/.hunter/_Base/21f5129/d74d0a3/11f31d2/Build/PocoCpp
cmake --build Build/

Then, you can diagnose more easily the cause of the error, using you standard build tools.