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, qgis-ltr: fix dependencies on darwin #157862

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

Conversation

willcohen
Copy link
Contributor

@willcohen willcohen commented Feb 2, 2022

Motivation for this change

Progress toward #71398. Builds on #150286, #150595, #156747, #156809, #156828.

Things done

@NixOS/darwin-maintainers I'm struggling with getting the final build of this to link and load correctly, though all the dependencies should finally be fixed. Even after fully disabling all of the makeWrapper work on darwin, I'm still getting mired down by being unable to get the dylibs to load. Pasting the end result here since building this derivation takes a while.

Any suggestions would be MUCH appreciated.

$ /nix/store/fcr2r0dihgkqid9jv2c226k8jcpfvw1q-qgis-unwrapped-3.22.3/QGIS.app/Contents/MacOS/QGIS  
dyld[39783]: Library not loaded: @executable_path/lib/libqgis_app.3.22.3.dylib
  Referenced from: /nix/store/fcr2r0dihgkqid9jv2c226k8jcpfvw1q-qgis-unwrapped-3.22.3/QGIS.app/Contents/MacOS/.QGIS-wrapped
  Reason: tried: '/nix/store/fcr2r0dihgkqid9jv2c226k8jcpfvw1q-qgis-unwrapped-3.22.3/QGIS.app/Contents/MacOS/lib/libqgis_app.3.22.3.dylib' (not a mach-o file), '/usr/local/lib/libqgis_app.3.22.3.dylib' (no such file), '/usr/lib/libqgis_app.3.22.3.dylib' (no such file)
[1]    39783 abort      
➜  lib ls -al /nix/store/fcr2r0dihgkqid9jv2c226k8jcpfvw1q-qgis-unwrapped-3.22.3/QGIS.app/Contents/MacOS/lib 
total 26624
dr-xr-xr-x  9 root  wheel       288 Dec 31  1969 .
dr-xr-xr-x  8 root  wheel       256 Dec 31  1969 ..
-r-xr-xr-x  1 root  wheel  13502764 Dec 31  1969 .libqgis_app.3.22.3.dylib-wrapped
-r-xr-xr-x  1 root  wheel    115896 Dec 31  1969 .libqgispython.3.22.3.dylib-wrapped
-r-xr-xr-x  1 root  wheel      2485 Dec 31  1969 libqgis_app.3.22.3.dylib
lrwxr-xr-x  1 root  wheel        24 Dec 31  1969 libqgis_app.dylib -> libqgis_app.3.22.3.dylib
-r-xr-xr-x  1 root  wheel      2487 Dec 31  1969 libqgispython.3.22.3.dylib
lrwxr-xr-x  1 root  wheel        26 Dec 31  1969 libqgispython.dylib -> libqgispython.3.22.3.dylib
dr-xr-xr-x  5 root  wheel       160 Dec 31  1969 qgis
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

Copy link
Contributor

@hexagonal-sun hexagonal-sun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor code cleanup. Unfortunetly, I'm running an M1 and we don't have Qt support yet so I can't build on this end.

pkgs/applications/gis/qgis/unwrapped.nix Outdated Show resolved Hide resolved
pkgs/applications/gis/qgis/unwrapped-ltr.nix Outdated Show resolved Hide resolved
pkgs/applications/gis/qgis/unwrapped-ltr.nix Outdated Show resolved Hide resolved
@siraben

This comment was marked as outdated.

@willcohen willcohen marked this pull request as ready for review March 14, 2022 13:20
@willcohen willcohen changed the title [WIP] qgis, qgis-ltr: fix build on darwin qgis, qgis-ltr: fix dependencies on darwin Mar 14, 2022
@willcohen
Copy link
Contributor Author

willcohen commented Mar 14, 2022

This does not fully complete the build for darwin, but does fix all of the dependencies. A .app does get produced at this point, but the dylibs still link incorrectly. My preference would be to merge this reduced-scope PR first as a progress step since it deals with the underlying build requirements, and then I can still try to work out fixing the .app bundle's internal issues in a separate PR without having to pull these changes along with, because I don't expect them to change any more than as is.

@willcohen
Copy link
Contributor Author

As context, even the official build recipe for the Mac .app has a whole bunch of steps needed to get the .app bundle working, so some substantial variant of these kinds of steps will probably eventually be needed for the nixpkgs bundle.

@willcohen
Copy link
Contributor Author

Force-pushed to remove darwin as a supported platform (since the .app isn't yet functional), but otherwise the same.

@willcohen
Copy link
Contributor Author

@ttuegel as I continue working on this, it appears that the qt wrapper is what's being overly zealous, and it's going ahead and trying to wrap not just the executable but the various .dylibs and everything else inside $out/QGIS.app/ on darwin:

...
installPhase completed in 1 minutes 1 seconds
qtOwnPathsHook
post-installation fixup
wrapping Qt applications in /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/bin /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/sbin /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/libexec /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/Applications /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app
/nix/store/5fx589p0pvmdqlrnrxzkis1j8zmzibd9-stdenv-darwin/setup: line 215: read: read error: 10: Is a directory
/nix/store/5fx589p0pvmdqlrnrxzkis1j8zmzibd9-stdenv-darwin/setup: line 226: read: read error: 10: Is a directory
wrapping /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app/Contents/MacOS/bin/qgis_bench.app/Contents/MacOS/qgis_bench
/nix/store/5fx589p0pvmdqlrnrxzkis1j8zmzibd9-stdenv-darwin/setup: line 215: read: read error: 10: Is a directory
/nix/store/5fx589p0pvmdqlrnrxzkis1j8zmzibd9-stdenv-darwin/setup: line 226: read: read error: 10: Is a directory
/nix/store/5fx589p0pvmdqlrnrxzkis1j8zmzibd9-stdenv-darwin/setup: line 215: read: read error: 10: Is a directory
/nix/store/5fx589p0pvmdqlrnrxzkis1j8zmzibd9-stdenv-darwin/setup: line 226: read: read error: 10: Is a directory
/nix/store/5fx589p0pvmdqlrnrxzkis1j8zmzibd9-stdenv-darwin/setup: line 215: read: read error: 10: Is a directory
/nix/store/5fx589p0pvmdqlrnrxzkis1j8zmzibd9-stdenv-darwin/setup: line 226: read: read error: 10: Is a directory
wrapping /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app/Contents/MacOS/bin/qgis_process.app/Contents/MacOS/qgis_process
wrapping /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app/Contents/MacOS/QGIS
wrapping /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app/Contents/MacOS/lib/libqgis_app.3.24.2.dylib
wrapping /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app/Contents/MacOS/lib/qgis/grass/bin/qgis.g.browser8
wrapping /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app/Contents/MacOS/lib/qgis/grass/modules/qgis.d.rast8
wrapping /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app/Contents/MacOS/lib/qgis/grass/modules/qgis.v.in8
wrapping /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app/Contents/MacOS/lib/qgis/grass/modules/qgis.r.in8
wrapping /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app/Contents/MacOS/lib/qgis/grass/modules/qgis.g.info8
wrapping /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app/Contents/MacOS/lib/qgis/crssync
wrapping /nix/store/cfcbgz2gmnzq5q6rjc8k9pbkj27lyqyd-qgis-unwrapped-3.24.2/QGIS.app/Contents/MacOS/lib/libqgispython.3.24.2.dylib
...

Would you suggest that the best course of action here is to just set dontWrapQtApps on darwin and manually run wrapQtApp as needed?

@ttuegel
Copy link
Member

ttuegel commented May 22, 2022

Would you suggest that the best course of action here is to just set dontWrapQtApps on darwin and manually run wrapQtApp as needed?

I would suggest setting dontWrapQtApps on Darwin. That script will only work correctly for ELF objects on Linux.

@stale stale bot added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 8, 2023
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jan 11, 2023
@willcohen
Copy link
Contributor Author

With #209801 merged it's a chance to dust this off. Rebased to master and fixed the dependencies and linking issues from before. However, attempting to load the QGIS.app for either qgis or qgis-ltr fails with the following crash report. Any suggestions @NixOS/darwin-maintainers?

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

Process:               QGIS [45199]
Path:                  /Volumes/VOLUME/*/QGIS.app/Contents/MacOS/QGIS
Identifier:            org.qgis.qgis3
Version:               3.28.2 (3.28.2 (exported))
Code Type:             ARM-64 (Native)
Parent Process:        launchd [1]
User ID:               501

Date/Time:             2023-01-11 11:18:43.4045 -0500
OS Version:            macOS 13.1 (22C65)
Report Version:        12
Anonymous UUID:        EFA3F67E-B6A3-CBFF-B0CE-8139B7515F3A

Sleep/Wake UUID:       C5799FA7-6E4C-4286-B156-47BAA862AF96

Time Awake Since Boot: 1300000 seconds
Time Since Wake:       47222 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Application Specific Information:
abort() called


Kernel Triage:
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x19fa4e1b0 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x19fa84cec pthread_kill + 288
2   libsystem_c.dylib             	       0x19f9be2c8 abort + 180
3   ???                           	       0x1020b0810 myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&) + 1052
4   ???                           	       0x1043a0948 ???
5   ???                           	       0x10439ba30 ???
6   ???                           	       0x104664064 QMessageLogger::fatal(char const*, ...) const + 56
7   ???                           	       0x103e6ef5c QGuiApplicationPrivate::createPlatformIntegration() + 7296
8   ???                           	       0x103e6ef80 QGuiApplicationPrivate::createEventDispatcher() + 36
9   ???                           	       0x10456c554 QCoreApplicationPrivate::init() + 1472
10  ???                           	       0x103e692ec QGuiApplicationPrivate::init() + 68
11  ???                           	       0x102a2c5fc QApplicationPrivate::init() + 52
12  ???                           	       0x102a2c5b0 QApplication::QApplication(int&, char**, int) + 164
13  ???                           	       0x10a22d0c4 QgsApplication::QgsApplication(int&, char**, bool, QString const&, QString const&) + 60
14  ???                           	       0x1020b335c main + 11012
15  dyld                          	       0x19f75be50 start + 2544

Thread 1:
0   libsystem_pthread.dylib       	       0x19fa7fe18 start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib       	       0x19fa7fe18 start_wqthread + 0

Thread 3:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x1167edb34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 4:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x1167edb34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 5:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x1167edb34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 6:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x1167edb34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 7:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x1167edb34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 8:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x1167edb34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 9:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x1167edb34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 10:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x117da1b34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 11:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x117da1b34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 12:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x117da1b34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 13:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x117da1b34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 14:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x117da1b34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 15:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x117da1b34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8

Thread 16:
0   libsystem_kernel.dylib        	       0x19fa49564 __psynch_cvwait + 8
1   libsystem_pthread.dylib       	       0x19fa85638 _pthread_cond_wait + 1232
2   ???                           	       0x117da1b34 blas_thread_server + 360
3   libsystem_pthread.dylib       	       0x19fa8506c _pthread_start + 148
4   libsystem_pthread.dylib       	       0x19fa7fe2c thread_start + 8


Thread 0 crashed with ARM Thread State (64-bit):
    x0: 0x0000000000000000   x1: 0x0000000000000000   x2: 0x0000000000000000   x3: 0x0000000000000000
    x4: 0x0000000010000800   x5: 0x000000000000001c   x6: 0x0000000000000000   x7: 0x0000000000011000
    x8: 0x220a5822ca787cc5   x9: 0x220a582330a6c645  x10: 0x0000000000179f41  x11: 0x00000000000f4da0
   x12: 0x000000014f600000  x13: 0x0000000104cdfd78  x14: 0x0000000000000000  x15: 0x0000000000000000
   x16: 0x0000000000000148  x17: 0x00000001ffc2c7f0  x18: 0x0000000000000000  x19: 0x0000000000000006
   x20: 0x00000001fadeba80  x21: 0x0000000000000103  x22: 0x00000001fadebb60  x23: 0x000000019fa8d120
   x24: 0x0000000000000000  x25: 0x0000000104298ac8  x26: 0x000060000296c498  x27: 0x0000600002968bc0
   x28: 0x0000000000000000   fp: 0x000000016dd61430   lr: 0x000000019fa84cec
    sp: 0x000000016dd61410   pc: 0x000000019fa4e1b0 cpsr: 0x40001000
   far: 0x0000000104607c28  esr: 0x56000080  Address size fault

Binary Images:
       0x19fa45000 -        0x19fa7dff3 libsystem_kernel.dylib (*) <aebf397e-e2ef-3a49-be58-23d4558511f6> /usr/lib/system/libsystem_kernel.dylib
       0x19fa7e000 -        0x19fa8affb libsystem_pthread.dylib (*) <132084c6-c347-3489-9ac2-fcaad21cdb73> /usr/lib/system/libsystem_pthread.dylib
       0x19f945000 -        0x19f9c5ff3 libsystem_c.dylib (*) <756cd0d2-3241-3a74-8c59-02632dcee221> /usr/lib/system/libsystem_c.dylib
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
       0x19f756000 -        0x19f7e0b63 dyld (*) <487cfdeb-9b07-39bf-bfb9-970b61aea2d1> /usr/lib/dyld

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=1.3G resident=0K(0%) swapped_out_or_unallocated=1.3G(100%)
Writable regions: Total=1.5G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.5G(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Activity Tracing                   256K        1 
Kernel Alloc Once                   32K        1 
MALLOC                           196.2M       21 
MALLOC guard page                   96K        6 
MALLOC_MEDIUM (reserved)         480.0M        4         reserved VM address space (unallocated)
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
STACK GUARD                       56.3M       17 
Stack                             16.5M       17 
VM_ALLOCATE                         80K        2 
VM_ALLOCATE (reserved)           448.0M        1         reserved VM address space (unallocated)
__AUTH                             572K      132 
__AUTH_CONST                      10.4M      277 
__DATA                            14.6M      436 
__DATA_CONST                      20.4M      422 
__DATA_DIRTY                       678K       97 
__FONT_DATA                        2352        1 
__LINKEDIT                       817.9M      146 
__OBJC_CONST                      1161K      107 
__OBJC_RO                         65.4M        1 
__OBJC_RW                         1986K        1 
__TEXT                           477.3M      437 
dyld private memory                256K        1 
mapped file                       29.1M        3 
shared memory                      624K        7 
===========                     =======  ======= 
TOTAL                              3.0G     2139 
TOTAL, minus reserved VM space     1.7G     2139 



-----------
Full Report
-----------

{"app_name":"QGIS","timestamp":"2023-01-11 11:18:46.00 -0500","app_version":"3.28.2","slice_uuid":"00000000-0000-0000-0000-000000000000","build_version":"3.28.2 (exported)","platform":1,"bundleID":"org.qgis.qgis3","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 13.1 (22C65)","roots_installed":0,"name":"QGIS","incident_id":"7B4402E5-5209-4ABD-83AB-5C9B751BE362"}
{
  "uptime" : 1300000,
  "procRole" : "Background",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "Mac14,2",
  "coalitionID" : 154187,
  "osVersion" : {
    "train" : "macOS 13.1",
    "build" : "22C65",
    "releaseType" : "User"
  },
  "captureTime" : "2023-01-11 11:18:43.4045 -0500",
  "incident" : "7B4402E5-5209-4ABD-83AB-5C9B751BE362",
  "pid" : 45199,
  "translated" : false,
  "cpuType" : "ARM-64",
  "roots_installed" : 0,
  "bug_type" : "309",
  "procLaunch" : "2023-01-11 11:18:42.3638 -0500",
  "procStartAbsTime" : 31809994362957,
  "procExitAbsTime" : 31810019318087,
  "procName" : "QGIS",
  "procPath" : "\/Volumes\/VOLUME\/*\/QGIS.app\/Contents\/MacOS\/QGIS",
  "bundleInfo" : {"CFBundleShortVersionString":"3.28.2","CFBundleVersion":"3.28.2 (exported)","CFBundleIdentifier":"org.qgis.qgis3"},
  "storeInfo" : {"deviceIdentifierForVendor":"A23FFA76-8BE5-5998-8A5C-853D0111BA12","thirdParty":true},
  "parentProc" : "launchd",
  "parentPid" : 1,
  "coalitionName" : "org.qgis.qgis3",
  "crashReporterKey" : "EFA3F67E-B6A3-CBFF-B0CE-8139B7515F3A",
  "throttleTimeout" : 2147483647,
  "wakeTime" : 47222,
  "sleepWakeUUID" : "C5799FA7-6E4C-4286-B156-47BAA862AF96",
  "sip" : "enabled",
  "exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"},
  "ktriageinfo" : "VM - pmap_enter retried due to resource shortage\nVM - pmap_enter retried due to resource shortage\nVM - pmap_enter retried due to resource shortage\nVM - pmap_enter retried due to resource shortage\nVM - pmap_enter retried due to resource shortage\n",
  "asi" : {"libsystem_c.dylib":["abort() called"]},
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":33188727,"threadState":{"x":[{"value":0},{"value":0},{"value":0},{"value":0},{"value":268437504},{"value":28},{"value":0},{"value":69632},{"value":2452869853505682629},{"value":2452869855219992133},{"value":1548097},{"value":1002912},{"value":5626658816},{"value":4375575928},{"value":0},{"value":0},{"value":328},{"value":8585922544},{"value":0},{"value":6},{"value":8503868032,"symbolLocation":0,"symbol":"_main_thread"},{"value":259},{"value":8503868256,"symbolLocation":224,"symbol":"_main_thread"},{"value":6973608224,"symbolLocation":0,"symbol":"tlv_get_addr"},{"value":0},{"value":4364798664},{"value":105553159701656},{"value":105553159687104},{"value":0}],"flavor":"ARM_THREAD_STATE64","lr":{"value":6973574380},"cpsr":{"value":1073745920},"fp":{"value":6137713712},"sp":{"value":6137713680},"esr":{"value":1442840704,"description":" Address size fault"},"pc":{"value":6973350320,"matchesCrashFrame":1},"far":{"value":4368399400}},"queue":"com.apple.main-thread","frames":[{"imageOffset":37296,"symbol":"__pthread_kill","symbolLocation":8,"imageIndex":0},{"imageOffset":27884,"symbol":"pthread_kill","symbolLocation":288,"imageIndex":1},{"imageOffset":496328,"symbol":"abort","symbolLocation":180,"imageIndex":2},{"imageOffset":4329244688,"symbol":"myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&)","symbolLocation":1052,"imageIndex":3},{"imageOffset":4365879624,"imageIndex":3},{"imageOffset":4365859376,"imageIndex":3},{"imageOffset":4368777316,"symbol":"QMessageLogger::fatal(char const*, ...) const","symbolLocation":56,"imageIndex":3},{"imageOffset":4360433500,"symbol":"QGuiApplicationPrivate::createPlatformIntegration()","symbolLocation":7296,"imageIndex":3},{"imageOffset":4360433536,"symbol":"QGuiApplicationPrivate::createEventDispatcher()","symbolLocation":36,"imageIndex":3},{"imageOffset":4367762772,"symbol":"QCoreApplicationPrivate::init()","symbolLocation":1472,"imageIndex":3},{"imageOffset":4360409836,"symbol":"QGuiApplicationPrivate::init()","symbolLocation":68,"imageIndex":3},{"imageOffset":4339189244,"symbol":"QApplicationPrivate::init()","symbolLocation":52,"imageIndex":3},{"imageOffset":4339189168,"symbol":"QApplication::QApplication(int&, char**, int)","symbolLocation":164,"imageIndex":3},{"imageOffset":4465021124,"symbol":"QgsApplication::QgsApplication(int&, char**, bool, QString const&, QString const&)","symbolLocation":60,"imageIndex":3},{"imageOffset":4329255772,"symbol":"main","symbolLocation":11012,"imageIndex":3},{"imageOffset":24144,"symbol":"start","symbolLocation":2544,"imageIndex":4}]},{"id":33188842,"frames":[{"imageOffset":7704,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":1}]},{"id":33188843,"frames":[{"imageOffset":7704,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":1}]},{"id":33188844,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4672379700,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188845,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4672379700,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188846,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4672379700,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188847,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4672379700,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188848,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4672379700,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188849,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4672379700,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188850,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4672379700,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188851,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4695137076,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188852,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4695137076,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188853,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4695137076,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188854,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4695137076,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188855,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4695137076,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188856,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4695137076,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]},{"id":33188857,"frames":[{"imageOffset":17764,"symbol":"__psynch_cvwait","symbolLocation":8,"imageIndex":0},{"imageOffset":30264,"symbol":"_pthread_cond_wait","symbolLocation":1232,"imageIndex":1},{"imageOffset":4695137076,"symbol":"blas_thread_server","symbolLocation":360,"imageIndex":3},{"imageOffset":28780,"symbol":"_pthread_start","symbolLocation":148,"imageIndex":1},{"imageOffset":7724,"symbol":"thread_start","symbolLocation":8,"imageIndex":1}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6973313024,
    "size" : 233460,
    "uuid" : "aebf397e-e2ef-3a49-be58-23d4558511f6",
    "path" : "\/usr\/lib\/system\/libsystem_kernel.dylib",
    "name" : "libsystem_kernel.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6973546496,
    "size" : 53244,
    "uuid" : "132084c6-c347-3489-9ac2-fcaad21cdb73",
    "path" : "\/usr\/lib\/system\/libsystem_pthread.dylib",
    "name" : "libsystem_pthread.dylib"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6972264448,
    "size" : 528372,
    "uuid" : "756cd0d2-3241-3a74-8c59-02632dcee221",
    "path" : "\/usr\/lib\/system\/libsystem_c.dylib",
    "name" : "libsystem_c.dylib"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  },
  {
    "source" : "P",
    "arch" : "arm64e",
    "base" : 6970236928,
    "size" : 568164,
    "uuid" : "487cfdeb-9b07-39bf-bfb9-970b61aea2d1",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  }
],
  "sharedCache" : {
  "base" : 6969589760,
  "size" : 3434283008,
  "uuid" : "00a1fbb6-43e1-3c11-8483-faf0db659249"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=1.3G resident=0K(0%) swapped_out_or_unallocated=1.3G(100%)\nWritable regions: Total=1.5G written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=1.5G(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nActivity Tracing                   256K        1 \nKernel Alloc Once                   32K        1 \nMALLOC                           196.2M       21 \nMALLOC guard page                   96K        6 \nMALLOC_MEDIUM (reserved)         480.0M        4         reserved VM address space (unallocated)\nMALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)\nSTACK GUARD                       56.3M       17 \nStack                             16.5M       17 \nVM_ALLOCATE                         80K        2 \nVM_ALLOCATE (reserved)           448.0M        1         reserved VM address space (unallocated)\n__AUTH                             572K      132 \n__AUTH_CONST                      10.4M      277 \n__DATA                            14.6M      436 \n__DATA_CONST                      20.4M      422 \n__DATA_DIRTY                       678K       97 \n__FONT_DATA                        2352        1 \n__LINKEDIT                       817.9M      146 \n__OBJC_CONST                      1161K      107 \n__OBJC_RO                         65.4M        1 \n__OBJC_RW                         1986K        1 \n__TEXT                           477.3M      437 \ndyld private memory                256K        1 \nmapped file                       29.1M        3 \nshared memory                      624K        7 \n===========                     =======  ======= \nTOTAL                              3.0G     2139 \nTOTAL, minus reserved VM space     1.7G     2139 \n",
  "legacyInfo" : {
  "threadTriggered" : {
    "queue" : "com.apple.main-thread"
  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "60da5e84ab0ca017dace9abf",
      "factorPackIds" : {

      },
      "deploymentId" : 240000008
    },
    {
      "rolloutId" : "5fb4245a1bbfe8005e33a1e1",
      "factorPackIds" : {

      },
      "deploymentId" : 240000021
    }
  ],
  "experiments" : [

  ]
}
}

Model: Mac14,2, BootROM 8419.60.44, proc 8:4:4 processors, 24 GB, SMC 
Graphics: Apple M2, Apple M2, Built-In
...

@Et7f3
Copy link
Contributor

Et7f3 commented Jan 11, 2023

I see source from 3.28.2 and 3.22.14 so maybe a version conflict. Can you test with same version for all sources ? Even better try to avoid duplication.

@willcohen
Copy link
Contributor Author

Yeah -- it's two different packages. 3.28.2 is qgis, which has a minor release every four months. 3.22 is qgis-ltr, which happen every three minor release cycles. The two packages sit in parallel but -- unless I made an oversight -- don't overlap at all. The crash occurs with both qgis and qgis-ltr though, since they do have similar build processes. My guess is once it's solved for one, that will apply to the other.

@imincik
Copy link
Contributor

imincik commented Jan 11, 2023

@imincik any suggestions of how to proceed further based on #157862 (comment) would be much appreciated!

@willcohen , unfortunately I am not a Mac user at all. But I really want to see it running on Mac because of other users. That's why I am very happy that you try to progress.

@imincik
Copy link
Contributor

imincik commented Jan 11, 2023

Have you tried to build it with debug output ? Something like -DCMAKE_BUILD_TYPE=Debug ?

@willcohen
Copy link
Contributor Author

.app built with cmake debug crashes with the following, leading me to ask a basic question that's above my knowledge of nix and macos internals -- do these libsystem dylibs need to be nix-specific ones? The dylibs being referenced here in the crash reports are definitely in /usr/lib, but I'm not sure how much is supposed to get swapped out from the darwin bootstrap.

...
Time Awake Since Boot: 1300000 seconds
Time Since Wake:       65887 seconds

System Integrity Protection: enabled

Notes:
dyld_process_snapshot_create_for_process failed with 5

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Error Formulating Crash Report:
dyld_process_snapshot_create_for_process failed with 5

Kernel Triage:
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x19fa4e1b0 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x19fa84cec pthread_kill + 288
2   libsystem_c.dylib             	       0x19f9be2c8 abort + 180
3   ???                           	       0x1048d4674 myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&) + 1332
4   ???                           	       0x1072ac948 ???
5   ???                           	       0x1072a7a30 ???
6   ???                           	       0x107570064 QMessageLogger::fatal(char const*, ...) const + 56
7   ???                           	       0x106d7af5c QGuiApplicationPrivate::createPlatformIntegration() + 7296
8   ???                           	       0x106d7af80 QGuiApplicationPrivate::createEventDispatcher() + 36
9   ???                           	       0x107478554 QCoreApplicationPrivate::init() + 1472
10  ???                           	       0x106d752ec QGuiApplicationPrivate::init() + 68
11  ???                           	       0x1052605fc QApplicationPrivate::init() + 52
12  ???                           	       0x1052605b0 QApplication::QApplication(int&, char**, int) + 164
13  ???                           	       0x10ea28228 QgsApplication::QgsApplication(int&, char**, bool, QString const&, QString const&) + 60
14  ???                           	       0x1048d71a4 main + 10976
15  dyld                          	       0x19f75be50 start + 2544

...
Binary Images:
       0x19fa45000 -        0x19fa7dff3 libsystem_kernel.dylib (*) <aebf397e-e2ef-3a49-be58-23d4558511f6> /usr/lib/system/libsystem_kernel.dylib
       0x19fa7e000 -        0x19fa8affb libsystem_pthread.dylib (*) <132084c6-c347-3489-9ac2-fcaad21cdb73> /usr/lib/system/libsystem_pthread.dylib
       0x19f945000 -        0x19f9c5ff3 libsystem_c.dylib (*) <756cd0d2-3241-3a74-8c59-02632dcee221> /usr/lib/system/libsystem_c.dylib
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
       0x19f756000 -        0x19f7e0b63 dyld (*) <487cfdeb-9b07-39bf-bfb9-970b61aea2d1> /usr/lib/dyld
...

@imincik
Copy link
Contributor

imincik commented Jan 12, 2023

.app built with cmake debug crashes with the following, leading me to ask a basic question that's above my knowledge of nix and macos internals -- do these libsystem dylibs need to be nix-specific ones? The dylibs being referenced here in the crash reports are definitely in /usr/lib, but I'm not sure how much is supposed to get swapped out from the darwin bootstrap.

...
Time Awake Since Boot: 1300000 seconds
Time Since Wake:       65887 seconds

System Integrity Protection: enabled

Notes:
dyld_process_snapshot_create_for_process failed with 5

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Error Formulating Crash Report:
dyld_process_snapshot_create_for_process failed with 5

Kernel Triage:
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage
VM - pmap_enter retried due to resource shortage


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib        	       0x19fa4e1b0 __pthread_kill + 8
1   libsystem_pthread.dylib       	       0x19fa84cec pthread_kill + 288
2   libsystem_c.dylib             	       0x19f9be2c8 abort + 180
3   ???                           	       0x1048d4674 myMessageOutput(QtMsgType, QMessageLogContext const&, QString const&) + 1332
4   ???                           	       0x1072ac948 ???
5   ???                           	       0x1072a7a30 ???
6   ???                           	       0x107570064 QMessageLogger::fatal(char const*, ...) const + 56
7   ???                           	       0x106d7af5c QGuiApplicationPrivate::createPlatformIntegration() + 7296
8   ???                           	       0x106d7af80 QGuiApplicationPrivate::createEventDispatcher() + 36
9   ???                           	       0x107478554 QCoreApplicationPrivate::init() + 1472
10  ???                           	       0x106d752ec QGuiApplicationPrivate::init() + 68
11  ???                           	       0x1052605fc QApplicationPrivate::init() + 52
12  ???                           	       0x1052605b0 QApplication::QApplication(int&, char**, int) + 164
13  ???                           	       0x10ea28228 QgsApplication::QgsApplication(int&, char**, bool, QString const&, QString const&) + 60
14  ???                           	       0x1048d71a4 main + 10976
15  dyld                          	       0x19f75be50 start + 2544

...
Binary Images:
       0x19fa45000 -        0x19fa7dff3 libsystem_kernel.dylib (*) <aebf397e-e2ef-3a49-be58-23d4558511f6> /usr/lib/system/libsystem_kernel.dylib
       0x19fa7e000 -        0x19fa8affb libsystem_pthread.dylib (*) <132084c6-c347-3489-9ac2-fcaad21cdb73> /usr/lib/system/libsystem_pthread.dylib
       0x19f945000 -        0x19f9c5ff3 libsystem_c.dylib (*) <756cd0d2-3241-3a74-8c59-02632dcee221> /usr/lib/system/libsystem_c.dylib
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???
       0x19f756000 -        0x19f7e0b63 dyld (*) <487cfdeb-9b07-39bf-bfb9-970b61aea2d1> /usr/lib/dyld
...

My guess will be that it should be nixpkgs provided libs. @NixOS/darwin-maintainers would you please help us with that ?

@willcohen
Copy link
Contributor Author

Per 70f3863 it seems like it's okay to refer to the systemwide one -- my read of this is that something QGIS is calling in Qt is leading to this crashing during the invocation of QGuiApplicationPrivate::createPlatformIntegration(). @LnL7 or @worldofpeace do either of you have a hunch?

@imincik
Copy link
Contributor

imincik commented Jan 12, 2023

Per 70f3863 it seems like it's okay to refer to the systemwide one -- my read of this is that something QGIS is calling in Qt is leading to this crashing during the invocation of QGuiApplicationPrivate::createPlatformIntegration(). @LnL7 or @worldofpeace do either of you have a hunch?

@willcohen , quite old but maybe - https://bugreports.qt.io/browse/QTBUG-48015

@viraptor
Copy link
Contributor

viraptor commented Jan 12, 2023

darwin is not completely pure unfortunately. The /usr/lib/libSystem and probably some other references will be present in nix builds. This affects close to all packages:

$ otool -L /nix/store/067f780bk90ghn7yhz914d5fykmll7a4-bash-5.1-p16/bin/bash
/nix/store/067f780bk90ghn7yhz914d5fykmll7a4-bash-5.1-p16/bin/bash:
	@rpath/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1454.90.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)

Copy link
Contributor

@Et7f3 Et7f3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to debug nix develop -i .#qgis.passthru.unwrapped but I get error with missing nose2 import. Can you see your log to see if the tests fail on your machine ? (I have Darwin sandbox mode)

] ++ lib.optional (!withWebKit) "-DWITH_QTWEBKIT=OFF"
++ lib.optional stdenv.isLinux "-DWITH_PDAL=TRUE"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change ? it seems to build fine on Mac with this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call -- it was broken a long time ago and I just assumed that was still true. Fixed since October with #195216. Will revise.

$out/Applications/QGIS.app/Contents/Frameworks/qgisgrass8.framework/qgisgrass8
do
echo "Manually running install_name_tool on $f"
install_name_tool -change "@loader_path/../lib/libqscintilla2_qt5.dylib" "${qscintilla}/lib/libqscintilla2_qt5.dylib" $f
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how did you get this list ? can it be parsed and looped over ? it should be more resistant to future upgrade

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was, unfortunately, done by me repeatedly building and running the .app, having it crash due to a linking error, and repeating over and over. I did at least simplify it so it can loop over the dylibs I know about. It seems like the original build script does it with a little less targeting, but it's true that this is moderately fragile. I'm open to suggestions for how to improve it -- fixDarwinDylib names was too blunt an instrument and tried to operate on lots of files in $out, and wasn't able to deal with the Frameworks, so I ended up just doing this manually.

do
echo "Manually running install_name_tool on $f"
install_name_tool -change "@loader_path/../lib/libqscintilla2_qt5.dylib" "${qscintilla}/lib/libqscintilla2_qt5.dylib" $f
install_name_tool -change "@loader_path/../lib/libqt5keychain.dylib" "${qtkeychain}/lib/libqt5keychain.dylib" $f
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
install_name_tool -change "@loader_path/../lib/libqt5keychain.dylib" "${qtkeychain}/lib/libqt5keychain.dylib" $f
install_name_tool -change "@loader_path/../lib/libqt5keychain.dylib" "${qtkeychain}/lib/libqt5keychain.dylib" "$f"

same for all other

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch -- will revise.

@willcohen
Copy link
Contributor Author

nix develop -i .#qgis.passthru.unwrapped

I'm not sure that this will ever work with sandbox enabled. Before even anything about tests failing, with sandbox enabled I get ld: warning: directory not found for option '-F/Library/Frameworks' failures in the build. My post-fixup changes end up relinking all the dylibs around so that they're linked based on the symbolic links that get generated in the end, but it seems like keeping the build that pure might be a version 2.0 kind of task for this derivation.

@Et7f3
Copy link
Contributor

Et7f3 commented Jan 14, 2023

I think that without sandboxing you might get a dependencies that mismatch and it can cause failure. Once I got a build issue because of my locale that wasn't unset. But ok I will un sandbox for this derivation. I was able to launch some test in sandbox mode.

@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants