How to package Qt5 application with snapcraft - qt

I'm trying to create snap package of a Qt/QML application, the application is packaged well, when I try to run it I get /snap/swipe-app/x2/bin/qt5-launch: 74: exec: application: not found error.
here's my snapcraft.yaml file
name: swipe-app # you probably want to 'snapcraft register <name>'
version: '0.1' # just for humans, typically '1.2+git' or '1.3.2'
summary: Single-line elevator pitch for your amazing snap # 79 char long summary
description: description
grade: devel # must be 'stable' to release into candidate/stable channels
confinement: strict # use 'strict' once you have the right plugs and slots
apps:
swipe-app:
command: qt5-launch application
plugs:
- unity7
- home
parts:
application:
# See 'snapcraft plugins'
plugin: qmake
project-files: ["snap.pro"]
source: .
build-packages:
- qtbase5-dev
stage-packages:
# Here for the plugins-- they're not linked in automatically.
- libqt5gui5
after: [qt5conf] # A wiki part

As you have told the launch script that your program is called application then it will try to execute application from the current working directory when you run your snap. There are two things to note here:
The working directory is preserved from the terminal outside the snap context. For example if you are in your home directory /home/your-user then the working directory for swipe-app will also be /home/your-user.
As the working directory above is your home directory then commands without any anchor, such as application, will try to execute in your home directory. So in your example the launch script will attempt to run the command equivalent of /home/your-user/application.
You can fix this by either ensuring that the launch script executes a cd to change the working directory, e.g. cd $SNAP; or anchor your command by adding an achor, e.g. command: qt5-launch $SNAP/application.
Another thing you might need to check is that your qmake build actually outputs a binary called application. If you have not set TARGET= in your snap.pro project file then the binary will default to being called snap, not application. The line should read TARGET=application to make a binary called application: (ref: https://doc.qt.io/qt-5/qmake-variable-reference.html#target).

Related

CEF / CEFSharp Compiling Issue

Environment: Windows 10, WinForm (.Net 4.7.2) x64 only, CefSharp 71.0.2.0
We need support for playing MP4 in our product (we have a license) and we are attempting to recompile CEF with proprietary codecs enabled.
We're using the instructions from:
https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart.md#markdown-header-windows-setup
Our create.bat file looks like:
set CEF_USE_GN=1
set GN_DEFINES=is_win_fastlink=true proprietary_codecs=true ffmpeg_branding=Chrome
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
call cef_create_projects.bat
Our update.bat file looks like
set CEF_USE_GN=1
set GN_DEFINES=is_official_build=true proprietary_codecs=true ffmpeg_branding=Chrome
set GN_ARGUMENTS=--ide=vs2015 --sln=cef --filters=//cef/*
python ..\automate\automate-git.py --download-dir=C:\code\chromium_git --depot-tools-dir=C:\code\depot_tools --no-distrib --no-build --branch=3578
We are trying to specifically target build 3578 to match the build that comes with CEFSharp. We also enabled proprietary codec using the flag: proprietary_codecs=true
After about 2 hours and no errors the build completes successfully. When we run our page using cefclient.exe from the output build everything works as expected, the video plays correctly.
We copy the following files from the output build folder to our .Net application replacing the files packaged with CEFSharp:
cef.pak
cef_100_percent.pak
cef_200_percent.pak
cef_extensions.pak
chrome_elf.dll
d3dcompiler_47.dll
devtools_resources.pak
icudtl.dat
libcef.dll
libEGL.dll
libGLESv2.dll
natives_blob.bin
snapshot_blob.bin
v8_context_snapshot.bin
\locales\*.*
\swiftshader\libEGL.dll
\swiftshader\libGLESv2.dll
When running our app, the app terminates immediately and this is written to the debug.log file:
[0326/094610.429:FATAL:cookie_manager_impl.cc(620)] Check failed: false. context not valid
Backtrace:
cef_string_utf16_to_upper [0x00007FFD2B53E1E5+1713061]
cef_string_utf16_to_upper [0x00007FFD2B53D44D+1709581]
cef_string_utf16_to_upper [0x00007FFD2B5765D5+1943445]
cef_zip_reader_create [0x00007FFD2B3107B8+159661640]
cef_cookie_manager_get_global_manager [0x00007FFD219B0436+54]
CefCookieManager::GetGlobalManager [0x00007FFD7322879E+94]
(No symbol) [0x00007FFD4E1C07DE]
[0326/094721.035:FATAL:cookie_manager_impl.cc(620)] Check failed: false. context not valid
I was able to see that 71.0.2.0 uses CEF 3.3578.1870.gc974488 / Chromium 71.0.3578.98 from:
https://github.com/cefsharp/CefSharp/commit/7d24861e7af79fc4721eb498bb8417b5aa6cad97
When we run cefclient.exe from our build and navigate to chrome://about it displays:
CEF 3.3578.1870.gc974488
Chromium 71.0.3578.98
Which matches the CEFSharp release notes page.
Any suggestions would be greatly appreciated!

Application icon doesn't work with Snap packaging

My desktop file is:
[Desktop Entry]
Name=Heimer
GenericName=Mind map application
Comment=Mind map application
Exec=heimer
Icon=heimer
Type=Application
Categories=Education;
StartupNotify=true
My snapcraft.yaml is:
name: heimer
version: '1.1.0'
summary: Heimer is a simple cross-platform mind map tool.
description: |
Heimer is a simple cross-platform mind map creation tool.
Emphasis on easy diagram creation, simplicity, and speed.
grade: stable
confinement: strict
icon: ../../../data/icons/heimer.png
apps:
heimer:
command: desktop-launch heimer
desktop: usr/share/applications/heimer.desktop
plugs: [home, x11, wayland]
parts:
gnu-heimer:
source: ../../../
plugin: cmake
configflags:
- -DCMAKE_BUILD_TYPE=Release
- -DCMAKE_INSTALL_PREFIX=/usr
build-packages:
- qtbase5-dev
- qttools5-dev
- qttools5-dev-tools
stage-packages:
- libqt5xml5
after: [desktop-qt5]
CMake installs the application icon to:
# Install icons
install(FILES data/icons/heimer.png DESTINATION share/pixmaps)
install(FILES data/icons/heimer.png DESTINATION share/icons/hicolor/64x64/apps)
Desktop file is installed to:
# Install .desktop files
install(FILES ${CMAKE_BINARY_DIR}/heimer.desktop DESTINATION share/applications)
I don't understand what the problem is. After installing the snap my application always shows the default system icon in the launcher (Ubuntu 18.04). No warning or anything when creating the package or when running it.
Note: This same setup works for Debian packaging. My Debian package uses exactly the same install locations and the icon works just fine in that case.
Currently, Snapcraft does no processing regarding the desktop entries' icons (thus the system can't find the icons as the icons specified in the desktop entries aren't in the icon search directories) and the packager have to manually patch the Icon value to $SNAP/path/to/the/icon.{png,svg} to the .desktop files specified by the apps._app_name_.desktop keys.
Here’s the
GNU Sed script I've been using for this purpose: https://github.com/Lin-Buo-Ren/snapcrafters-template-plus/blob/5bb7778/snap/utilities/patch-desktop-entries.sed
Utility script for patching: https://github.com/Lin-Buo-Ren/snapcrafters-template-plus/blob/5bb7778/snap/utilities/patch-desktop-entries.bash
Location in-recipe that calls the utility script: https://github.com/Lin-Buo-Ren/snapcrafters-template-plus/blob/5bb7778/snap/snapcraft.yaml#L137-L144
I've filed a proposal to improve this situation at: Proposal: The apps.<app-name>.icon Key - snapcraft - snapcraft.io
Following these steps the icon appears in the desktop (Snap apps)
Go to var/lib/snapd/desktop/application
Copy the .desktop (vlc_vlc.desktop)
Paste it in Desktop
right click and chose allow lunching

unable to launch custom brackets.exe

I have created a desktop app using brackets-shell version sprint-38. I have done the following changes.
config.h -changed APP_NAME from 'Brackets' to 'MyBrackets'.
appshell_config.gypi - changed appname from 'Brackets' to 'MyBrackets'.
Gruntfile - changed build.name from 'Brackets' to 'MyBrackets'.
After building brackets-shell with these changes i used to get 'MyBrackets.exe'
inside brackets-shell/release folder.
while executing the exe one file chooser popup comes, and node & MyBrackets.exe processes will start in the background.
his works fine with Sprint38,But after migrating to brackets-shell tag version release-1.3 or master, this dose not work. The file chooser is not coming as well as no node process starts.
Is any thing i am missing with the latest release ?
Bingo!!!
I got the problem. actually xcopy command is not generating properly in MyBrackets.vscsproj file. and this is well know problem i think so. To fix this problem one fix-msvc.sh file has written.
Since brackets.vscsproj name is hardcoded here so changes is not reflecting in my MyBrackets.vscsproj

How to use the console command DbAcl in CakePHP 2.0

I'm trying to do my first steps with CakePHP 2 console with Leopard and XAMPP but I get many problems which are not clear to me.
In the CakePHP 2.0 guide is written i need to setup correctly /app/Config/database.php to be sure it works, then I've tested it with an user registration and everything works.
Then I've read I can call the command via shell:
$ cake schema create DbAcl
This doesn't work because I must write the right path to the console app, then:
$ /Users/username/.../site.com/lib/Cake/Console/cake schema create DbAcl
After did that I get this error:
Welcome to CakePHP v2.0.4 Console
---------------------------------------------------------------
App : username
Path: /Users/username/
---------------------------------------------------------------
Cake Schema Shell
---------------------------------------------------------------
/Users/username/Config/Schema/db_acl.php could not be loaded
iMac-Name:~ username$
My CakePHP installation is located in the folder site.com:
site.com/app
site.com/lib
site.com/plugins
site.com/vendors
site.com/etc.
So I did this to change the CakePHP folder to the installation folder named site.com
$ /Users/username/.../site.com/lib/Cake/Console/cake -app /Users/.../site.com
Now I get this message:
Welcome to CakePHP v2.0.4 Console
---------------------------------------------------------------
App : site.com
Path: /Users/.../public_html/site.com/
---------------------------------------------------------------
Current Paths:
-app: site.com
-working: /Users/.../site.com
-root: /Users/.../public_html
-core: /Users/.../site.com/lib
Now if I write
$ /Users/username/.../site.com/lib/Cake/Console/cake schema create DbAcl
I get the wrong original path again with a different error:
Welcome to CakePHP v2.0.4 Console
---------------------------------------------------------------
App : username
Path: /Users/username/
---------------------------------------------------------------
Cake Schema Shell
---------------------------------------------------------------
/Users/username/Config/Schema/db_acl.php could not be loaded
How can I fix the path correctly?
strange thing, if I set user folder first, it works correctly:
$ cd folder/webserver/public_html/cake-app-folder
$ sudo lib/Cake/Console/cake schema DbAcl
in this way it works perfect
The real reason why many people that want to use Cakephp ACL system face this problem is that they ignore the right position where they should be before execute this command.
If you notice the error message, it says : "/Users/username/Config/Schema/db_acl.php could not be loaded".
Which is normal, actually the db_acl.php file is located in /Users/username/app/Config/Schema/db_acl.php
==> To let cakePhp fetch the file from the right place you have to be positioned in the app folder of your cake project before executing the command (cd folder/webserver/public_html/cake-app-folder in your case or c:\wamp\www\cakeTest\app for a windows project case)
Dr.Lotfi
Coopa' easy'

Clang with Xcode 4 error: invalide option nodistribute

I have been trying to get clang's analysis tool working, but I am not sure how to overcome a particular error when I run it. I have installed X-Code 4.0 and iOS 5 the output I get is:
Generating class dependency graph.
Launching /Users//Desktop/HomeWork2/tools/AnalysisTool.app/Contents/Resources/llvm/utils/scan-build with arguments: (
"-o",
"/Users/<homedir>/Development/myApp/Static analysis/results",
"-v",
"--status-bugs",
"-checker-cfref",
"-warn-dead-stores",
"-warn-objc-methodsigs",
"-warn-objc-missing-dealloc",
"-warn-objc-unused-ivars",
"-analysistool-checker-access-control",
"-analysistool-checker-coersions",
"-analysistool-checker-cyclomatic-complexity",
"-analysistool-checker-conditional-logical-complexity",
"-analysistool-checker-conditional-nesting-depth",
"-analysistool-checker-loop-nesting-depth",
"-analysistool-checker-dealloc-safety",
"-analysistool-checker-declaration-conventions",
"-analysistool-checker-discouraged-method-calls",
"-analysistool-checker-error-handling",
"-analysistool-checker-extra-parentheses",
"-analysistool-checker-finalize",
"-analysistool-checker-format-strings",
"-analysistool-checker-kvo",
"-analysistool-checker-memory-management",
"-analysistool-checker-naming-conventions",
"-analysistool-checker-shadow",
"-analysistool-checker-unused-ivars",
"--use-cc=/Developer/usr/bin/llvm-gcc-4.2",
"--use-c++=/Developer/usr/bin/llvm-g++-4.2",
"-generate-class-dependency-graph",
xcodebuild,
"CONFIGURATION_BUILD_DIR=/Users/<homedir>/Development/myApp/Static analysis/build",
"CONFIGURATION_TEMP_DIR=/Users/<homedir>/Development/myApp/Static analysis/build",
"-configuration",
Debug,
clean,
build
).
scan-build: Emitting reports for this run to '/Users//Development/AMMO_SVN_Projects/MobXpo/branches/MobXpo_v12/Static analysis/results/2011-06-30-8'.
scan-build: 'clang-cc' executable not found in '/Users//Desktop/SWEN_646/HW2/tools/AnalysisTool.app/Contents/Resources/llvm/utils/libexec'.
scan-build: Using 'clang-cc' from path.
xcodebuild: error: invalid option '-nodistribute'
Usage: xcodebuild [-project ] [[-target ]...|-alltargets] [-configuration ] [-arch ]... [-sdk [|]] [=]... []...
xcodebuild -workspace -scheme [-configuration ] [-arch ]... [-sdk [|]] [=]... []...
xcodebuild -version [-sdk [|] [] ]
xcodebuild -list [[-project ]|[-workspace ]]
xcodebuild -showsdks
Options:
-usage print full usage
-verbose provide additional status output
-project NAME build the project NAME
-target NAME build the target NAME
-alltargets build all targets
-workspace NAME build the workspace NAME
-scheme NAME build the scheme NAME
-configuration NAME use the build configuration NAME for building each target
-xcconfig PATH apply the build settings defined in the file at PATH as overrides
-arch ARCH build each target for the architecture ARCH; this will override architectures defined in the project
-sdk SDK use SDK as the name or path of the base SDK when building the project
-parallelizeTargets build independent targets in parallel
-jobs NUMBER specify the maximum number of concurrent build operations
-showsdks display a compact list of the installed SDKs
-list lists the targets and configurations in a project, or the schemes in a workspace
-find BINARY display the full path to BINARY in the provided SDK
-version display the version of Xcode; with -sdk will display info about one or all installed SDKs
I have researched the internet but I have found nothing to help my specific problem. I think what i need to do is edit the clang tool to not include the "nodistribute" option, but im not sure if there is another way or where to get the source code to do so. Thanks in advance for any help.
I found a way around this after a lot of looking for an answer I decided to see if I could modify the line of code that was including the -nodistribute option. So I used grep to find the line of code in the .app bundle and then opened it in vi. I added a comment # to the line and bingo, off to the races.
The file, relative to the app bundle root is found at: ./Resources/llvm/utils/scan-build

Resources