Solved Qmake: License could not be found using Jenkins as windows service with Qt5.9 where 5.6 does
-
We switched building from Qt5.6 to Qt5.9. This works fine using QtCreator or console on Developer Machines.
Now switching our Build-System based on Jenkins as System Service with 5.9 always fails to find the qt license.
We installed Qt using my credentials and we can install and update fine using the user account. Just the service user cannot find the license, which is a mandatory for running jenkins in this configuration. We already tried placing the .qt-license file to the system home directory but this did not help at all.
How can we achive the system user's qmake calls can find a valid license?
BuildConfig:
echo CD echo %CD% echo USERPROFILE echo %USERPROFILE% echo USERNAME echo %USERNAME% echo. echo. echo Content of userprofile directory echo. echo. dir %USERPROFILE% echo. echo. echo --------------- Running QMake --------------- echo. mkdir build cd build set BUILDDIR=%CD% call C:\Qt\5.9\msvc2015\bin\qtenv2.bat cd %BUILDDIR% qmake.exe ..\source\TestBuild.pro "CONFIG+=release" && nmake qmake_all
BuildLog:
C:\Jenkins\Testbuild>echo CD CD C:\Jenkins\Testbuild>echo C:\Jenkins\Testbuild C:\Jenkins\Testbuild C:\Jenkins\Testbuild>echo USERPROFILE USERPROFILE C:\Jenkins\Testbuild>echo C:\Windows\system32\config\systemprofile C:\Windows\system32\config\systemprofile C:\Jenkins\Testbuild>echo USERNAME USERNAME C:\Jenkins\Testbuild>echo TESTBUILD$ TESTBUILD$ C:\Jenkins\Testbuild>echo. C:\Jenkins\Testbuild>echo. C:\Jenkins\Testbuild>echo Content of userprofile directory Content of userprofile directory C:\Jenkins\Testbuild>echo. C:\Jenkins\Testbuild>echo. C:\Jenkins\Testbuild>dir C:\Windows\system32\config\systemprofile Volume in Laufwerk C: hat keine Bezeichnung. Volumeseriennummer: --------- Verzeichnis von C:\Windows\system32\config\systemprofile 10.02.2016 16:34 <DIR> . 10.02.2016 16:34 <DIR> .. 10.02.2016 15:35 <DIR> .oracle_jre_usage 10.02.2016 14:35 251 .qt-license 1 Datei(en), 251 Bytes 3 Verzeichnis(se), 10.672.287.744 Bytes frei C:\Jenkins\Testbuild>echo. C:\Jenkins\Testbuild>exit 0 [Testbuild] $ cmd /c call C:\Windows\TEMP\hudson3453996140933717738.bat C:\Jenkins\Testbuild>echo. C:\Jenkins\Testbuild>echo --------------- Running QMake --------------- --------------- Running QMake --------------- C:\Jenkins\Testbuild>echo. C:\Jenkins\Testbuild>mkdir build Ein Unterverzeichnis oder eine Datei mit dem Namen "build" existiert bereits. C:\Jenkins\Testbuild>cd build C:\Jenkins\Testbuild\build>set BUILDDIR=C:\Jenkins\Testbuild\build C:\Jenkins\Testbuild\build>call C:\Qt\5.9\msvc2015\bin\qtenv2.bat Setting up environment for Qt usage... Remember to call vcvarsall.bat to complete environment setup! Calling vcvarsall.bat now ********************************************************************** ** Visual Studio 2017 Developer Command Prompt v15.0.26430.12 ** Copyright (c) 2017 Microsoft Corporation ********************************************************************** [vcvarsall.bat] Environment initialized for: 'x86' NOTICE NOTICE NOTICE NOTICE You are not licensed to use this version of Qt. Please log into your Qt Account at https://account.qt.io/ to renew your license. Refer to Qt Support FAQ for known resolutions in license issues: https://wiki.qt.io/index.php?title=KnowledgeBase:SupportFAQ NOTICE NOTICE NOTICE NOTICE Project ERROR: License check failed! Giving up ... Build step 'Windows Batch-Datei ausführen' marked build as failure Finished: FAILURE
-
We've got an answer from the Qt support requesting to setup the QT_LICENSE_FILE environment variable.
We now copied the .qt-licese file from the original installation user directly into the Qt installation directory
C:\Qt\.qt-license
On the begining of every batch block in Jenkins we now manually set this path as the license environment variable
set QT_LICENSE_FILE=C:\Qt\.qt-license echo. echo --------------- Running QMake --------------- echo. mkdir build cd build set BUILDDIR=%CD% call C:\Qt\5.9\msvc2015\bin\qtenv2.bat cd %BUILDDIR% qmake.exe ..\source\TestBuild.pro "CONFIG+=release" && nmake qmake_all
This helped us getting jenkins back to building.
Thanks
-
Thanks for the feedback !