palaeoware / trevosim

TREvoSim - The [Tr]ee [Evo]lutionary [Sim]ulator program
GNU General Public License v3.0
4 stars 3 forks source link

Windows - building from source #15

Closed ms609 closed 1 month ago

ms609 commented 2 months ago

Thanks for the work on the installation instructions, these are now much clearer to navigate.

However, QT creator is not running as smoothly as the instructions suggest. I can load the project, but "Build all projects" is greyed out, and the debug configuration seems to be missing:

image

[cmake] Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/Users/pjjg18/GitHub/trevosim -B C:/Users/pjjg18/GitHub/trevosim/build/Desktop_x86_windows_msys_pe_64bit-Debug in C:\Users\pjjg18\GitHub\trevosim\build\Desktop_x86_windows_msys_pe_64bit-Debug.
[cmake] CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
[cmake]   Compatibility with CMake < 3.5 will be removed from a future version of
[cmake]   CMake.
[cmake] 
[cmake]   Update the VERSION argument <min> value or use a ...<max> suffix to tell
[cmake]   CMake that the project does not need compatibility with older versions.
[cmake] 
[cmake] 
[cmake] CMake Error at C:/Qt/Tools/CMake_64/share/cmake-3.27/Modules/ExternalProject.cmake:2851 (message):
[cmake]   error: could not find git for clone of GoogleTest
[cmake] Call Stack (most recent call first):
[cmake]   C:/Qt/Tools/CMake_64/share/cmake-3.27/Modules/ExternalProject.cmake:4345 (_ep_add_download_command)
[cmake]   CMakeLists.txt:5 (ExternalProject_Add)
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[cmake] ninja: error: loading 'build.ninja': The system cannot find the file specified.
[cmake] 
[cmake] 
[cmake] CMake Error at CMakeLists.txt:35 (add_subdirectory):
[cmake]   The source directory
[cmake] 
[cmake]     C:/Users/pjjg18/GitHub/trevosim/build/Desktop_x86_windows_msys_pe_64bit-Debug/googletest-src
[cmake] 
[cmake]   does not contain a CMakeLists.txt file.
[cmake] 
[cmake] 
[cmake] CMake Error at CMakeLists.txt:55 (find_package):
[cmake]   By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
[cmake]   asked CMake to find a package configuration file provided by "Qt6", but
[cmake]   CMake did not find one.
[cmake] 
[cmake]   Could not find a package configuration file provided by "Qt6" with any of
[cmake]   the following names:
[cmake] 
[cmake]     Qt6Config.cmake
[cmake]     qt6-config.cmake
[cmake] 
[cmake]   Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
[cmake]   to a directory containing one of the above files.  If "Qt6" provides a
[cmake]   separate development package or SDK, be sure it has been installed.
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[cmake] 
[cmake] The command "C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/Users/pjjg18/GitHub/trevosim -B C:/Users/pjjg18/GitHub/trevosim/build/Desktop_x86_windows_msys_pe_64bit-Debug" terminated with exit code 1.
[cmake] 
[cmake] Elapsed time: 00:00.
RussellGarwood commented 2 months ago

All props to change so far to docs go to @alanspencer, as he did all of them! I've been trying to finish off some other stuff before starting on this. Glad they have improved clarity. I will have to leave the details of this to @alanspencer who set up the windows build, as I have not tried this as yet on a windows system. However, for carity, can you confirm:

I think this might be useful to know. cmake is failing because it can't find the google testing framework, and this should pull automatically. Assuming you have git installed I wonder whether there is a permissions issue preventing that from happening. Thus:

ms609 commented 2 months ago

1/ yes, a build; portable binary launches OK 2/ I see the same message when I set "Edit build configuration: Release" 3/ git is installed (but may not be on the PATH) 4/ I built whilst on the network with internet access

ms609 commented 2 months ago

On 3/, I added git to the PATH and restarted QT Creator – the issue persists.

RussellGarwood commented 2 months ago

Thanks for this clarification @ms609 - can you also add Ninja to your path?

I caught up with @alanspencer earlier and his path has: PATH: C:\Qt\Tools\Ninja C:\Program Files\Git\cmd

We think Ninja needs to be added for CMake to find it. This has been added to the documentation

ms609 commented 2 months ago

I've added Ninja to the PATH; still no luck:

[cmake] Running C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/Users/pjjg18/GitHub/trevosim -B C:/Users/pjjg18/GitHub/trevosim/build/Desktop_x86_windows_msys_pe_64bit-Release in C:\Users\pjjg18\GitHub\trevosim\build\Desktop_x86_windows_msys_pe_64bit-Release.
[cmake] CMake Deprecation Warning at CMakeLists.txt:1 (cmake_minimum_required):
[cmake]   Compatibility with CMake < 3.5 will be removed from a future version of
[cmake]   CMake.
[cmake] 
[cmake]   Update the VERSION argument <min> value or use a ...<max> suffix to tell
[cmake]   CMake that the project does not need compatibility with older versions.
[cmake] 
[cmake] 
[cmake] -- Configuring done (0.1s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: C:/Users/pjjg18/GitHub/trevosim/build/Desktop_x86_windows_msys_pe_64bit-Release/GoogleTest
[cmake] [1/7] Performing update step for 'GoogleTest'
[cmake] [2/7] No patch step for 'GoogleTest'
[cmake] [3/7] No configure step for 'GoogleTest'
[cmake] [4/7] No build step for 'GoogleTest'
[cmake] [5/7] No install step for 'GoogleTest'
[cmake] [6/7] No test step for 'GoogleTest'
[cmake] [7/7] Completed 'GoogleTest'
[cmake] CMake Error at CMakeLists.txt:55 (find_package):
[cmake]   By not providing "FindQt6.cmake" in CMAKE_MODULE_PATH this project has
[cmake]   asked CMake to find a package configuration file provided by "Qt6", but
[cmake]   CMake did not find one.
[cmake] 
[cmake]   Could not find a package configuration file provided by "Qt6" with any of
[cmake]   the following names:
[cmake] 
[cmake]     Qt6Config.cmake
[cmake]     qt6-config.cmake
[cmake] 
[cmake]   Add the installation prefix of "Qt6" to CMAKE_PREFIX_PATH or set "Qt6_DIR"
[cmake]   to a directory containing one of the above files.  If "Qt6" provides a
[cmake]   separate development package or SDK, be sure it has been installed.
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!
[cmake] 
[cmake] The command "C:\Qt\Tools\CMake_64\bin\cmake.exe -S C:/Users/pjjg18/GitHub/trevosim -B C:/Users/pjjg18/GitHub/trevosim/build/Desktop_x86_windows_msys_pe_64bit-Release" terminated with exit code 1.
[cmake] 

[cmake] Elapsed time: 00:02.

If it helps, here's the contents of the GoogleTest folder referred to: GoogleTest.zip

I note that under "Current configuration", the Key Qt6_DIR is set to Qt6_DIR-NOTFOUND. Does this needs setting to a particular place? It's not obvious which folder within C:/Qt I should specify.

alanspencer commented 2 months ago

Hi @ms609,

Just checked my Windows QT configuration - and I never set these missing paths (as highlighted in your CMake Error at CMakeLists.txt:55 error) manually so I'm confused on why your setup is not automatically finding them - here are my CMAKE_PREFIX_PATH and Qt6_DIR paths:

CMAKE_PREFIX_PATH C:\Qt\6.6.1\msvc2019_64 Qt6_DIR C:\Qt\6.6.1\msvc2019_64\lib\cmake\Qt6

50QIsv0ySQ

These are set under the QT Creator -> Projects -> CMake section and under that the Current configuration tab.

As with your setup CMAKE_PREFIX_PATH is set to the default %{Qt:QT_INSTALL_PREFIX} under the 'Initial configuration' tab. Which should allow the rest of the configuration to be autoconfigured.

So you might first want to try the 'Reconfigure with Initial Parameters' button on the 'Initial Configuration' tab to see if this update and autofinds the missing paths.

qtcreator_n2mY1hCRgk

That should refresh and rebuild the configuration.

ms609 commented 2 months ago

Perhaps then the issue relates to my installation of QT: I don't see any corresponding folders within c:\qt:

image

alanspencer commented 2 months ago

That does look like an issue. Under mine I have these folders, where the 6.6.1 folder relates to the QT 6.x Framework installation. It might be you have somehow only installed QT Creator and not QT 6.x Framework plus QT Creator.

g0IyUy0qJA

I have gone a downloaded the latest QT installer - which has been updated a bit since I last installed my QT version. When you install QT you need to chose the Custom Installation option: DgZ4AFXrua

Then durring the select component screen check the latest stable QT 6.x.x option: tZIDqTupsH

As you already have installed QT Creator once you can also use the QT Maintenance Tool to update any missing components. From the Windows start bar search type in 'Maintenance Tool' and the QT tool should appear in the list of apps. Once open select the 'Add or remove components'. Note you may have to update the components first before it allows you to change any.

ms609 commented 2 months ago

Great! I see now that I'd misread the first bullet in the new installation instructions.

Following this instruction I saw:

[cmake] -- Configuring done (0.1s)
[cmake] -- Generating done (0.0s)
[cmake] -- Build files have been written to: C:/Users/pjjg18/GitHub/trevosim/build/Desktop_x86_windows_msys_pe_64bit-Release/GoogleTest
[cmake] [1/7] Performing update step for 'GoogleTest'
[cmake] [2/7] No patch step for 'GoogleTest'
[cmake] [3/7] No configure step for 'GoogleTest'
[cmake] [4/7] No build step for 'GoogleTest'
[cmake] [5/7] No install step for 'GoogleTest'
[cmake] [6/7] No test step for 'GoogleTest'
[cmake] [7/7] Completed 'GoogleTest'
[cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
[cmake] -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
[cmake] -- Found Threads: TRUE  
[cmake] -- Performing Test HAVE_STDATOMIC
[cmake] -- Performing Test HAVE_STDATOMIC - Success
[cmake] -- Found WrapAtomic: TRUE  
[cmake] -- Could NOT find WrapVulkanHeaders (missing: Vulkan_INCLUDE_DIR) 
[cmake] -- Could NOT find Qt6Core5Compat (missing: Qt6Core5Compat_DIR)
[cmake] CMake Error at CMakeLists.txt:55 (find_package):
[cmake]   Found package configuration file:
[cmake] 
[cmake]     C:/Qt/6.7.1/msvc2019_64/lib/cmake/Qt6/Qt6Config.cmake
[cmake] 
[cmake]   but it set Qt6_FOUND to FALSE so package "Qt6" is considered to be NOT
[cmake]   FOUND.  Reason given by package:
[cmake] 
[cmake]   Failed to find required Qt component "Core5Compat".
[cmake] 
[cmake]   Expected Config file at
[cmake]   "C:/Qt/6.7.1/msvc2019_64/lib/cmake/Qt6Core5Compat/Qt6Core5CompatConfig.cmake"
[cmake]   does NOT exist
[cmake] 
[cmake] 
[cmake] 
[cmake]   Configuring with --debug-find-pkg=Qt6Core5Compat might reveal details why
[cmake]   the package was not found.
[cmake] 
[cmake]   Configuring with -DQT_DEBUG_FIND_PACKAGE=ON will print the values of some
[cmake]   of the path variables that find_package uses to try and find the package.

I went back to the Maintenance Tool, added the Qt 5 Compatability Module, and re-launched Qt Creator. Once I set Qt6_DIR, I was able to start the build process!