TrenchBroom / TrenchBroom

Cross-Platform Level Editor
kristianduske.com/trenchbroom
GNU General Public License v3.0
1.88k stars 224 forks source link

Can't build on Windows #4468

Open iOrange opened 4 months ago

iOrange commented 4 months ago

System Information

TrenchBroom right from the repo on Windows 11

Expected Behavior

should build

Steps to Reproduce

Clone the repo, make a build folder inside, go to it, run cmake .. -G "Visual Studio 16 2019" -T v142 -A x64 -DCMAKE_PREFIX_PATH="d:\Qt\5.15.2\msvc2019_64"

it'll download and build bunch of libraries until it errors:

Installing 28/38 jasper:x64-windows...
Building jasper[core,default-features,opengl]:x64-windows...
-- Installing port from location: D:\GudronDev\TrenchBroom_src\vcpkg\buildtrees\versioning_\versions\jasper\d7f51c26899ba9433a5a3ab92fc5b5887d5c764c
-- Downloading https://github.com/jasper-software/jasper/archive/402d096b39f4f618ad9e6ff2b4fc1b5eb260a2e4.tar.gz -> jasper-software-jasper-402d096b39f4f618ad9e6ff2b4fc1b5eb260a2e4.tar.gz...
-- Extracting source D:/GudronDev/TrenchBroom_src/vcpkg/downloads/jasper-software-jasper-402d096b39f4f618ad9e6ff2b4fc1b5eb260a2e4.tar.gz
-- Applying patch no_stdc_check.patch
-- Applying patch fix-library-name.patch
-- Using source at D:/GudronDev/TrenchBroom_src/vcpkg/buildtrees/jasper/src/5eb260a2e4-ca02e25be6.clean
-- Found external ninja('1.11.0').
-- Configuring x64-windows
-- Building x64-windows-dbg
CMake Error at scripts/cmake/vcpkg_execute_build_process.cmake:134 (message):
    Command failed: "C:/Program Files/CMake/bin/cmake.exe" --build . --config Debug --target install -- -v -j25
    Working Directory: D:/GudronDev/TrenchBroom_src/vcpkg/buildtrees/jasper/x64-windows-dbg
    See logs for more information:
      D:\GudronDev\TrenchBroom_src\vcpkg\buildtrees\jasper\install-x64-windows-dbg-out.log

Call Stack (most recent call first):
  D:/GudronDev/TrenchBroom_src/build/vcpkg_installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_build.cmake:74 (vcpkg_execute_build_process)
  D:/GudronDev/TrenchBroom_src/build/vcpkg_installed/x64-windows/share/vcpkg-cmake/vcpkg_cmake_install.cmake:16 (vcpkg_cmake_build)
  buildtrees/versioning_/versions/jasper/d7f51c26899ba9433a5a3ab92fc5b5887d5c764c/portfile.cmake:38 (vcpkg_cmake_install)
  scripts/ports.cmake:168 (include)

error: building jasper:x64-windows failed with: BUILD_FAILED
Elapsed time to handle jasper:x64-windows: 10 s
Please ensure you're using the latest port files with `git pull` and `vcpkg update`.
Then check for known issues at:
  https://github.com/microsoft/vcpkg/issues?q=is%3Aissue+is%3Aopen+in%3Atitle+jasper
You can submit a new issue at:
  https://github.com/microsoft/vcpkg/issues/new?title=[jasper]+Build+error&body=Copy+issue+body+from+D%3A%2FGudronDev%2FTrenchBroom_src%2Fbuild%2Fvcpkg_installed%2Fvcpkg%2Fissue_body.md

-- Running vcpkg install - failed
CMake Error at vcpkg/scripts/buildsystems/vcpkg.cmake:899 (message):
  vcpkg install failed.  See logs for more information:
  D:\GudronDev\TrenchBroom_src\build\vcpkg-manifest-install.log
Call Stack (most recent call first):
  C:/Program Files/CMake/share/cmake-3.28/Modules/CMakeDetermineSystem.cmake:170 (include)
  CMakeLists.txt:37 (project)

-- Configuring incomplete, errors occurred!

I wanted to debug to see why my dds textures won't show in the textures browser (they're shown as black square), but can't even build the TrenchBroom.

kduske commented 4 months ago

Could be this issue: https://github.com/microsoft/vcpkg/issues/36103

You could try to update vcpkg and use the latest version of jasper.

iOrange commented 4 months ago

Thanks for the info. I'm not familiar with the vcpkg, but I'll try to dig thanks.

noodlecollie commented 4 months ago

For anyone needing to do this, the method that worked for me was to add the following:

CMakeLists.txt, line 22:

# This should be removed once jasper is fixed.
# See https://github.com/microsoft/vcpkg/issues/36103#issuecomment-1888423591
# It requires MSVC 14.37.32822, which can be installed for VS 2022 by
# going to "Individual Components", finding "Compiler, build tools, and runtimes",
# and selecting "MSVC v143 - VS 2022 C++ x64/x86 build tools (v14.37-17.7)(Out of support)"
set(VCPKG_OVERLAY_TRIPLETS "${CMAKE_SOURCE_DIR}/vcpkg-overlay-triplets")

vcpkg-overlay-triplets/x64-windows-static.cmake:

set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_PLATFORM_TOOLSET_VERSION "14.37.32822")

vcpkg-overlay-triplets/x64-windows.cmake:

set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_PLATFORM_TOOLSET_VERSION "14.37.32822")
kduske commented 4 months ago

Has anyone tried updating to the latest vcpkg / jasper instead?

noodlecollie commented 4 months ago

I did a git pull origin master in the vcpkg directory, but that didn't change anything. I'm assuming the jasper configuration is managed by vcpkg itself?

kduske commented 4 months ago

No, you would have to change the baseline and the jasper minimal version in vcpkg.json.

kduske commented 4 months ago

See this commit for an example.