Skip to content

Instantly share code, notes, and snippets.

@SamuXarick
Last active August 31, 2023 09:51
Show Gist options
  • Save SamuXarick/b76f6bc159973752a40c9404916b6161 to your computer and use it in GitHub Desktop.
Save SamuXarick/b76f6bc159973752a40c9404916b6161 to your computer and use it in GitHub Desktop.
Error building OpenTTD on Visual Studio
1> CMake generation started for configuration: 'x64-Release'.
1> Found and using vcpkg toolchain file (D:/OpenTTD/vcpkg/scripts/buildsystems/vcpkg.cmake).
1> Command line: "C:\WINDOWS\system32\cmd.exe" /c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX:PATH="D:\OpenTTD\OpenTTD GitHub\OpenTTD\out\install\x64-Release" -DVCPKG_TARGET_TRIPLET:STRING="x64-windows-static" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" -DCMAKE_TOOLCHAIN_FILE="D:/OpenTTD/vcpkg/scripts/buildsystems/vcpkg.cmake" "D:\OpenTTD\OpenTTD GitHub\OpenTTD" 2>&1"
1> Working directory: D:\OpenTTD\OpenTTD GitHub\OpenTTD\out\build\x64-Release
1> [CMake] CMake Error at D:/OpenTTD/vcpkg/scripts/buildsystems/vcpkg.cmake:852 (_find_package):
1> [CMake] By not providing "Findnlohmann_json.cmake" in CMAKE_MODULE_PATH this
1> [CMake] project has asked CMake to find a package configuration file provided by
1> [CMake] "nlohmann_json", but CMake did not find one.
1> [CMake]
1> [CMake] Could not find a package configuration file provided by "nlohmann_json"
1> [CMake] with any of the following names:
1> [CMake]
1> [CMake] nlohmann_jsonConfig.cmake
1> [CMake] nlohmann_json-config.cmake
1> [CMake]
1> [CMake] Add the installation prefix of "nlohmann_json" to CMAKE_PREFIX_PATH or set
1> [CMake] "nlohmann_json_DIR" to a directory containing one of the above files. If
1> [CMake] "nlohmann_json" provides a separate development package or SDK, be sure it
1> [CMake] has been installed.
1> [CMake] Call Stack (most recent call first):
1> [CMake] CMakeLists.txt:123 (find_package)
1> [CMake] -- Configuring incomplete, errors occurred!
1> 'C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX:PATH="D:\OpenTTD\OpenTTD GitHub\OpenTTD\out\install\x64-Release" -DVCPKG_TARGET_TRIPLET:STRING="x64-windows-static" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" -DCMAKE_TOOLCHAIN_FILE="D:/OpenTTD/vcpkg/scripts/buildsystems/vcpkg.cmake" "D:\OpenTTD\OpenTTD GitHub\OpenTTD" 2>&1"' execution failed with error: ''C:\WINDOWS\system32\cmd.exe' '/c "%SYSTEMROOT%\System32\chcp.com 65001 >NUL && "C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\CMake\bin\cmake.exe" -G "Ninja" -DCMAKE_BUILD_TYPE:STRING="RelWithDebInfo" -DCMAKE_INSTALL_PREFIX:PATH="D:\OpenTTD\OpenTTD GitHub\OpenTTD\out\install\x64-Release" -DVCPKG_TARGET_TRIPLET:STRING="x64-windows-static" -DCMAKE_CXX_COMPILER:FILEPATH="C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.37.32822/bin/Hostx64/x64/cl.exe" -DCMAKE_MAKE_PROGRAM="C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\2022\COMMUNITY\COMMON7\IDE\COMMONEXTENSIONS\MICROSOFT\CMAKE\Ninja\ninja.exe" -DCMAKE_TOOLCHAIN_FILE="D:/OpenTTD/vcpkg/scripts/buildsystems/vcpkg.cmake" "D:\OpenTTD\OpenTTD GitHub\OpenTTD" 2>&1"' returned with exit code: 1'.
D:\OpenTTD\vcpkg>vcpkg install nlohmann-json
warning: Starting with the September 2023 release, the default triplet for vcpkg libraries will change from x86-windows to the detected host triplet (x64-windows). To resolve this message, add --triplet x86-windows to keep the same behavior.
Computing installation plan...
A suitable version of cmake was not found (required v3.27.1) Downloading portable cmake 3.27.1...
Downloading cmake...
https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip->D:\OpenTTD\vcpkg\downloads\cmake-3.27.1-windows-i386.zip
Downloading https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-windows-i386.zip
Extracting cmake...
The following packages will be built and installed:
nlohmann-json:x86-windows -> 3.11.2
* vcpkg-cmake:x64-windows -> 2023-05-04
* vcpkg-cmake-config:x64-windows -> 2022-02-06#1
Additional packages (*) will be modified to complete this operation.
Detecting compiler hash for triplet x64-windows...
A suitable version of powershell-core was not found (required v7.2.11) Downloading portable powershell-core 7.2.11...
Downloading powershell-core...
https://github.com/PowerShell/PowerShell/releases/download/v7.2.11/PowerShell-7.2.11-win-x86.zip->D:\OpenTTD\vcpkg\downloads\PowerShell-7.2.11-win-x86.zip
Downloading https://github.com/PowerShell/PowerShell/releases/download/v7.2.11/PowerShell-7.2.11-win-x86.zip
Extracting powershell-core...
Detecting compiler hash for triplet x86-windows...
A suitable version of 7zip was not found (required v23.1.0) Downloading portable 7zip 23.1.0...
Downloading 7zip...
https://www.7-zip.org/a/7z2301-extra.7z->D:\OpenTTD\vcpkg\downloads\7z2301-extra.7z
Downloading https://www.7-zip.org/a/7z2301-extra.7z
Extracting 7zip...
Restored 0 package(s) from C:\Users\Ricardo Soares\AppData\Local\vcpkg\archives in 115 us. Use --debug to see more details.
Installing 1/3 vcpkg-cmake:x64-windows...
Building vcpkg-cmake:x64-windows...
-- Installing: D:/OpenTTD/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_configure.cmake
-- Installing: D:/OpenTTD/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake
-- Installing: D:/OpenTTD/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake
-- Installing: D:/OpenTTD/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/vcpkg-port-config.cmake
-- Installing: D:/OpenTTD/vcpkg/packages/vcpkg-cmake_x64-windows/share/vcpkg-cmake/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 52.4 ms.
Elapsed time to handle vcpkg-cmake:x64-windows: 162 ms
Installing 2/3 vcpkg-cmake-config:x64-windows...
Building vcpkg-cmake-config:x64-windows...
-- Installing: D:/OpenTTD/vcpkg/packages/vcpkg-cmake-config_x64-windows/share/vcpkg-cmake-config/vcpkg_cmake_config_fixup.cmake
-- Installing: D:/OpenTTD/vcpkg/packages/vcpkg-cmake-config_x64-windows/share/vcpkg-cmake-config/vcpkg-port-config.cmake
-- Installing: D:/OpenTTD/vcpkg/packages/vcpkg-cmake-config_x64-windows/share/vcpkg-cmake-config/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 27.4 ms.
Elapsed time to handle vcpkg-cmake-config:x64-windows: 69.1 ms
Installing 3/3 nlohmann-json:x86-windows...
Building nlohmann-json:x86-windows...
-- Downloading https://github.com/nlohmann/json/archive/v3.11.2.tar.gz -> nlohmann-json-v3.11.2.tar.gz...
-- Extracting source D:/OpenTTD/vcpkg/downloads/nlohmann-json-v3.11.2.tar.gz
-- Using source at D:/OpenTTD/vcpkg/buildtrees/nlohmann-json/src/v3.11.2-efdad4750e.clean
-- Found external ninja('1.11.0').
-- Configuring x86-windows
-- Building x86-windows-dbg
-- Building x86-windows-rel
-- Fixing pkgconfig file: D:/OpenTTD/vcpkg/packages/nlohmann-json_x86-windows/share/pkgconfig/nlohmann_json.pc
-- Downloading https://mirror.msys2.org/mingw/mingw32/mingw-w64-i686-pkgconf-1~1.8.0-2-any.pkg.tar.zst;https://repo.msys2.org/mingw/mingw32/mingw-w64-i686-pkgconf-1~1.8.0-2-any.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/mingw/mingw32/mingw-w64-i686-pkgconf-1~1.8.0-2-any.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/mingw/mingw32/mingw-w64-i686-pkgconf-1~1.8.0-2-any.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/mingw/mingw32/mingw-w64-i686-pkgconf-1~1.8.0-2-any.pkg.tar.zst;https://mirror.selfnet.de/msys2/mingw/mingw32/mingw-w64-i686-pkgconf-1~1.8.0-2-any.pkg.tar.zst -> mingw-w64-i686-pkgconf-1~1.8.0-2-any.pkg.tar.zst...
-- Downloading https://mirror.msys2.org/msys/x86_64/msys2-runtime-3.4.6-1-x86_64.pkg.tar.zst;https://repo.msys2.org/msys/x86_64/msys2-runtime-3.4.6-1-x86_64.pkg.tar.zst;https://mirror.yandex.ru/mirrors/msys2/msys/x86_64/msys2-runtime-3.4.6-1-x86_64.pkg.tar.zst;https://mirrors.tuna.tsinghua.edu.cn/msys2/msys/x86_64/msys2-runtime-3.4.6-1-x86_64.pkg.tar.zst;https://mirrors.ustc.edu.cn/msys2/msys/x86_64/msys2-runtime-3.4.6-1-x86_64.pkg.tar.zst;https://mirror.selfnet.de/msys2/msys/x86_64/msys2-runtime-3.4.6-1-x86_64.pkg.tar.zst -> msys2-msys2-runtime-3.4.6-1-x86_64.pkg.tar.zst...
-- Using msys root at D:/OpenTTD/vcpkg/downloads/tools/msys2/6f3fa1a12ef85a6f
-- Fixing pkgconfig file: D:/OpenTTD/vcpkg/packages/nlohmann-json_x86-windows/debug/share/pkgconfig/nlohmann_json.pc
-- Installing: D:/OpenTTD/vcpkg/packages/nlohmann-json_x86-windows/share/nlohmann-json/copyright
-- Performing post-build validation
Stored binaries in 1 destinations in 50.1 ms.
Elapsed time to handle nlohmann-json:x86-windows: 7.2 s
Total install time: 7.4 s
The package nlohmann-json provides CMake targets:
find_package(nlohmann_json CONFIG REQUIRED)
target_link_libraries(main PRIVATE nlohmann_json::nlohmann_json)
The package nlohmann-json can be configured to not provide implicit conversions via a custom triplet file:
set(nlohmann-json_IMPLICIT_CONVERSIONS OFF)
For more information, see the docs here:
https://json.nlohmann.me/api/macros/json_use_implicit_conversions/
D:\OpenTTD\vcpkg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment