在鸿蒙设备上体验 Air 系列软件:Krita 与 Audacity 的 Qt/KDE 观察
最近看到 GitCode 上的 Air 系列软件项目,比较有兴趣。这个系列主要尝试将一些桌面开源软件移植到 HarmonyOS 上。
项目仓库:
我自己比较关注 Qt / KDE 应用在 HarmonyOS 上的移植情况,所以这次主要体验了 Krita 和 Audacity。
最近看到 GitCode 上的 Air 系列软件项目,比较有兴趣。这个系列主要尝试将一些桌面开源软件移植到 HarmonyOS 上。
项目仓库:
我自己比较关注 Qt / KDE 应用在 HarmonyOS 上的移植情况,所以这次主要体验了 Krita 和 Audacity。
Assume you have a host(x86_64) build of qtbase, like following:
|
1 2 3 4 5 6 7 |
cd ~/qt git clone git://code.qt.io/qt/qtbase.git mkdir qtbase-build cd qtbase-build ../qtbase/configure -developer-build -opensource -confirm-license -nomake examples -nomake tests -verbose cmake --build . --parallel -j8 |
Some extra work to setup system:
Install Ubuntu 23.10, for me, it’s an VM via VMware Fusion 13.5.0 on MacBook Pro 2019.
Install some needed packages,
|
1 2 3 4 5 6 7 8 |
sudo apt install -y zsh build-essential perl python3 git sudo snap install cmake --classic sudo apt install ninja-build sudo apt-get build-dep qtbase-opensource-src sudo apt-get install libxcb-xinerama0-dev sudo apt-get install '^libxcb.*-dev' libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev libxkbcommon-dev libxkbcommon-x11-dev sudo apt-get install libdbus-1-dev libglib2.0-dev |
Default gcc/g++ is 13.2.0.
Add following in env:
|
1 2 3 |
export MAKEFLAGS='--jobs=8' export CMAKE_GENERATOR=Ninja |
XDG Desktop Portal and Flatpak are more and more in used. If you are using Qt, Flatpak KDE runtime is a good place to start, install pre-built Qt binaries in Flatpak world. But it’s normally for the released versions.
If you want to play with the edge of Qt, for example, dev branch, you can try following steps:
|
1 2 3 4 5 6 7 8 9 10 |
git clone https://github.com/liangqi/flatpak-kde-runtime.git cd flatpak-kde-runtime make remotes make check make org.kde.Sdk.app cd repo flatpak remote-add --user --no-gpg-verify liang-flatpak file://$(pwd) flatpak install --user liang-flatpak org.kde.Platform flatpak install --user liang-flatpak org.kde.Sdk |
And here is an example at io.qt.examples.dropsite.yaml
|
1 2 3 4 |
git clone https://github.com/liangqi/dropsite-flatpak.git cd dropsite-flatpak flatpak-builder --user --install --force-clean build-dir io.qt.examples.dropsite.yaml |
Thanks bbhtt for the help in matrix.to: Packaging KDE Apps in Flatpaks channel.
最近有关红芯办公浏览器的新闻比较火爆,可以参考搜狐:融资2.5亿的红芯宣称自主创新遭打脸:只是谷歌浏览器换层皮一文。知乎上罗志宇关于自主研发一款浏览器内核的难度到底有多大?一问的回答中提到了KHTML、WebKit、Blink和KDE、Qt以及Trolltech公司(现在的The Qt Company公司)的一些渊源。
Qt 5.5.0 officially released on July 1st. But on OS X, for example 10.10.4+Xcode 6.4(clang-602.0.53), you will have lots of warnings about ‘-Winconsistent-missing-override’, like:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
In file included from moc_widget.cpp:9: In file included from ./../qt55test/widget.h:4: In file included from ../../QtSDK/5.5/clang_64/lib/QtWidgets.framework/Headers/QWidget:1: In file included from ../../QtSDK/5.5/clang_64/lib/QtWidgets.framework/Headers/qwidget.h:38: /Users/liangqi/QtSDK/5.5/clang_64/lib/QtCore.framework/Headers/qobject.h:108:5: warning: unknown warning group '-Winconsistent-missing-override', ignored [-Wunknown-pragmas] Q_OBJECT ^ /Users/liangqi/QtSDK/5.5/clang_64/lib/QtCore.framework/Headers/qobjectdefs.h:156:5: note: expanded from macro 'Q_OBJECT' Q_OBJECT_NO_OVERRIDE_WARNING \ ^ /Users/liangqi/QtSDK/5.5/clang_64/lib/QtCore.framework/Headers/qobjectdefs.h:146:45: note: expanded from macro 'Q_OBJECT_NO_OVERRIDE_WARNING' # define Q_OBJECT_NO_OVERRIDE_WARNING QT_WARNING_DISABLE_CLANG("-Winconsistent-missing-override") ^ /Users/liangqi/QtSDK/5.5/clang_64/lib/QtCore.framework/Headers/qcompilerdetection.h:1125:49: note: expanded from macro 'QT_WARNING_DISABLE_CLANG' # define QT_WARNING_DISABLE_CLANG(text) QT_DO_PRAGMA(clang diagnostic ignored text) ^ /Users/liangqi/QtSDK/5.5/clang_64/lib/QtCore.framework/Headers/qcompilerdetection.h:1096:49: note: expanded from macro 'QT_DO_PRAGMA' #define QT_DO_PRAGMA(text) _Pragma(#text) ^ <scratch space>:28:27: note: expanded from here clang diagnostic ignored "-Winconsistent-missing-override" ^ |
Yes, there is a bug report(QTBUG-46833) for it. And the fix is in 7d5e849e.
The solution is:
|
1 2 3 4 |
cd ~/QtSDK/5.5/clang_64/lib/QtCore.framework/Headers cp qcompilerdetection.h qcompilerdetection.h.bak vi qcompilerdetection.h |
Go to Line 158, change 6020049 to 7000053. Save it!
For example, I am reading Gunnar Sletta’s blog, New Scene Graph Renderer.
I guess the change is b480fa83, it’s already merged in stable(5.2.x). After talked with Gunnar, he mentioned that the result in lastest stable is perhaps very different with the blog, because there was another big change, v4, also already in stable.
I think I need to have the environment to reproduce the “scene” at that commit, b480fa83.
First, I had a look at the status of that change.
|
1 2 3 4 5 6 |
$ cd ~/qt/qt5 $ git checkout dev; git pull $ cd qtdeclarative $ git checkout dev; git pull $ git checkout -b new_sg b480fa83 $ cat sync.profile |
In the dependencies part, I found:
|
1 2 3 4 |
%dependencies = ( "qtbase" => "9de144f4b15b1b97d55922e3e0bc846080c5bb62", "qtxmlpatterns" => "", ); |
qtdeclarative depends on qtbase and qtxmlpatterns repo. For this example, just in case, we have an explicit sha1 in qtbase. It’s uncommon. Normally it’s just like the case for qtxmlpatterns, an empty string.
Next, the change in codereview.qt-project.org is this.
I found the latest information when that change was integrated, QtDeclarative_dev_Integration #719: SUCCESS.
In Qt CI results, the results for QtDeclarative_dev_Integration #719, I chose macx-clang_developer-build_OSX_10.8, then I am in this page.
Searching qtbase, you could find some information like:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
... + perl ./init-repository --mirror qtgitreadonly: --module-subset=qtbase,qtxmlpatterns -force ... + CWD: /work/build/qt/qtbase + git reset --hard 9de144f4b15b1b97d55922e3e0bc846080c5bb62 ... + CWD: /work/build/qt/qtxmlpatterns + git fetch --verbose --update-head-ok origin +refs/heads/dev:refs/heads/dev From git://qt-git.ci.local/qt/qtxmlpatterns * [new branch] dev -> dev + git reset --hard refs/heads/dev HEAD is now at 5b4b3fb QtXmlPatterns: Fix (!a == b) bug ... |
I think I know what I should do for qtbase and qtxmlpatterns.
|
1 2 3 4 5 6 |
$ cd ~/qt/qt5/qtbase $ git checkout dev; git pull $ git checkout -b new_sg 9de144f4 $ cd ~/qt/qt5/qtxmlpatterns $ git checkout dev; git pull $ git checkout -b new_sg 5b4b3fb |
Now I could have a shadow build and play with it.
There is a work from Oswald Buddenhagen, his change, qtrepotools: add mirror script.
You need to have an account of codereview(gerrit) and set up the ssh keys well, more info in Contribute to Qt.
Here is the qt-codereview-mirror shell script in github.
I set up this mirror script on a Ubuntu 13.04 machine. You need to check following before to run it:
|
1 |
sudo apt-get install git procmail |
You could have a try run for the above script. If it works well for you, you can add it into your crontab, see also Ubuntu: CronHowto.
Next is to run a git server on your machine. I use git-daemon for this task.
|
1 |
git daemon --base-path=/data/repos --export-all & |
If you need to push change to upstream, then you should set up gerrit remote.
|
1 2 3 |
git clone git://yourmirror/qt/qt.git cd qt4 git remote add gerrit ssh://codereview.qt-project.org/qt/qt |
init-repository will help you set up gerrit remote for each repo.
|
1 2 3 |
git clone git://yourmirror/qt/qt5.git cd qt5 ./init-repository -f --mirror git://yourmirror/ |
Qt is a huge project, especially like the module, QtWebKit. If you happen to be in a computer farm, it is very useful to use distributed complation to speed up the build of Qt.
Here I suggest to use icecream on Linux and Mac OS X, and IncrediBuild on Windows(at least for Microsoft’s Visual Studio compilers). About IncrediBuild, more details perhaps will be updated in the future. See also qtrepotools: publish ibmake.bat, incredibuild xge wrapper for make/buildconsole.
Today, this blog is more about icecc/icecream.
icecream is maintained by the SUSE people. Then there are less issues in OpenSUSE than in Ubuntu. But Ubuntu is more popular one. I just use Ubuntu as example here.
|
1 2 |
sudo apt-get install icecc sudo apt-get install icemon (optional) |
$ sudo ln -s /usr/include/clang/3.2/include /usr/lib/clang/3.2/$ sudo ln -s /usr/include/clang /usr/lib/|
1 2 3 4 5 6 7 8 9 10 11 12 13 |
$ gcc --version gcc (Ubuntu/Linaro 4.7.3-1ubuntu1) 4.7.3 $ /usr/lib/icecc/icecc-create-env --gcc /usr/bin/gcc /usr/bin/g++ ... creating 0b6089afb59bbcef327c8ec59b021132.tar.gz $ mv 0b6089afb59bbcef327c8ec59b021132.tar.gz ~/icecc-package-gcc-4.7.3.tar.gz $ clang --version Ubuntu clang version 3.2-1~exp9ubuntu1 (tags/RELEASE_32/final) (based on LLVM 3.2) $ /usr/lib/icecc/icecc-create-env --clang /usr/bin/clang /usr/lib/icecc/compilerwrapper … creating bbfeb5eb17d851d04a17bed5f9f1f621.tar.gz $ mv bbfeb5eb17d851d04a17bed5f9f1f621.tar.gz ~/icecc-package-clang-3.2-1.tar.gz |
|
1 2 3 4 5 6 7 8 9 |
$ cat .icecc_rc-gcc export PATH=/usr/lib/icecc/bin:$PATH export ICECC_VERSION=/home/liangqi/icecc-package-gcc-4.7.3.tar.gz alias make="make -j48" $ cat .icecc_rc-clang export PATH=/usr/lib/icecc/bin:$PATH export ICECC_VERSION=/home/liangqi/icecc-package-clang-3.2-1.tar.gz alias make="make -j48" |
/etc/default/icecc, set START_ICECC_SCHEDULER="true".sudo /etc/init.d/icecc start, icecc-scheduler service also could be started with this. Not suggest to run multiple icecc-scheduler in same network with default values, you could edit /etc/icecc/icecc.conf with more options.sudo /etc/init.d/icecc stop|
1 |
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)" |
/usr/local/Library/Formula/ .brew install icecream icemon|
1 2 3 4 5 6 7 8 |
$ clang --version Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn) Target: x86_64-apple-darwin12.4.0 Thread model: posix $ /usr/local/opt/icecream/libexec/icecc/icecc-create-env --clang /usr/bin/clang /usr/local/opt/icecream/libexec/icecc/compilerwrapper … creating bbfeb5eb17d851d04a17bed5f9f1f621.tar.gz $ mv bbfeb5eb17d851d04a17bed5f9f1f621.tar.gz ~/icecc-package-clang-3.2-svn.tar.gz |
|
1 2 3 4 |
$ cat .icecc_rc export PATH=/usr/local/opt/icecream/libexec/icecc/bin:$PATH #export ICECC_VERSION=/Users/liangqi/icecc-package-clang-3.2-svn.tar.gz alias make="make -j48 CC=clang CXX=clang++" |
/Library/LaunchDaemons .sudo chown root /Library/LaunchDaemons/com.github.iceccd.plistsudo launchctl load /Library/LaunchDaemons/com.github.iceccd.plistsudo launchctl unload /Library/LaunchDaemons/com.github.iceccd.plistNormally just do source ~/.icecc_rc, configure and make.
-no-pch when configure.-arch argument that Qt 4 passes to the compiler confuses icecream. So for now, if you use Qt4, you need to patch your mkspec to not add that (if you build for your local architecture only), eg. in mkspecs/common/gcc-base-macx.conf.(Note: looks like it’s only on Mac OS X, I haven’t tried it yet.)For an application on OS X, the Info.plist file is very common. But could we embed it into the binaries?
Yes, we can. There is a compiler option “–sectcreate __TEXT __info_plist Info.plist”.
One example is the .pro file for qmlplugindump in qtdeclrative, change 4d173d5f16c103f640d4089feed44a74b14e9004.
|
1 2 3 4 5 6 7 |
mac { # Prevent qmlplugindump from popping up in the dock when launched. # We embed the Info.plist file, so the application doesn't need to # be a bundle. QMAKE_LFLAGS += -sectcreate __TEXT __info_plist $$shell_quote($$PWD/Info.plist) CONFIG -= app_bundle } |
I learned it from ariya‘s commit in phantomjs: 71425850f61ad85e33741ed5a59364327532f6a8.
|
1 2 3 4 5 6 7 |
mac { QMAKE_CXXFLAGS += -fvisibility=hidden QMAKE_LFLAGS += '-sectcreate __TEXT __info_plist Info.plist' CONFIG -= app_bundle # Uncomment to build a Mac OS X Universal Binary (i.e. x86 + ppc) # CONFIG += x86 ppc } |
And today I read an article: Gimmedebugah: how to embedded a Info.plist into arbitrary binaries, which also mentioned this. And it gives me the Apple documentation for that, Code Signing Tasks: Adding an Info.plist to Single-File Tools.