Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QGIS MacOS Package Improvements #177

Closed
PeterPetrik opened this issue May 18, 2020 · 11 comments
Closed

QGIS MacOS Package Improvements #177

PeterPetrik opened this issue May 18, 2020 · 11 comments
Assignees
Labels
Grant-2020 QEP for 2020 Grant program Implemented

Comments

@PeterPetrik
Copy link

PeterPetrik commented May 18, 2020

QGIS Enhancement: QGIS MacOS Package Improvements

Date 2020/05/18

Author Peter Petrik (@PeterPetrik)

Contact [email protected]

maintainer @PeterPetrik

Version QGIS 3.14

Summary

In 2019, we upgraded the QGIS macOS packaging method to address several issues at that time. This was made possible with the help of the QGIS project and donors who supported this work. The new method is more transparent and uses an automated packaging approach but also comes with its own limitations, mostly related to its strong dependency on Homebrew.

Last month we finished a prototype for building of all required QGIS dependencies without Homebrew. This now allows the continuous integration of MacOS builds in the QGIS CI infrastructure. The set of dependencies used could be downloaded and used to easily compile QGIS master for new MacOS developers as described in the INSTALL file and this blog post

Within this QEP, we propose finalizing the prototype and using it for regular QGIS bundles. This would solve many packaging problems and automatically upgrade GDAL, PROJ, GRASS and others to more up-to-date versions.

Existing MacOS Packager

Normally, Homebrew is used to fetch QGIS dependencies and to compile only QGIS for the LTR, PR and nightly releases. The main problems with this approach are:

Homebrew can only support one version of a given package. This stops QGIS from being built against multiple versions of, for example the GDAL or Proj libraries. On one hand, we want QGIS nightlies to use more bleeding edge versions of the dependencies (e.g. for plugin or core developers) . On the other hand, we want to use more stable and tested versions of dependencies for the PR or LTR builds (e.g. for users and organisations). OSGeo4W manages to succeed in offering these different versions of QGIS in Windows but unfortunately, Homebrew does not offer such an option.

For packaging the QGIS bundle, we relied on Python scripting to automatically determine the linked libraries. Also we used absolute paths for links between dynamic libraries, which resulted in the bundle that worked only with specific default install location. The automatic system was difficult to maintain, due to various architecture choices made at the time, sometimes connected with how Homebrew works.

Proposed Solution

We propose using the new system of dependencies for QGIS builds. This would guarantee full control of versions and patches used for MacOS builds, similar to how OSGeo4W handles things. We also propose simplifying the logic in the bundler scripts, to rely more on a hardcoded list of requirements (e.g. add libproj to exactly this location) instead of having an automatic script that needs to decide what to bundle and how to position it in the final path. We would also use rpath instead of hardcoded absolute paths for the linker. This would allow relocation of the final bundle on the user's disk.

To take a closer look at the proposal, you can find the existing proof of the solution in the qgis/QGIS-Mac-Packager repository. The packager has these steps:

  1. Build all dependencies in qgis_deps. This follows the logic used by OSGeo4A, where each dependency has a simple bash build script (e.g. qgis_deps/recipes/gdal/recipe.sh for GDAL). This is run only when some library has changed.
  2. Build QGIS in qgis_build
  3. Bundle it all together qgis_bundle. Here again each dependency has its own bash script to copy the files to the correct final destination and fix rpaths and other bits.
  4. Sign the bundle and create the installer
  5. Upload the final package to the QGIS download area

Issue Tracking ID(s)

  • Update to GDAL3, PROJ6, GRASS 7.8.2 and other major updates link
  • Fix the GRASS and SAGA providers: link link link and others
  • Fix the bundle relocation. User would be able to move the installed QGIS bundle to an alternative location (e.g. ~/Applications instead of root /Application folder) link
  • Address the notarisation process, so the users on MacOS 10.15 would not need to go around the default security settings of the OS link
  • Fix issues related to _iconv library symbols link
  • Add QtDesigner executable into bundle, so users would be able to design QGIS forms link
  • Inclusion of pip in the bundled python environment so users could easily install additional Python packages into the bundled Python environment link
@PeterPetrik PeterPetrik added the Grant-2020 QEP for 2020 Grant program label May 18, 2020
@timlinux
Copy link
Member

Thank you so much... We really need this to put maços on the same footing as windows and Linux for both users and developers.

@kyngchaos
Copy link

A reminder that the QGIS source has a bundling function. It takes care of library path links so they are all relative to the QGIS app (and removes rpaths so it won't crash if Qt is installed, ie when running on the same dev Mac). I had intended it to be able to make a fully all-in-one app, but my interests never got beyond leaving GDAL and python external. It can still be expanded to the full bundling, and I think it should be - bundling external stuff is an installation operation, no need to duplicate this functionality externally.

Sure, the bundling is all in cmake, but if there is something that needs more flexibility cmake can call external scripts. Right now it handles explicit external items, the core/basics. It also needs to handle arbitrary externals, ie everything else, that can vary a lot depending on how that everything else is built. This might need a more flexible script than cmake.

@PeterPetrik
Copy link
Author

When doing all-in-one bundle, we are talking roughly about 40+ libraries and equal number of python modules that needs to be packaged. Also there are 100+ text files (e.g. bash or other scripts) which sometimes needs to be patched (e.g. default build system uses absolute paths etc.) The bundling process highly depends on how the dependencies are linked (e.g. usage of rpath, absolute paths, etc). I agree that CMake system can be well used for bundling QGIS, Qt and maybe few libraries. But for bundling of the the whole stack I am really not convinced it is well maintainable and that is why I proposed this alternative solution based on simple bash scripts.

@phborba
Copy link

phborba commented Jul 29, 2020

It is very rewarding to see your effort @PeterPetrik towards QGIS and the MacOS community!

Just one question: Will you address the external python package issues that QGIS all in one installer has in this WIP? I ask this because the python interpreter bundled with QGIS does not have pip, so we cannot install packages.

Once more, thank you very much for all your effort! Very nice job!

@PeterPetrik
Copy link
Author

@phborba thanks a lot. Yes, pip will be part of the new stuff.

@phborba
Copy link

phborba commented Jul 29, 2020

Very nice to hear that! Keep up the nice job!

@thayeray
Copy link

thayeray commented Aug 14, 2020 via email

@PeterPetrik
Copy link
Author

@thayeray thanks, best to create new tickets directly in QGIS-Mac-Packager. I have created this one for you qgis/QGIS-Mac-Packager#72

@PeterPetrik PeterPetrik self-assigned this Aug 20, 2020
@PeterPetrik
Copy link
Author

all but notarisation should be fixed in the tomorrow's nightly2 build

@MtnBiker
Copy link

https://gisunchained.wordpress.com/2019/05/29/using-qgis-from-conda/ Is this still the up to date method? I tried with miniconda installed with brew. Not totally stable. But maybe I should start with a new instance/file.

I see that QGIS doesn't accept earmarked funding. Is there another way to get a US 501-c(3) funded effort for a Silicon version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Grant-2020 QEP for 2020 Grant program Implemented
Projects
None yet
Development

No branches or pull requests

6 participants