jkriege2 / JKQtPlotter

an extensive Qt5 & Qt6 Plotter framework (including a feature-richt plotter widget, a speed-optimized, but limited variant and a LaTeX equation renderer!), written fully in C/C++ and without external dependencies
http://jkriege2.github.io/JKQtPlotter/index.html
GNU Lesser General Public License v2.1
888 stars 190 forks source link

Strange build issue #142

Closed OgreTransporter closed 2 weeks ago

OgreTransporter commented 3 weeks ago

I have a strange build issue with current MSVC and QT 6.8.0. My commands are:

git clone https://github.com/jkriege2/JKQtPlotter.git
mkdir build
cd build
cmake -G "Visual Studio 17" -A x64 -D CMAKE_INSTALL_PREFIX:PATH=%CD%\..\install -D JKQtPlotter_BUILD_EXAMPLES:BOOL=OFF -D JKQtPlotter_BUILD_TESTS:BOOL=OFF -D JKQtPlotter_BUILD_TOOLS:BOOL=OFF -D JKQtPlotter_BUILD_LIB_JKQTFASTPLOTTER:BOOL=OFF ..\JKQtPlotter
msbuild INSTALL.vcxproj /maxcpucount /nodeReuse:false /nologo /p:Configuration=Debug

The result looks like this (shortened):

       PreLinkEvent:
         Auto build dll exports
         setlocal
         cd D:\JKQtPlotter\build\lib\jkqtmathtext
         if %errorlevel% neq 0 goto :cmEnd
         D:
         if %errorlevel% neq 0 goto :cmEnd
         D:\VisualStudio\Tools\CMake\bin\cmake.exe -E __create_def D:/JKQtPlotter/build/lib/jkqtmathtext/JKQTMathText6.dir/Debug/exports.def D:/JKQtPlotter/build/lib/jkqtmathtext/JKQTMathText6.dir/Debug//objects.txt
         if %errorlevel% neq 0 goto :cmEnd
         :cmEnd
         endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
         :cmErrorLevel
         exit /b %1
         :cmDone
         if %errorlevel% neq 0 goto :VCEnd
         :VCEnd
         Couldn't open file 'D:/JKQtPlotter/build/lib/jkqtmathtext/JKQTMathText6.dir/Debug/qrc_xits.obj' with CreateFile()
     1>C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: Der Befehl "setlocal [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: cd D:\JKQtPlotter\build\lib\jkqtmathtext [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: D: [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: D:\VisualStudio\Tools\CMake\bin\cmake.exe -E __create_def D:/JKQtPlotter/build/lib/jkqtmathtext/JKQTMathText6.dir/Debug/exports.def D:/JKQtPlotter/build/lib/jkqtmathtext/JKQTMathText6.dir/Debug//objects.t
       xt [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: if %errorlevel% neq 0 goto :cmEnd [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: :cmEnd [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: :cmErrorLevel [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: exit /b %1 [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: :cmDone [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: if %errorlevel% neq 0 goto :VCEnd [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
       C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Microsoft\VC\v170\Microsoft.CppCommon.targets(161,5): error MSB3073: :VCEnd" wurde mit dem Code 1 beendet. [D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj]
     1>Die Erstellung des Projekts "D:\JKQtPlotter\build\lib\jkqtmathtext\JKQTMathText6.vcxproj" ist abgeschlossen (Standardziele) -- FEHLER.

I only have this problem with JKQtPlotter. All other Qt programs can be compiled without any problems. The same problem occurs again later.

Couldn't open file 'D:/JKQtPlotter/build/lib/jkqtplotter/JKQTPlotter6.dir/Debug/qrc_jkqtpbaseplotter.obj' with CreateFile()

Environment:

-- =============================================================================
-- == JKQTPlotterLib Build Information                                        ==
-- =============================================================================
-- Version:               5.0.0
-- CMake Generator:       Visual Studio 17 2022
--    is multi-config:    YES
-- Build type:
-- Build types:           Debug;Release;MinSizeRel;RelWithDebInfo
-- Build shared lib:      ON
-- Using CMake:           3.30.5
-- Using CMake Generator: Visual Studio 17 2022
-- Using compiler:        MSVC 19.41.34123.0, platform: Windows
-- C++ Standard:          C++ 17, required: TRUE
-- LIB-Architecture:      CXX:  / BASE:
-- bit depth:             64 bit
-- System Name:           Windows
-- Processor Name:        AMD64
-- Using Qt:              6.8.0
--                        [at D:/VisualStudio/SDKs/Qt/6.8.0/msvc2022_64/lib/cmake/Qt6]
-- XITS fonts:            LINKED IN
-- FIRA fonts:            LINKED IN
-- Print support:         ON
-- Timing Info output:    ON
-- Precompiled Header:    ON
-- build JKQTMath:        ON
-- build JKQTMathText:    ON
-- build JKQTFastPlotter: OFF
-- build JKQTPlotter:     ON
-- Installing to:         D:/JKQtPlotter/build/../install
-- =============================================================================

I have already found a solution using qt_add_resources (https://doc.qt.io/qt-6/qt-add-resources.html):

https://github.com/jkriege2/JKQtPlotter/blob/966a537f4a51ea4109314de54f6267de2ed70c4d/lib/jkqtmathtext/CMakeLists.txt#L35 In line 35 I have replaced the code with the following:

qt_add_resources(QRCSOURCES resources/firamath.qrc resources/xits.qrc)
target_sources(${lib_name} PRIVATE ${QRCSOURCES})
target_compile_definitions(${lib_name} PUBLIC JKQTMATHTEXT_COMPILED_WITH_FIRAMATH JKQTMATHTEXT_COMPILED_WITH_XITS)

https://github.com/jkriege2/JKQtPlotter/blob/966a537f4a51ea4109314de54f6267de2ed70c4d/lib/jkqtplotter/CMakeLists.txt#L71 In line 71 I have replaced the code with the following:

qt_add_resources(QRCSOURCES resources/jkqtpbaseplotter.qrc resources/jkqtpstyles.qrc)
target_sources(${lib_name} PRIVATE ${QRCSOURCES})
jkriege2 commented 2 weeks ago

Thanks for reporting. I merged your PR