zrax / cctools

Editor and Tool suite for Chip's Challenge, Chip's Challenge 2, and Tile World
http://cctools.zrax.net
GNU General Public License v3.0
20 stars 10 forks source link

Unable to compile CCTools under Windows 11 with Visual Studio 2022 and Qt 5.15.2 #33

Closed francescoraves483 closed 3 months ago

francescoraves483 commented 3 months ago

Hello, I am opening this issue as I made several attempts, but I am still unable to build CCTools on Windows, even if the Win32-CI workflow works as expected. My last attempt was with Visual Studio, on Windows 11, closely following the commands reported in the GitHub workflow file: https://github.com/zrax/cctools/actions/runs/9537696031/workflow

The steps I followed are:

  1. I installed Qt 5.15.2 in my disk P: with the online Qt Installer

  2. I installed Visual Studio Community 2022 with the win32_msvc2019 compiler.

  3. I installed then the Qt Visual Studio Tools, selecting as Qt path (under Debug -> Options -> Qt -> Version) "P:\Qt5\5.12.5\msvc2019"

  4. I downloaded, compiled and installed extra-cmake-modules 5.98.0 with the following commands, using the Developer Command Prompt for VS 2022:

    cmake -E tar xf extra-cmake-modules-5.98.0.zip
    cd extra-cmake-modules-5.98.0
    mkdir build
    cd build
    cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_PREFIX_PATH="P:/Qt5/5.15.2/msvc2019" -DCMAKE_INSTALL_PREFIX="P:/Qt5/5.15.2/msvc2019" -DCMAKE_BUILD_TYPE=Release ..
    cmake --build . --config Release --target install

    The build was successful.

  5. I downloaded strawberry-perl-5.38.2.2 (portable version) as it seems to be a dependency for KF5SyntaxHighlighting, and added to the PATH the strawberry-perl-5.38.2.2-64bit-portable\perl\bin directory

  6. I tried compiling KF5SyntaxHighlighting, that seems to be a required dependency for CCTools:

    cmake -E tar xf extra-cmake-modules-5.98.0.zip
    cd extra-cmake-modules-5.98.0
    mkdir build
    cd build
    cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_PREFIX_PATH="P:/Qt5/5.15.2/msvc2019" -DCMAKE_INSTALL_PREFIX="P:/Qt5/5.15.2/msvc2019" -DCMAKE_BUILD_TYPE=Release ..
    cmake --build . --config Release --target install

    The build fails with:

    Automatic MOC for target SyntaxHighlightingData
    Generating index.katesyntax
    C:\Program Files\Microsoft Visual Studio\2022\Community\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(254,5): e
    rror MSB8066: Custom build for 'C:\VS2022_Source\Repos\syntax-highlighting-5.98.0\build\CMakeFiles\6ea4fe8357017baeb43
    d561ae6f09c95\index.katesyntax.rule;C:\VS2022_Source\Repos\syntax-highlighting-5.98.0\build\CMakeFiles\6ea4fe8357017ba
    eb43d561ae6f09c95\qrc_syntax-data.cpp.rule' exited with code -1073741515. [C:\VS2022_Source\Repos\syntax-highlighting-5
    .98.0\build\data\SyntaxHighlightingData.vcxproj]
  7. I tried with KF5SyntaxHighlighting 5.116.0, but I get exactly the same issue.

  8. Therefore, CCTools cannot be compiled as it cannot find the KF5SyntaxHighlighting dependency.

I have cmake version 3.28.3-msvc11, and the output of the cmake command for KF5SyntaxHighlighting is the following:

PS C:\VS2022_Source\Repos\syntax-highlighting-5.98.0\build> cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_PREFIX_PATH="P:/Qt5/5.15.2/msvc2019" -DCMAKE_INSTALL_PREFIX="P:/Qt5/5.15.2/msvc2019" -DCMAKE_BUILD_TYPE=Release ..
-- Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.22631.
-- The C compiler identification is MSVC 19.40.33812.0
-- The CXX compiler identification is MSVC 19.40.33812.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x86/cl.exe - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x86/cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Installing in the same prefix as Qt, adopting their path scheme.
-- Could not set up the appstream test. appstreamcli is missing.
-- Looking for __GLIBC__
-- Looking for __GLIBC__ - not found
-- Performing Test BSYMBOLICFUNCTIONS_AVAILABLE
-- Performing Test BSYMBOLICFUNCTIONS_AVAILABLE - Success
-- Found Perl: C:/VS2022_Source/Repos/strawberry-perl-5.38.2.2-64bit-portable/perl/bin/perl.exe (found version "5.38.2")

-- Performing Test COMPILER_HAS_DEPRECATED_ATTR
-- Performing Test COMPILER_HAS_DEPRECATED_ATTR - Failed
-- Performing Test COMPILER_HAS_DEPRECATED
-- Performing Test COMPILER_HAS_DEPRECATED - Success
-- The following features have been enabled:

 * SYNTAX_RESOURCE, Bundle the syntax definition files inside the library as resources

-- The following OPTIONAL packages have been found:

 * Qt5PrintSupport
   Example application.
 * Qt5Widgets
   Example application.
 * Qt5Qml (required version >= 5.15.2)
 * Qt5QmlModels (required version >= 5.15.2)
 * Qt5Quick
   QtQuick bindings.
 * Qt5XmlPatterns
   Compile-time validation of syntax definition files.

-- The following REQUIRED packages have been found:

 * ECM (required version >= 5.98.0)
 * Qt5Core
 * Qt5Network
 * Qt5Test
 * Qt5Gui
 * Qt5 (required version >= 5.15.2), <http://qt-project.org/>
 * Perl
   Auto-generate PHP syntax definition files.
 * Qt5LinguistTools

-- The following features have been disabled:

 * FEATURE_NO_STANDARD_PATHS, Skip lookup of syntax and theme definitions in QStandardPaths locations
 * QCH, API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)

-- Configuring done (16.2s)
-- Generating done (1.5s)
-- Build files have been written to: C:/VS2022_Source/Repos/syntax-highlighting-5.98.0/build

Do you know if I missed some steps or if there is another alternative way to get KF5SyntaxHighlighting other than compiling from source?

Thank you very much in advance!

zrax commented 3 months ago

My first guess is that Qt itself isn't in your PATH, since the SyntaxHighlighting build requires running at least one executable linked against the Qt libraries... The install-qt-action in CI does this automatically, which makes it sort of a hidden dependency. Try adding P:/Qt5/5.15.2/msvc2019/bin to your PATH and see if that helps

francescoraves483 commented 3 months ago

Thanks a lot for the suggestion (unfortunately, cmake was not providing any useful hint on which was the actual problem, limiting itself to report an error code equal to -1073741515 = DLL not found)! That was indeed my issue. After adding P:/Qt5/5.15.2/msvc2019/bin to the PATH, now the cmake build process for KF5SyntaxHighlighting completes succesfully. After installing KF5SyntaxHighlighting with the install target, I can now compile CCTools successfully with Visual Studio on Windows, just like I was doing with CLion on Ubuntu.