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

🍎 Mac Qt6 .dmg #60039

Open
wants to merge 28 commits into
base: master
Choose a base branch
from
Open

🍎 Mac Qt6 .dmg #60039

wants to merge 28 commits into from

Conversation

m-kuhn
Copy link
Member

@m-kuhn m-kuhn commented Jan 2, 2025

Description

Creates macos installers (dmg), based on Qt6/vcpkg for desktop components

  • It provides QGIS, qgis_process, qgis_bench, ogr2ogr and a few executable binaries
  • The package is created for master, pull requests and releases
  • It creates two builds, one for x64 (intel) and one for arm64 (M) processors it creates a "universal" executable that works natively on both x64 and arm64 (socalled "multiarchitecture" or "fat" binaries)
  • It simplifies a lot of cmake code by not building frameworks. If there is a good reason to reintroduce frameworks, I am happy to discuss how to deal with specific use cases for which they are currently used.
  • It separates the Python_SITEARCH directory with an absolute system path (where site-packages is installed on the system) from a new variable QGIS_PYTHON_INSTALL_DIR with relative variable where our python bindings will be installed to (which can be the same path as Python_SITEARCH if the prefix provided through CMAKE_INSTALL_PREFIX and/or DESTDIR matches)
  • It completely removed CMAKE_INSTALL_DIR from cmake code in install directives, to allow for installation on relative paths
  • It does not include QGIS server, if you want to run QGIS server on macos, there are homebrew, conda and other options
  • This removes the current mac bundles (the dependencies in there are outdated)
  • It separates building the application (for development/debugging) from bundling. The macos bundle is only created at bundling time. For debugging, no libraries are copied into the build path.
  • For creating an app and fixing rpath, macdeployqt is used (only minimal usage within cmake) For fixing rpath, a custom script similar to maceployqt is used. Macdeployqt was too slow and didn't handle some cases (like symlinks)
  • For creating a shiny dmg, create-dmg is used
  • No notarisation or code signing is done (yet)

Fixes #46299

@github-actions github-actions bot added this to the 3.42.0 milestone Jan 2, 2025
Copy link

github-actions bot commented Jan 2, 2025

🧮 Vcpkg update report

Updated packages:
🍇 py-tomli: 2.0.1 -> 2.0.1#1

🪟 Windows builds

Download Windows builds of this PR for testing.
Debug symbols for this build are available here.
(Built from commit e9d3dde)

🪟 Windows Qt6 builds

Download Windows Qt6 builds of this PR for testing.
(Built from commit e9d3dde)

🍎 MacOS Qt6 builds

Download MacOS Qt6 builds of this PR for testing.
This installer is not signed, control+click > open the app to avoid the warning
(Built from commit e9d3dde)

cmake/VcpkgInstallDeps.cmake Outdated Show resolved Hide resolved
@m-kuhn m-kuhn changed the title Mac Qt6 .dmg 🍎 Mac Qt6 .dmg Jan 2, 2025
@m-kuhn
Copy link
Member Author

m-kuhn commented Jan 3, 2025

Creating the dmg on x64 github action runners (macos-13) randomly fails because of "resource busy" in hdiutil. There is not much we can do but retry until we succeed -- which can eventually take a very long time.

@nyalldawson
Copy link
Collaborator

@m-kuhn

Creating the dmg on x64 github action runners (macos-13) randomly fails because of "resource busy" in hdiutil. There is not much we can do but retry until we succeed -- which can eventually take a very long time.

Should we just disable these then? (At least it's only the legacy build)

@m-kuhn
Copy link
Member Author

m-kuhn commented Jan 5, 2025

Possibly, I'm trying to create a zip or a universal app. Last resort would be killing x64

@eflaten
Copy link

eflaten commented Jan 6, 2025

I tried a x64 build during the weekend, and that one worked :) The one that worked was when the downloadable .dmg was separated between M prosessor and Intel. I am on macos 15.2

The one that are for download now first dident launch because of permission errors, but launched after I did:
chmod 755 /Applications/QGIS-PR60039.app/Contents/MacOS/QGIS-PR60039
so it is -rwxr-xr-x@
Then it starts, but crashes:

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/libQt6OpenGLWidgets.6.8.1.dylib
Referenced from: <CF52E830-6AD3-32CD-9072-DA23F27414B0> /Applications/QGIS-PR60039.app/Contents/MacOS/QGIS-PR60039
Reason: tried: '/Applications/QGIS-PR60039.app/Contents/MacOS/../Frameworks/libQt6OpenGLWidgets.6.8.1.dylib' (no such file), '/Applications/QGIS-PR60039.app/Contents/MacOS/../Frameworks/libQt6OpenGLWidgets.6.8.1.dylib' (no such file)

If there is any particular tests I can do. I am happy to help. If I can. Nice to see progress one the macos work on QGIS, Mathias :)

@m-kuhn
Copy link
Member Author

m-kuhn commented Jan 7, 2025

@eflaten if you happen to have an arm64 (M series) machine, a test of https://github.com/qgis/QGIS/actions/runs/12642053020/artifacts/2393456714 would be appreciated.

@eflaten
Copy link

eflaten commented Jan 7, 2025

@eflaten if you happen to have an arm64 (M series) machine, a test of https://github.com/qgis/QGIS/actions/runs/12642053020/artifacts/2393456714 would be appreciated.

Oh sorry. No arm64 machine here. Just a x64.

@NyakudyaA
Copy link
Contributor

@eflaten if you happen to have an arm64 (M series) machine, a test of https://github.com/qgis/QGIS/actions/runs/12642053020/artifacts/2393456714 would be appreciated.

Oh sorry. No arm64 machine here. Just a x64.

I can test this, but the link keeps timing out from downloading the DMG

@m-kuhn
Copy link
Member Author

m-kuhn commented Jan 7, 2025

@eflaten if you happen to have an arm64 (M series) machine, a test of https://github.com/qgis/QGIS/actions/runs/12642053020/artifacts/2393456714 would be appreciated.

Oh sorry. No arm64 machine here. Just a x64.

I can test this, but the link keeps timing out from downloading the DMG

Strange, link works here... Can you download the arm64 zip from here https://github.com/qgis/QGIS/actions/runs/12642053020?

@m-kuhn
Copy link
Member Author

m-kuhn commented Jan 7, 2025

The latest dmg (dmg https://github.com/qgis/QGIS/actions/runs/12656340998/artifacts/2397658648 from run https://github.com/qgis/QGIS/actions/runs/12656340998) should be universal and works here on my x64 machine ...

@eflaten
Copy link

eflaten commented Jan 7, 2025

qgis macos Qt6 universal: ( https://github.com/qgis/QGIS/actions/runs/12656340998/artifacts/2397658648)
in: (https://github.com/qgis/QGIS/actions/runs/12656340998)
started from terminal.
Hurra!

`

QGIS version 3.41.0-Master
QGIS code revision d465ca2
 
Libraries
Qt version 6.8.1
Python version 3.11.10
GDAL/OGR version 3.9.3
PROJ version 9.5.1
EPSG Registry database version v11.022 (2024-11-05)
GEOS version 3.13.0-CAPI-1.19.0
SQLite version 3.47.2
PDAL version 2.8.1
PostgreSQL client version unknown
SpatiaLite version 5.1.0
QWT version 6.3.0
QScintilla2 version 2.14.1
OS version macOS Sequoia (15.2)
 
Active Python plugins
processing 2.12.99
grassprovider 2.12.99
db_manager 0.1.20
MetaSearch 0.3.6

@NyakudyaA
Copy link
Contributor

Also could start the app using the dmg
Screenshot 2025-01-08 at 09 42 47

However, starting QGIS from the terminal I get a bunch of errors i.e
Screenshot 2025-01-08 at 09 44 25

Screenshot 2025-01-08 at 09 45 02 Screenshot 2025-01-08 at 09 45 48 Screenshot 2025-01-08 at 09 46 21

@m-kuhn
Copy link
Member Author

m-kuhn commented Jan 8, 2025

@NyakudyaA that's great news, thanks !
Is it possible that when starting from the console there are conflicting environment variables around (e.g. for python)?

@m-kuhn m-kuhn marked this pull request as ready for review January 8, 2025 10:35
@m-kuhn
Copy link
Member Author

m-kuhn commented Jan 8, 2025

The problems with x64 are "fixed".
Here's what we do now:

  • we create .app's in the matrix run (one for x64 and one for arm64)
  • upload these as assets
  • merge the two apps and their libraries into a universal FAT .app (which runs natively on both architectures)
  • bundle this into a dmg on an arm64 runner (where hdiutil runs stable)

Best of all worlds 🎉

Gdal algorithms are fixed as well now.

@e-kotov
Copy link

e-kotov commented Jan 8, 2025

Tested arm64 on M1 with latest Sonoma. Started the app, opened a simple project. Seems to be working well.

@m-kuhn
Copy link
Member Author

m-kuhn commented Jan 8, 2025

@gy-mate thanks for the feedback, I added a new image, let's see what the latest results will give (in approx 2h)

@tsmcgrath
Copy link

I have a Mac M1 running Sequoia. I could not open QGIS-PR60039.app
image

@m-kuhn
Copy link
Member Author

m-kuhn commented Jan 8, 2025

I have a Mac M1 running Sequoia. I could not open QGIS-PR60039.app image

This happens because builds are not "notarized". If you "option"+right click+open, can you proceed anyway to test?
Notarization for releases is scheduled for later

@e-kotov
Copy link

e-kotov commented Jan 8, 2025

I have a Mac M1 running Sequoia. I could not open QGIS-PR60039.app
You need to go to system settings -> security -> scroll down and click "open anyway" right after the unsuccessful launch attempt

@fdenzinger
Copy link

Thank you, @m-kuhn, for your efforts in bringing native QGIS support to Silicon Macs!🙏

I just tested the build on a MacBook Pro M1 running a fresh install of macOS Sequoia 15.2. After dragging QGIS-PR60039.app into the Applications folder, I used Option+right click to open QGIS-PR60039.app. However, upon launching, the QGIS splash screen appears briefly before the application crashes with a QGIS quit unexpectedly error.

SCR-20250108-tgio

In the error report I get the following logs:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               QGIS-PR60039 [8299]
Path:                  /Applications/QGIS-PR60039.app/Contents/MacOS/QGIS-PR60039
Identifier:            org.qgis.qgis3
Version:               3.41.0 (3.41.0 ())
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2025-01-08 22:25:53.5674 +0100
OS Version:            macOS 15.2 (24C101)
Report Version:        12
Anonymous UUID:        [redacted]

Sleep/Wake UUID:       [redacted]

Time Awake Since Boot: 43000 seconds
Time Since Wake:       5820 seconds

System Integrity Protection: enabled

Crashed Thread:        10  Thread (pooled)

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000070
Exception Codes:       0x0000000000000001, 0x0000000000000070

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [8299]

VM Region Info: 0x70 is not in any region.  Bytes before following region: 4369727376
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL

And the info for Thread 10:

Thread 10 Crashed:: Thread (pooled)
0   libqca.2.dylib                	       0x12daa8a34 QCA::Global::get_logger() + 24
1   libqca-softstore.dylib        	       0x12d70c6c4 softstoreProvider::features() const + 24
2   libqca.2.3.7.dylib            	       0x10ae0b168 QCA::ProviderManager::allFeatures() const + 528
3   libqgis_core.3.41.0.dylib     	       0x11ce8403c QgsAuthManager::initPrivate(QString const&) + 336
4   libqgis_core.3.41.0.dylib     	       0x11ce831f4 QgsAuthManager::ensureInitialized() const + 204
5   libqgis_core.3.41.0.dylib     	       0x11ce73bec QgsAuthManager::isDisabled() const + 28
6   libqgis_core.3.41.0.dylib     	       0x11cc1fd70 QgsNetworkAccessManager::createRequest(QNetworkAccessManager::Operation, QNetworkRequest const&, QIODevice*) + 1004
7   libQt6Network.6.dylib         	       0x10e02f654 QNetworkAccessManager::get(QNetworkRequest const&) + 36
8   libqgis_core.3.41.0.dylib     	       0x11cc25fd8 QgsNetworkContentFetcher::fetchContent(QNetworkRequest const&, QString const&) + 356
9   libqgis_core.3.41.0.dylib     	       0x11cbe28f4 QgsNetworkContentFetcherTask::run() + 384
10  libqgis_core.3.41.0.dylib     	       0x11bfded24 QgsTask::start() + 216
11  libqgis_core.3.41.0.dylib     	       0x11bfec6dc QgsTaskRunnableWrapper::run() + 28
12  libQt6Core.6.dylib            	       0x110bdd42c QThreadPoolThread::run() + 252
13  libQt6Core.6.dylib            	       0x110bd58c4 QThreadPrivate::start(void*) + 376
14  libsystem_pthread.dylib       	       0x1838482e4 _pthread_start + 136
15  libsystem_pthread.dylib       	       0x1838430fc thread_start + 8

@tsmcgrath
Copy link

I have a Mac M1 running Sequoia. I could not open QGIS-PR60039.app
You need to go to system settings -> security -> scroll down and click "open anyway" right after the unsuccessful launch attempt

Thanks. That worked. It says the Auth system is disabled.

@beginor
Copy link

beginor commented Jan 9, 2025

Thank you, @m-kuhn, for your efforts in bringing native QGIS support to Silicon Macs!🙏

I just tested the build on a MacBook Pro M1 running a fresh install of macOS Sequoia 15.2. After dragging QGIS-PR60039.app into the Applications folder, I used Option+right click to open QGIS-PR60039.app. However, upon launching, the QGIS splash screen appears briefly before the application crashes with a QGIS quit unexpectedly error.

SCR-20250108-tgio In the error report I get the following logs:
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               QGIS-PR60039 [8299]
Path:                  /Applications/QGIS-PR60039.app/Contents/MacOS/QGIS-PR60039
Identifier:            org.qgis.qgis3
Version:               3.41.0 (3.41.0 ())
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2025-01-08 22:25:53.5674 +0100
OS Version:            macOS 15.2 (24C101)
Report Version:        12
Anonymous UUID:        [redacted]

Sleep/Wake UUID:       [redacted]

Time Awake Since Boot: 43000 seconds
Time Since Wake:       5820 seconds

System Integrity Protection: enabled

Crashed Thread:        10  Thread (pooled)

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000070
Exception Codes:       0x0000000000000001, 0x0000000000000070

Termination Reason:    Namespace SIGNAL, Code 11 Segmentation fault: 11
Terminating Process:   exc handler [8299]

VM Region Info: 0x70 is not in any region.  Bytes before following region: 4369727376
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL

And the info for Thread 10:

Thread 10 Crashed:: Thread (pooled)
0   libqca.2.dylib                	       0x12daa8a34 QCA::Global::get_logger() + 24
1   libqca-softstore.dylib        	       0x12d70c6c4 softstoreProvider::features() const + 24
2   libqca.2.3.7.dylib            	       0x10ae0b168 QCA::ProviderManager::allFeatures() const + 528
3   libqgis_core.3.41.0.dylib     	       0x11ce8403c QgsAuthManager::initPrivate(QString const&) + 336
4   libqgis_core.3.41.0.dylib     	       0x11ce831f4 QgsAuthManager::ensureInitialized() const + 204
5   libqgis_core.3.41.0.dylib     	       0x11ce73bec QgsAuthManager::isDisabled() const + 28
6   libqgis_core.3.41.0.dylib     	       0x11cc1fd70 QgsNetworkAccessManager::createRequest(QNetworkAccessManager::Operation, QNetworkRequest const&, QIODevice*) + 1004
7   libQt6Network.6.dylib         	       0x10e02f654 QNetworkAccessManager::get(QNetworkRequest const&) + 36
8   libqgis_core.3.41.0.dylib     	       0x11cc25fd8 QgsNetworkContentFetcher::fetchContent(QNetworkRequest const&, QString const&) + 356
9   libqgis_core.3.41.0.dylib     	       0x11cbe28f4 QgsNetworkContentFetcherTask::run() + 384
10  libqgis_core.3.41.0.dylib     	       0x11bfded24 QgsTask::start() + 216
11  libqgis_core.3.41.0.dylib     	       0x11bfec6dc QgsTaskRunnableWrapper::run() + 28
12  libQt6Core.6.dylib            	       0x110bdd42c QThreadPoolThread::run() + 252
13  libQt6Core.6.dylib            	       0x110bd58c4 QThreadPrivate::start(void*) + 376
14  libsystem_pthread.dylib       	       0x1838482e4 _pthread_start + 136
15  libsystem_pthread.dylib       	       0x1838430fc thread_start + 8

Got the same issue!

@nicogodet
Copy link
Member

Thanks. That worked. It says the Auth system is disabled.

Same for the Windows Qt6 build

@m-kuhn
Copy link
Member Author

m-kuhn commented Jan 9, 2025

The package that is running is likely the one from older builds, namely here #60039 (comment)

After that I "fixed" the "Auth System Disabled" problem by moving qca plugins to the correct locations (@nicogodet that's likely the problem too on Windows, the crypto folder needs to be where other Qt plugins are).

However, loading the qca plugins is now triggering a crash, which I couldn't isolate so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Native support for Apple Silicon (ARM64 architecture)