Closed timlinux closed 1 year ago
Some further analysis:
I went spelunking in /nix/store a little:
ls | grep qtbase-5
7m1px7m2zvidm7w3s93qjgvpkvdzwp8c-qtbase-5.15.9-dev
9j0acz9qqp1lygwif5jncpz8hsyfmylw-qtbase-5.15.9-bin
b085hafh1ph7alj1nnbzmz29znni4v5w-qtbase-5.15.9
d1wlnn97g744ypyi57i10hd9y2v7r2x4-qtbase-5.15.9.drv
dg22lkxp1jfcyw1i971zlydi87w837ad-qtbase-5.15.9-dev
dqc9m05g5z0jkj8f3yq168qcd5x772z1-qtbase-5.15.9.drv
fbyd6iqs912slzw47ng5xm3k5hg0v56g-qtbase-5.15.9.drv
kqghllpfj5kcfyns1aldl7lmcszvz8nz-qtbase-5.15.9-bin
ph7x48dvr0mkv5dvjmkip2rswsv8yq5r-qtbase-5.15.9.drv
w0rqvc39zhlv1b633zim1rwva0hbij85-qtbase-5.15.9
We can see that in the bin folders, if we dig down, we can find the platform plugins folder.
ls 9j0acz9qqp1lygwif5jncpz8hsyfmylw-qtbase-5.15.9-bin/lib/qt-5.15.9/plugins/platforms
libqeglfs.so libqlinuxfb.so libqminimal.so libqminimalegl.so libqoffscreen.so libqvnc.so libqxcb.so
📝 In the above listing we can see the libqoffscreen.so that is the heart of our troubles:
So next i will try to match which derivation is being used by our QGIS build and understand what platform plugins are listed there.
Another nugget (which you will see is commented out in unwrapped.nix) is to add
QT_QPA_PLATFORM_PLUGIN_PATH="${qt5.qtbase.bin}/lib/qt-${qt5.qtbase.versi on}/plugins/platforms";
To the environment, though I am still unsure how to do that,
@timlinux This is how you can add environment variables for the runtime:
Hi @timlinux , sorry for not replying sooner, but I just returned from my vacation and I am just catching up on notifications. I am very excited to see you interested in Nix.
I was trying to update QGIS in https://github.com/NixOS/nixpkgs/pull/224805 ,but as you saw, I failed there. Yes, it looks like that QGIS can't find offscreen
for some reason. I'll try to set QT_QPA_PLATFORM_PLUGIN_PATH
and will see if it helps.
Do you have any update since your last comment ?
BTW, you are very welcome to join Nix Geospatial Team.
Hi @timlinux , sorry for not replying sooner, but I just returned from my vacation and I am just catching up on notifications. I am very excited to see you interested in Nix.
I was trying to update QGIS in #224805 ,but as you saw, I failed there. Yes, it looks like that QGIS can't find
offscreen
for some reason. I'll try to setQT_QPA_PLATFORM_PLUGIN_PATH
and will see if it helps.Do you have any update since your last comment ?
BTW, you are very welcome to join Nix Geospatial Team.
Hi @imincik
Thanks very much. So I will share my updates soon, but I have still been hacking away trying to make things work. I am looking at three variants:
I don't know if there is any broader appeal of the without python variant, but I would probable suggest merging in my WITH_QSCIAPI=False changed version for now since it is a better outcome than having no latest release available at all. We can just annotate this caveat in a README in the interim.
I'll put another update here soon with the link to the actual changes and eventually offer a PR.
For the longer term fix, I need the help of someone who understands nix better because, from what I can make out, the python/CMakeLists.txt
file needs to call this generate_console_pap.py with the proper Qt platform plugins available to it.
367 COMMAND ${_python} "${APIS_SRC_DIR}/generate_console_pap.py" -platform offscreen "${QGIS_PYTHON_PAP_FILE}" "${APIS_SRC_DIR}" "${APIS_OUT_DIR}"
@imincik Ok PR made (see link above) - would love to get your feedback.
Still no GRASS and SAGA support which I would like to figure out still....
🏰Background
The QGIS packages by default are out of date from what is available upstream at https://qgis.org
My name is Tim (@timlinux) and I am a member of the QGIS community.
This issue tries to synthesize all of the learnings and issues I have relating to building the latest derivation on Nixos.
🗓️ Prior Work: The QGIS package (and other important dependant packages like GDAL etc.) are maintained by the Nixos Geospatial Team as per this announcement - my changes in my fork are just slight tweaks to their work to try to move us closer to having up to date packages on Nixos again.
🏃♂️My Workflow
🧑💻 I am working on a fork of the nixpkgs repo 🌳 Branch: nixos-unstable 📦️Package Path: pkgs/applications/gis/qgis 👷Building: In the top level
nixpkgs
git repo folder by doing:nix build .#qgis
🏗️ Changes: The recipe contains two derivations (qgis and qgis.ltr). Since QGIS 3.28 the patching process has diverged a little, so I tweaked the patches appropriate to these versions and their dependencies.🗃️ Files provided:
Entry Points
Patches
Derivations
⛔️ Build Errors
When running
nix build .#qgis
with my updated patches, we get the following error:🥼Diagnosis
I have spent a lot of time trying to figure out what is causing the issue. From this poking around, I understand the cause, as explained below, what needs to be done to fix it, but not how to fix it:
🧨 The cause
CMakeLists.txt
The cause of the issue is this line in the python CMakeLists.txt here: https://github.com/qgis/QGIS/blob/master/python/CMakeLists.txt#L367
-platform offscreen
generate_console_pap.py
👩🏫 Explanation:
offscreen
flag indicates to QApplication that it should use the offscreen platform plugin👩⚖️ Fix Attempts
With reverting to not using the -platform flag at all (as per LTR)
When attempting to use one of the listed Qt platform plugins
It should be noted that my Nixos desktop is running on X11
Attempting to switch over to Gnome on Wayland with
-platform wayland
failsCurious if compiling under wayland would make any difference, I changed my Nixos config to run under wayland. It still fails:
Existing attempts to fix
Fixing the issue
I should have mentioned at the start of this ticket, I am a new Nixos user, so apologies for any misused terms etc. That status also means I don't have insight into how to configure the build process to ensure that the offscreen Qt QApplication plugin is available to QGIS, but I am pretty sure if this can be resolved (either e.g. as a flag to the build process or as an upstream fix to the Qt5 packaging), QGIS builds will work again.
Once we resolve this, I will make a PR and try to get QGIS building an up to date version again.
Notify maintainers
@imincik @sikmir @nh2 @willcohen
Metadata
Please run
nix-shell -p nix-info --run "nix-info -m"
and paste the result.