Initial Development setup failing

Hi Everyone,

I’m just starting out on setting up VCMI and can’t get a solution to build.
My setup: Windows 10 64bit with Visual Studio 2017 community
I have set up both the vcpg and vcmi folders on the root folder of my F: drive

I am following the instructions at https://wiki.vcmi.eu/How_to_build_VCMI_(Windows/Vcpkg) to set up for VS 2017 and have gotten to “Generate Solution for VCMI” with the cmake command line
"cmake …/source -DCMAKE_TOOLCHAIN_FILE=[VCPKG_DIR]/scripts/buildsystems/vcpkg.cmake -G “Visual Studio 15 2017 Win64"”

I get the error

F:\VCMI\build>cmake …/source -DCMAKE_TOOLCHAIN_FILE=[VCPKG_DIR]/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 15 2017 Win64"
CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/CMakeDetermineSystem.cmake:100 (message):
Could not find toolchain file: [VCPKG_DIR]/scripts/buildsystems/vcpkg.cmake
Call Stack (most recent call first):
CMakeLists.txt:1 (project)

– Configuring incomplete, errors occurred!

I have been working on this for a few hours now and can’t get past this point.
Does anyone know why this is happening? Any help would be much appreciated.

Thanks in advance
Alan

Hello!
You need to replace [VCPKG_DIR] with full or relative path to directory where you unpacked Vcpkg libraries package. So on my machine it’s for instance:

cmake ../source -DCMAKE_TOOLCHAIN_FILE=D:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 15 2017 Win64"

Keep in mind that ../source should be valid path to VCMI source code you cloned from git.

i just update guide on Wiki to make it less confusing.
Now all commands and paths are specified against single [VCMI_DIR] variable.

So if you stuck on something please start over. Thanks.

Thanks for the replies and update to the wiki. I’ll start again and let you know how I go.
Cheers
Alan

The updated instructions have cleared up where I was going wrong (thanks) but it appears the pre built package is missing some files as the build is failing due to some missing boost libraries.

F:\VCMI\build>cmake F:/VCMI/source -DCMAKE_TOOLCHAIN_FILE=F:/VCMI/vcpkg/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 15 2017 Win64"
-- The C compiler identification is MSVC 19.11.25507.1
-- The CXX compiler identification is MSVC 19.11.25507.1
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.11.25503/bin/HostX86/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - not found
-- Found Threads: TRUE
CMake Error at C:/Program Files/CMake/share/cmake-3.9/Modules/FindBoost.cmake:1879 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.64.0

  Boost include path: F:/VCMI/vcpkg/installed/x64-windows/include

  Could not find the following static Boost libraries:

          boost_date_time
          boost_filesystem
          boost_locale
          boost_program_options
          boost_system
          boost_thread

  Some (but not all) of the required Boost libraries were found.  You may
  need to install these additional Boost libraries.  Alternatively, set
  BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
  to the location of Boost.

Cheers
Alan

Very interesting, might be related to recent CMake or something, I’ll test it today.
Probably I should add some debug output in our CMakeLists so it’s at least report CMake version.

Ok first of all while I suppose you just used latest CMake I updated our CMakeLists slightly. Now it’s should print more debug information so it’s easier to debug problems like that.

So it’s worked fine for me and I tried:

  • Use CMake 3.9.1 since I guess you used latest
  • Rename my own directory in case it’s might fail with different name, but it’s already using different path of AppVeyor and it’s kept working for me.

This part of message is weird since our configuration explicitly disable static linking for Boost.

Did you ever built any other software using Boost on this system? Any chance you adjusted some environment variables there?

So there one of following problems occur:

  • Code that set Boost_USE_STATIC_LIBS to OFF inside CMakeLists on line 138 not executed.
  • Some other code between it and find_package(Boost on line 203 change the value of Boost_USE_STATIC_LIBS.
  • Or there some magic bug in CMake.

I want you to do two things so we can debug it. First of all:

  1. Update VCMI source to latest version so there will be more debug output.
  2. Create debug.bat file in your F:/VCMI/build directory.
  3. Put following command inside it and save file:
cmake --trace --trace-expand F:/VCMI/source -DCMAKE_TOOLCHAIN_FILE=F:/VCMI/vcpkg/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 15 2017 Win64" > cmake_log.txt 2>&1
  1. Run debug.bat by clicking on it twice and wait.
  2. Massive cmake_log.txt file will be generated.
  3. Upload it on forum, put in archive if needed.

Second thing is:

  1. Open CmakeLists.txt and find line 203 with find_package(Boost 1.48.0
  2. Above it put following line:
set(Boost_USE_STATIC_LIBS OFF)
  1. Try to generate project again.

Please come back to tell about the results.

I have not used boost before this attempting to install the VCMI package and there are no system environment variables that mention boost.

  1. I deleted and reloaded the source files.
  2. I created and ran the debug.bat file and got the following result when run.
    Running with trace output on.
    Running with expanded trace output on.
    CMake Error: The source directory “F:/VCMI/source” does not appear to contain CMakeLists.txt.
    Specify --help for usage, or press the help button on the CMake GUI.
  3. I checked and there is no CMakeLists.txt in the F:/VCMI/source root folder.

Cheers
Alan

This probably mean you cloned repository wrong way. Try to clone it again.

Thanks for the quick response
I re-cloned the repository and ran debug.bat
I have attached the compressed log file.

Cheers
Alan

cmake_log.rar (173.0 KB)

1 Like

Thanks. I’ll check the log now. Please try second instruction and see if workaround of adding set above find_package let you configure it successfully.

Log seems really wrong. Can you please check what branch you currently on?
It’s must be develop and not master.

I don’t know what you mean by what branch you mean. Can you explain a bit more please.

Problem is that SourceTree if you using it likely cloned master branch of VCMI that isn’t used for development, but for stable versions. For daily development we’re using another branch called develop and you need to switch your copy of repository to use it in order to build latest version.

So you need to:

  • Google for “SourceTree change branch” and learn how to do that.
  • Clone it again using proper command line Git and it’s will use proper branch by default.

I’ll certainly correct guide and I guess I’ll just remove that GUI tool recommendation because it’s certainly only make it harder to clone source code. E.g master is not even our default branch and standard command line git client obviously checkout develop by default.

In the CMakeLists.txt file from VCMI/source folder there are 2 lines that have find_package(Boost 1.48.0
at line 118 and line 153.CMakeLists.txt (12.4 KB)

Okay, thanks I will reload manually

It’s because you currently using one year old source code from master branch. It’s source code for release build 0.99.

You may want to leave the cmake gui instructions, just add to go to advanced options and select “develop” branch and I’m not sure but i also checked the box for recursive. I now have the correct files and will try to build.