all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: 47655@debbugs.gnu.org
Subject: bug#47655: QML2_IMPORT_PATH does not work in a profile
Date: Thu, 08 Apr 2021 09:42:24 -0400	[thread overview]
Message-ID: <877dlcnb9b.fsf@gmail.com> (raw)

Hello Guix,

When setting up a profile (via 'guix environment', for example) to
develop a Qt application, the search paths set by qtbase point to the
environment profile, which is a forest of symbolic links.  Apparently
this doesn't play well with at least QML2_IMPORT_PATH: the Qt
application built in the profile will not run, and Qt crashes in an
inscrutable way.

The following details a reproducer, which attempts to build jami-qt in
its 'guix environment' profile.

Reproduction steps:

1. Prepare the sources

$ cp -r $(guix build -S jami-qt) /tmp/jami-qt-checkout
$ cd /tmp/jami-qt-checkout
$ chmod +rw -R .

2. Enter the development environment

$ guix environment jami-qt

3. Create the build directory and bootstrap the build system

$ mkdir build && cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=$PWD/install

4. Build/install it locally.

$ make -j8 install

5. Try to run it

(if on a foreign distro rather than Guix System, you'll want to start
the daemon, 'dring' from the libring package manually -- but that's
another issue)

--8<---------------cut here---------------start------------->8---
$ install/bin/jami-qt --debug
No migration required
Can't open file:  "/home/maxim/.local/share/jami/d1c0b261a081d4ce/profile.vcf"
Terminated
--8<---------------cut here---------------end--------------->8---

The "Can't open file" warning is harmless and not at cause.

From a preliminary investigation, it appears to be caused by the fact
that the QML2_IMPORT_PATH environment variable points to a profile
entry, which is a forest of symbolic links:

--8<---------------cut here---------------start------------->8---
$ echo $QML2_IMPORT_PATH
/gnu/store/6i6d2zyxbkgmw20dk1ccsnwsdlnc8431-profile/lib/qt5/qml
--8<---------------cut here---------------end--------------->8---

Compared to what's in the wrapper of the jami-qt packaged binary (which
does run!):

--8<---------------cut here---------------start------------->8---
$ cat $(guix build jami-qt)/bin/jami-qt | grep QML2
export QML2_IMPORT_PATH="/gnu/store/7lh6gpnv3aszlaa24az247xnnh2j8yaj-qtwebengine-5.15.2/lib/qt5/qml:/gnu/store/z9z83c3b3y655sjv3iv42pq70dwifv99-qtwebchannel-5.15.2/lib/qt5/qml:/gnu/store/xzyjqlycxwys0fq6pgs5v5n24n7zgddl-qtmultimedia-5.15.2/lib/qt5/qml:/gnu/store/ry4k8i6j3y9h4ws48jc8wsc5gky7phaj-qtdeclarative-5.15.2/lib/qt5/qml:/gnu/store/9p2xxq0cwmycf9k6rcljk8bn0d3sl2n7-qtgraphicaleffects-5.15.2/lib/qt5/qml:/gnu/store/32c7xbjmx6ijb6fl5kkbvpq2p2pxs54c-qtquickcontrols-5.15.2/lib/qt5/qml:/gnu/store/52x80xcnh912v76i09f1gaqpll5v2n73-qtquickcontrols2-5.15.2/lib/qt5/qml"
--8<---------------cut here---------------end--------------->8---

Due to having been captured at build time, where there was no profile
involved, the individual components have been added and no symbolic
links is involved.

If we try to run our custom built jami-qt with this variable set, it
proceeds a bit further:

--8<---------------cut here---------------start------------->8---
$ export QML2_IMPORT_PATH="/gnu/store/7lh6gpnv3aszlaa24az247xnnh2j8yaj-qtwebengine-5.15.2/lib/qt5/qml:/gnu/store/z9z83c3b3y655sjv3iv42pq70dwifv99-qtwebchannel-5.15.2/lib/qt5/qml:/gnu/store/xzyjqlycxwys0fq6pgs5v5n24n7zgddl-qtmultimedia-5.15.2/lib/qt5/qml:/gnu/store/ry4k8i6j3y9h4ws48jc8wsc5gky7phaj-qtdeclarative-5.15.2/lib/qt5/qml:/gnu/store/9p2xxq0cwmycf9k6rcljk8bn0d3sl2n7-qtgraphicaleffects-5.15.2/lib/qt5/qml:/gnu/store/32c7xbjmx6ijb6fl5kkbvpq2p2pxs54c-qtquickcontrols-5.15.2/lib/qt5/qml:/gnu/store/52x80xcnh912v76i09f1gaqpll5v2n73-qtquickcontrols2-5.15.2/lib/qt5/qml"
$ install/bin/jami-qt --debug
No migration required
Can't open file:  "/home/maxim/.local/share/jami/d1c0b261a081d4ce/profile.vcf"
QQmlApplicationEngine failed to load component
qrc:/src/MainApplicationWindow.qml:39:1: Type ApplicationWindow unavailable
file:///gnu/store/66w3pq3zq6dqc6khg3i0fly31i8drws7-qtquickcontrols2-5.15.2/lib/qt5/qml/QtQuick/Controls.2/qmldir: plugin cannot be loaded for module ".gnu.store.66w3pq3zq6dqc6khg3i0fly31i8drws7-qtquickcontrols2-5.15.2.lib.qt5.qml.QtQuick.Controls": Module namespace 'QtQuick.Controls' does not match import URI '.gnu.store.66w3pq3zq6dqc6khg3i0fly31i8drws7-qtquickcontrols2-5.15.2.lib.qt5.qml.QtQuick.Controls'
lookup name NOT FOUND: "" "5534e909984953c9"
lookup name NOT FOUND: "" "5534e909984953c9"
lookup name NOT FOUND: "" "5534e909984953c9"
lookup name NOT FOUND: "" "5534e909984953c9"
lookup name NOT FOUND: "" "5534e909984953c9"
lookup name NOT FOUND: "" "dc553d8268bba4bd"
lookup name NOT FOUND: "" "dc553d8268bba4bd"
NetworkManager client initialized, version:  1.24.0 , daemon running: yes , networking enabled: yes
primary network connection: faee05bd-57e1-46d1-824a-4f90a067d472 default:  yes
--8<---------------cut here---------------end--------------->8---

It still fails to draw the window, probably due to the load error above,
which appears to be caused by a file name mismatch between what was
registered in the application at compile time and what is being loaded
(my guess).

The QML_IMPORT_TRACE variable can also be set to get a more verbose
output from the QML import machinery:

--8<---------------cut here---------------start------------->8---
$ unset QML2_IMPORT_PATH
$ source $GUIX_ENVIRONMENT/etc/profile
$ export QML_IMPORT_TRACE=1
$ install/bin/jami-qt --debug
QQmlImportDatabase::addImportPath: "/gnu/store/6i6d2zyxbkgmw20dk1ccsnwsdlnc8431-profile/lib/qt5/qml"
QQmlImportDatabase::addImportPath: "/gnu/store/6i6d2zyxbkgmw20dk1ccsnwsdlnc8431-profile/lib/qt5/qml"
QQmlImportDatabase::addImportPath: "qrc:/qt-project.org/imports"
QQmlImportDatabase::addImportPath: "/tmp/jami-qt-checkout/build/install/bin"
No migration required
Can't open file:  "/home/maxim/.local/share/jami/d1c0b261a081d4ce/profile.vcf"
QQmlImports(qrc:/src/MainApplicationWindow.qml)::addLibraryImport: "QtQuick" 2.14 as ""
QQmlImports(qrc:/src/MainApplicationWindow.qml)::importExtension: loaded "/gnu/store/6i6d2zyxbkgmw20dk1ccsnwsdlnc8431-profile/lib/qt5/qml/QtQuick.2/qmldir"
QQmlImportDatabase::registerPluginTypes: "QtQuick" from "/gnu/store/6i6d2zyxbkgmw20dk1ccsnwsdlnc8431-profile/lib/qt5/qml/QtQuick.2"
QQmlImports(qrc:/src/MainApplicationWindow.qml)::addLibraryImport: "QtQuick.Window" 2.14 as ""
QQmlImports(qrc:/src/MainApplicationWindow.qml)::importExtension: loaded "/gnu/store/6i6d2zyxbkgmw20dk1ccsnwsdlnc8431-profile/lib/qt5/qml/QtQuick/Window.2/qmldir"
QQmlImportDatabase::registerPluginTypes: "QtQuick.Window" from "/gnu/store/6i6d2zyxbkgmw20dk1ccsnwsdlnc8431-profile/lib/qt5/qml/QtQuick/Window.2"
QQmlImports(qrc:/src/MainApplicationWindow.qml)::addLibraryImport: "QtQuick.Controls" 2.14 as ""
QQmlImports(qrc:/src/MainApplicationWindow.qml)::importExtension: loaded "/gnu/store/6i6d2zyxbkgmw20dk1ccsnwsdlnc8431-profile/lib/qt5/qml/QtQuick/Controls.2/qmldir"
QQmlImportDatabase::registerPluginTypes: "QtQuick.Controls" from "/gnu/store/6i6d2zyxbkgmw20dk1ccsnwsdlnc8431-profile/lib/qt5/qml/QtQuick/Controls.2"
Terminated
--8<---------------cut here---------------end--------------->8---

An idea of something to investigate would be to review the code dealing
with importing the QML modules in the qtdeclarative sources, and
ensuring that it applies QDir::canonicalPath everytime it's handling an
import file name (to deal with the actual file rather than a symlink
pointing to it).

Thoughts?

Thanks,

Maxim




             reply	other threads:[~2021-04-08 13:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 13:42 Maxim Cournoyer [this message]
2021-04-08 15:49 ` bug#47655: QML2_IMPORT_PATH does not work in a profile Maxim Cournoyer
2022-08-02  4:44 ` Maxim Cournoyer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877dlcnb9b.fsf@gmail.com \
    --to=maxim.cournoyer@gmail.com \
    --cc=47655@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.