Application icon doesn't work with Snap packaging - qt

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

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!

How to package Qt5 application with snapcraft

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).

meta-qt- yocto layer- change default qt platform (QT_QPA_PLATFORM)

I'm using Yocto buildsystem to create an image for raspberry pi that contains Qt5, but I'm having problems with configuring qtbase properly.
Due to those problems when I run Qt app I get an error:
This application failed to start because it could not find or load the Qt platform plugin "xcb" in "".
Available platform plugins are: eglfs, minimal, minimalegl, offscreen.
Reinstalling the application may fix this problem.
Aborted (core dumped)
On the other hand if I start my app like so:
myApp -platform eglfs
it works properly. The same if I set environment variable QT_QPA_PLATFORM=eglfs - it works.
How can I set my default platform to eglfs and not to xcb?
I have tried to set it like below (in my distro.conf):
DISTRO_FEATURES_remove = "x11"
DISTRO_FEATURES_append = " gles2"
PACKAGECONFIG_GL_pn-qtbase = "gles2"
PACKAGECONFIG_X11_pn-qtbase = ""
PACKAGECONFIG_pn-qtbase += "gles2"
PACKAGECONFIG_pn-qtbase += "dbus udev evdev widgets tools libs"
Unfortunately it did not help and my application still shows this error if I don't set platform explicitly.
all you have to do is:
in /etc/profile, add
export QT_QPA_PLATFORM=eglfs so that every time you logged in the machine, it will automatically does it for you.
Or if you do not know what your graphic backends is. The following is the corresponding
Backend: FB; XWayland; X11
GRAPHICS: eglfs; wayland-egl; xcb
export QT_QPA_PLATFORM=${GRAPHICS}

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

Version information on Xserver modules

I am trying to find a tool that will extract the module version information (a part of the module record) fron an Xserver module. For example, in the Xorg logs I can see the following information for the librecord module in my Xorg.0.log file...
[ 39.892] (II) Loading /usr/lib/xorg/modules/extensions/librecord.so
[ 39.905] (II) Module record: vendor="X.Org Foundation"
[ 39.905] compiled for 1.9.0, module version = 1.13.0
[ 39.905] Module class: X.Org Server Extension
[ 39.905] ABI class: X.Org Server Extension, version 4.0
Is there a tools that would allow me to easily extract the aforementioned information. Sometimes you can use modinfo on the module and that will have version information, but that does not always work. The only consistent way I know of now is to parse the xorg log file. Thanks.
Yes, there is and you can also try to write a small one.
http://gitorious.org/xdriverprobe
The problem is that xdriverprobe won't compile on newer servers since I didn't update it to the newest ABIs. Also, xdriverprobe is only used for video drivers, but it can be adapted to be used on other modules. The main source code file (xdriverprobe.c) has less than 500 lines, so you can easily learn by reading it.
It works in Ubuntu 11.10... ./xdriverprobe -o moduledata gives the information you want.
Look at its source code. It does:
dlopen() the module
find a symbol called modulenameModuleData (if your module is called modulename)
that symbol is a XF86ModuleData* See /usr/include/xorg/xf86Module.h
check its member named vers
Spend a few hours and you'll be able to write a very tiny code that does what you want.
More information: http://www.xfree86.org/current/DESIGN17.html#65 (very old document, but most of what's written there is still true today). If you're not happy with that document, you have to read the Xorg source code.
Happy hacking!

Resources