I'm trying to set up autobuild appveyor on my Qt project.
My app is using qt5.10.1, with qml and openSSL features.
I'm lost... I didn't know from where to start :/
# 1:
I found some examples of .apveyor.yml config files, but they are all using mingw32 compilator which do not allow me to use qml webview module (why)... I didn't find what I have to write in my appveyor config file to compile my app with msv2017 where is the compilator ?
Actually, my appveyor.yml looks like that (I try to do as QtCreator is doing on my local computer but it's not working)
image: Visual Studio 2017
branches:
only:
- master
install:
- set QTDIR=C:\Qt\5.10.1\msvc2017_64
- set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw530_32\bin;%PATH%;
build_script:
- qmake app/QRegovar.pro -spec win32-msvc
- qmake_all
- C:\Qt\Tools\QtCreator\bin\jom.exe -f Makefile.Release
deploy:
- provider: GitHub
artifact: C:/projects/qregovar
draft: true
prerelease: false
on:
branch: master
appveyor_repo_tag: true
And it's failling with the following error:
Build started
git clone -q --branch=master https://github.com/REGOVAR/QRegovar.git C:\projects\qregovar
git checkout -qf 7357eb2adab349c4de9e0b346dc99027964ea5a5
Running Install scripts
set QTDIR=C:\Qt\5.10.1\msvc2017_64
set PATH=%QTDIR%\bin;C:\Qt\Tools\mingw530_32\bin;%PATH%;
qmake app/QRegovar.pro -spec win32-msvc
Project ERROR: Cannot run compiler 'cl'. Output:
===================
===================
Maybe you forgot to setup the environment?
Command exited with code 3
# 2:
I'm also wondering if appveyor is using qt static build ? As I would like to create "ready to use" package for the user ?
I'm using CMake, but I guess the trick is to setup 'cl' compiler into PATH, so qmake is able to find it.
In sample appveyor scripts the main build script is '.\qtmodules-travis\ci\win\build.bat'. This script will check/use AppVeyor matrix-defined variable for platform (line 7+) and then the script define VC_DIR etc.
And on the end is invoking script referred by you 'build-msvc.bat' where is invoked:
call %VC_DIR% %VC_VARSALL% || exit /B 1
QtCreator will do the setup for you (you are using Kits...)
When you are building in clean command line, you should do 'vcvarsXXX.bat call yourself before 'qmake' call.
In my opinion AppVeyor doesn't trigger this call for you, because developer may wish different build env. setup (e.g. x86, x64, arm etc.). It's your choice. Actually this is the hint as well when you start 'Qt command line' on your PC from start menu (it call 'C:\Qt\5.11.0\msvc2017_64\bit\qtenv2.bat' shell setup script)
Related
VSCode, Java 11 JavaFX 18.0.2
I am trying to package my code up for distribution as a desktop app. In my case I want a fully self-contained app because of my target user's profile.
I have been through Jenkov add the Oracle docs here and here which suggest I need ant-javafx.jar. That jar file seems to have been dropped from the standard Java SDK some time around Java 7 and put into the regular JavaFX install lib folder.
It's not there in the build I have.
JavaFX seems to have gone to openjfx.io and nowhere in there can I see support for the ant packaging jar. In fact I see openjfx as a retrograde step as they are increasingly forcing everyone into paid plans (try going round and round the loop of downloading anything that doesn't require an LTS payment).
I have a suspicion that there is some silent assumption that everyone will use something from maven or gradle, and maybe the packaging tools are buried away in one of those build tools. For historical reasons I don't use either and it should be possible to do this packaging without one of them.
So where do I get the JavaFX Ant build tasks from without having to pay someone?
I have found that the following works as an alternative with Java 19 and OpenJFX 19. I use the maven-dependency-plugin to copy all the dependency jars (excluding JavaFX, which I use as modules from a "full" JDK [one that includes JavaFX)] into the target/lib directory.
#!/bin/bash
set -o errexit
set -o noclobber
set -o xtrace
# find dependency modules of required modules
DEP_MODS=$(jdeps -quiet --class-path "target/lib/*" --add-modules java.base,java.logging,java.sql,javafx.controls,javafx.fxml --multi-release base --ignore-missing-deps --print-module-deps target/myapp-4.0-beta.jar)
# create a modular runtime image
jlink --compress=1 --no-header-files --no-man-pages --add-modules "java.logging,java.sql,javafx.controls,javafx.fxml,$DEP_MODS" --output target/myapp-4.0-beta
# Example of running it out of the runtime image
# TEST target/myapp-4.0-beta/bin/java -cp "../../myapp-4.0-beta.jar:../../lib/*" org.myapp.App
# symlink to the artifact jar from the lib directory
$(cd target/lib && ln -s ../myapp-4.0-beta.jar)
# use the lib directory and modular runtime image as input to jpackage
jpackage --input target/lib --runtime-image target/myapp-4.0-beta --main-jar myapp-4.0-beta.jar --main-class org.myapp.App --type app-image --app-version 4.0 --name app --dest target/dist/bundle --mac-entitlements src/dist/mac/entitlements.plist
We have Xamarin.Forms solution with iOS and UWP projects. We use Azure pipelines to build the iOS project. Until yesterday everything was working fine.
Now the build fails at the NuGet Restore step with the error:
##[error]The nuget command failed with exit code(1) and error(/Users/runner/work/1/s/"MyProjectName.UWP".csproj : error MSB4057: The target "_IsProjectRestoreSupported" does not exist in the project.
We can see that the problem occurs when trying to restore NuGet packages for the UWP project on the Mac OS build host.
Image: macOS-11
Workaround will be to exclude it from the solution, but we are using it for testing purposes and this is not a good option for us.
We had the same problem yesterday for our iOS (macos-11) and Android (macos-10.15) Pipelines.
The issue 21180 for mono seems to be the root cause, which is also referenced in a pull request to update the mono version for MacOs virtual environments. Regarding to this workflow test we gave msbuild a chance, and it works.
Solution:
Instead of NuGet restore we use directly MSBuild.
- task: MSBuild#1
inputs:
solution: 'App.sln'
configuration: 'Release'
msbuildArguments: /t:restore
Looking at the log file, MSBuild ignores the UWP project. That is the behavior that NuGet had with the older mono version 6.12.0.125. Ignoring the UWP-Project is no problem, because it can only be build on windows environments.
Project "/Users/runner/work/1/s/App.sln" on node 1 (Restore target(s)).
ValidateSolutionConfiguration:
Building solution configuration "Release|Any CPU".
/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/msbuild/Current/bin/NuGet.targets(315,5): warning : Skipping restore for project '/Users/runner/work/1/s/App/App.UWP/App.UWP.csproj'. The project file may be invalid or missing targets required for restore. [/Users/runner/work/1/s/App.sln]
Some additional information:
The NuGet restore task uses msbuild to find all referenced packages. If that fails, it will use the packages.config file as fallback, the pipeline step will not fail.
Instead we got an error in the build steps for Android & iOS:
error NETSDK1004: Assets file
'/Users/runner/work/1/s/../obj/project.assets.json' not found. Run a
NuGet package restore to generate this file.
Updated Answer
This can be resolved using MSBuild task instead, as the collogues mentioned below.
However, in my case this still lead to the same error. After investigating the pipeline. The root cause has been identified:
Both in MSBuild#1 and XamariniOS#2 tasks
you should target the specific iOS Project and not the solution file, like so:
"
- task: MSBuild#1
inputs:
solution: 'PathToIosProject/myproject.iOS.csproj'
configuration: '$(BuildConfiguration)'
msbuildArguments: /t:restore
" - task: XamariniOS#2
inputs:
solutionFile: PathToIosProject/myproject.iOS.csproj'
configuration: '$(BuildConfiguration)'
packageApp: true
signingIdentity: $(APPLE_CERTIFICATE_SIGNING_IDENTITY)
Old Answer
We have managed to resolve the issue. The root cause of it seems to be an update to the mono framework in the MacOS pipeline build agent.
In order to fix it, we need a script for downloading and installing an older version of the mono framework as a first step of the build pipeline like so:
link to the pipeline tasks photo
This is the code of the bash scrip used in the task:
#!/bin/bash
set -ex
MONO_MACOS_PKG_DOWNLOAD_URL='https://download.mono-project.com/archive/6.12.0/macos-10-universal/MonoFramework-MDK-6.12.0.100.macos10.xamarin.universal.pkg'
mkdir -p /tmp/mono-install
cd /tmp/mono-install
mono --version
wget -q -O ./mono-installer.pkg "$MONO_MACOS_PKG_DOWNLOAD_URL"
sudo installer -pkg ./mono-installer.pkg -target /
mono --version
ls -alh /Library/Frameworks/Mono.framework/Versions/Current
I'm trying to build a CMakeLists project using Qt Creator 4.8.1. The problem is, I need to run CMake inside a different nativesysroot.
I tried to create a bash script that runs CMake inside the other environment and added it to my kit. As follows:
#!/bin/bash
cd ~/Desktop/Workspace/my_proj/build &&\
~/Desktop/Workspace/my_proj/sdk-x86_64/opt/nativesysroot/usr/bin/sysroot\
~/Desktop/Workspace/my_proj/sdk-vmwx86-x86_64/opt/nativesysroot/usr/bin/cmake "$#"
Such that, sysroot is an executable that changes the current nativesysroot.
The problem is this does not work because Qt Creator is trying to run CMake using the following configuration:
Running "/home/***/Desktop/Workspace/my_proj/script.sh -E server --pipe=/tmp/cmake-.ewYqvn/socket --experimental" in /tmp/QtCreator-kruzfX/qtc-cmake-YOZsCIQx.
This of course causes CMake server connection lost. I tried the look around how to disable the CMake running in server mode but I did not find anything in Qt Creator.
My question is, how to disable CMake in server mode? Or, how to instruct Qt Creator to run my script without adding any flags or options?
Thanks.
I am trying to set up Qt 5.1 with MS Visual Studio 2012 compiler. I have downloaded and installed the VS Express (it works and compiles C++ code just fine) and then installed Qt.
Here is the console output from whenever I try to build anything:
09:07:14: Running steps for project cube...
09:07:14: Starting: "C:\Qt\Qt5.1.0\5.1.0\msvc2012_64\bin\qmake.exe" C:\Qt\Qt5.0.2\5.0.2\msvc2012_64\examples\opengl\cube\cube.pro -r -spec win32-msvc2012 "CONFIG+=debug" "CONFIG+=declarative_debug" "CONFIG+=qml_debug"
09:07:15: The process "C:\Qt\Qt5.1.0\5.1.0\msvc2012_64\bin\qmake.exe" exited normally.
09:07:15: Starting: "C:\Qt\Qt5.1.0\Tools\QtCreator\bin\jom.exe"
Usage: jom #commandfile
jom [options] [/f makefile] [macro definitions] [targets]
nmake compatible options:
/A build all targets
/D display build information
/E override environment variable macros
/F <filename> use the specified makefile
/G display included makefiles
/H show help
/I ignore all exit codes
/K keep going - build unrelated targets on error
/N dry run - just print commands
/NOLOGO do not print logo
/P print makefile info
/R ignore predefined rules and macros
/S silent mode
/U print content of inline files
/L same as /NOLOGO
/W print the working directory before and after other processing
/X <filename> write stderr to file.
/Y disable batch mode inference rules
jom only options:
/DUMPGRAPH show the generated dependency graph
/DUMPGRAPHDOT dump dependency graph in dot format
/J <n> use up to n processes in parallel
/KEEPTEMPFILES keep all temporary files
/VERSION print version and exit
Error: unknown command line option '-' in arguments: '/L-IC:/QNX650/target/qnx6/usr/include'
09:07:15: The process "C:\Qt\Qt5.1.0\Tools\QtCreator\bin\jom.exe" exited with code 128.
Error while building/deploying project cube (kit: Desktop Qt 5.1.0 MSVC2012 64bit)
When executing step 'Make'
09:07:15: Elapsed time: 00:01.
Earlier I had the same problem with 5.0.2 (basically that's why I killed it and installed 5.1).
I couldn't Google anything reasonable regarding this kind of error. Looks like 128 propagates from somewhere within Visual Studio, but I can't figure out what it is.
Could anybody suggest how can I debug and fix this?
Thanks
... And there's nothing that helps you figure out the problem better than writing it down and then starting at the post.
The "/L-IC:/QNX650/target/qnx6/usr/include" actually tells me that QNX SDK installed on my machine is messing with my environment variables. Luckily, Qt has a way of dealing with that. I need to go to Projects tab, expand the "build environment" section and unset the "MAKEFLAGS" environment variable. This fixes it.
I just finished writing a QML desktop application(with QtCreator and c++) on Windows.
I've installed QT Quick Desktop Components, according to these instrctions, with MinGw compiler, in C:\QtSDK\Desktop\Qt\4.7.4\mingw\imports\Qt\labs\components folder.
I installed it twice - once for debug - with the command: qmake && jom debug && jom install, and once for release - with the command: qmake && jom release && jom install, so I have now two dll files: 1.styleplugin.dll, 2.styleplugind.dll. and I'm using each of them when I need it. I've imported it to my application with:
import Qt.labs.components 0.1
Now I have to deploy my application, and make it work on all the machines: with Qt installed on it, or with no.I tried to do it with these steps:
coppied these files: application.exe, QtCore4.dll, QtGui4.dll, QtNetwork4.dll, styleplugin.dll and styleplugind.dll.
but when I'm running the .exe file - I'm getting a white, empty screen.
(BTW, when I'm running the .exe file from it's release folder - I can see again only a white window, and when I did the same to a simple Widget GUI application - it runs well from there).
Do you know about any reason to this situation?
Any answer would be appreciated!
May be you forgot deploy QML files to exe? (qrc)
Simple way to test it is copy folde with qml-files to destination near exe file
UPD:
Please read Qt Resource System article
I.e.:
First need add new "Resource File" in project menu,
Then place all of your qml files into this resource file
Change "Source" in your QDeclarativeView like a:
viewer->setSource(QUrl("qrc:/main.qml"));
One possible solution is to enable warnings by running the command
qmlviewer.exe -warnings show qmlfilename.qml
If qmlviewer cannot find any dependent import libraries, it will show up here.
To make sure qmlviewer can access the import libraries either use the -I <directory> on the command line
OR set the QML_IMPORT_PATH environment variable to the folder containing the import libs.
eg:
qmlviewer.exe -warnings show -I <directory> qmlfilename.qml
OR
set QML_IMPORT_PATH=<directory>
where <directory> is the module import search path (without the <>)