Segmentation fault: 11 while creating executable with pyinstaller

1

Recently, I have created a simple python app with a GUI implemented with the PyQt5 library. I have tested the app itself multiple times and everything works fine. However, after I tried to package that as an executable using pyinstaller, running the resultant executable doesn't create the GUI and instead leads to segmentation fault: 11. I read that this error code means that the program lacks access to a memory address that it is supposed to be able to access, but I have no idea why.

How can I tackle this?

Here's part of the crash report:

Process:               cli [12548]
Path:                  /Users/USER/Documents/*/cli
Identifier:            cli
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        bash [11625]
Responsible:           Terminal [47976]
User ID:               501

Date/Time:             2021-03-29 12:36:39.423 +0800
OS Version:            Mac OS X 10.15.5 (19F101)
Report Version:        12
Anonymous UUID:        855A3445-44EF-6596-8FC5-13FFACDFC8D8

Sleep/Wake UUID:       0B342A31-57D9-44C6-8B29-7CA1D7E3E56B

Time Awake Since Boot: 1200000 seconds
Time Since Wake:       2800 seconds

System Integrity Protection: enabled

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

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000010
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [12548]

VM Regions Near 0x10:
--> 
    __TEXT                 0000000100a49000-0000000100a50000 [   28K] r-x/r-x SM=COW  /Users/USER/Documents/*

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   com.apple.CoreFoundation        0x00007fff324d1488 CFBundleCopyBundleURL + 9
1   QtCore                          0x0000000102b14470 QLibraryInfo::location(QLibraryInfo::LibraryLocation) + 1328
2   QtCore                          0x0000000102b146cd QLibraryInfo::location(QLibraryInfo::LibraryLocation) + 1933
3   QtCore                          0x0000000102cfa494 QCoreApplication::libraryPathsLocked() + 1524
4   QtCore                          0x0000000102cf657b QCoreApplication::libraryPaths() + 43
5   QtCore                          0x0000000102ce50a4 QFactoryLoader::update() + 36
6   QtCore                          0x0000000102ce69c0 QFactoryLoader::QFactoryLoader(char const*, QString const&, Qt::CaseSensitivity) + 224
7   QtGui                           0x000000010249db3c QGlobalStatic<QFactoryLoader, (anonymous namespace)::Q_QGS_loader::innerFunction(), (anonymous namespace)::Q_QGS_loader::guard>::operator()() + 172
8   QtGui                           0x000000010249def1 QPlatformIntegrationFactory::keys(QString const&) + 785
9   QtGui                           0x00000001024aae5a QGuiApplicationPrivate::createPlatformIntegration() + 1690
10  QtGui                           0x00000001024ac3fb QGuiApplicationPrivate::createEventDispatcher() + 27
11  QtCore                          0x0000000102cf61af QCoreApplicationPrivate::init() + 1599
12  QtGui                           0x00000001024a6b59 QGuiApplicationPrivate::init() + 57
13  QtWidgets                       0x0000000101e4cada QApplicationPrivate::init() + 26
14  QtWidgets.abi3.so               0x0000000101a1537b init_type_QApplication(_sipSimpleWrapper*, _object*, _object*, _object**, _object**, _object**) + 171
15  sip.cpython-37m-darwin.so       0x00000001031c39cb sipSimpleWrapper_init + 203
16  Python                          0x00000001010a1199 type_call + 297
17  Python                          0x0000000101055d81 _PyObject_FastCallKeywords + 433
18  Python                          0x0000000101115ed4 call_function + 420
19  Python                          0x0000000101112fdd _PyEval_EvalFrameDefault + 25181
20  Python                          0x00000001010563a0 function_code_fastcall + 128
21  Python                          0x0000000101116012 call_function + 738
22  Python                          0x000000010111307e _PyEval_EvalFrameDefault + 25342
23  Python                          0x0000000101116b63 _PyEval_EvalCodeWithName + 2467
24  Python                          0x000000010110cca4 PyEval_EvalCode + 100
25  Python                          0x000000010110a20d builtin_exec + 557
26  Python                          0x0000000101056a5e _PyMethodDef_RawFastCallKeywords + 430
27  Python                          0x0000000101055f6a _PyCFunction_FastCallKeywords + 42
28  Python                          0x0000000101116004 call_function + 724
29  Python                          0x000000010111307e _PyEval_EvalFrameDefault + 25342
30  Python                          0x00000001010563a0 function_code_fastcall + 128
31  Python                          0x0000000101116012 call_function + 738
32  Python                          0x0000000101112fc3 _PyEval_EvalFrameDefault + 25155
33  Python                          0x00000001010563a0 function_code_fastcall + 128
34  Python                          0x0000000101116012 call_function + 738
35  Python                          0x000000010111307e _PyEval_EvalFrameDefault + 25342
36  Python                          0x00000001010563a0 function_code_fastcall + 128
37  Python                          0x0000000101116012 call_function + 738
38  Python                          0x000000010111307e _PyEval_EvalFrameDefault + 25342
39  Python                          0x00000001010563a0 function_code_fastcall + 128
40  Python                          0x0000000101055994 _PyFunction_FastCallDict + 148
41  Python                          0x0000000101057abc object_vacall + 316
42  Python                          0x0000000101057bb1 _PyObject_CallMethodIdObjArgs + 177
43  Python                          0x000000010113518f PyImport_ImportModuleLevelObject + 1535
44  Python                          0x0000000101111955 _PyEval_EvalFrameDefault + 19413
45  Python                          0x0000000101116b63 _PyEval_EvalCodeWithName + 2467
46  Python                          0x000000010110cca4 PyEval_EvalCode + 100
47  cli                             0x0000000100a4b1fb 0x100a49000 + 8699
48  cli                             0x0000000100a4b60c 0x100a49000 + 9740
49  cli                             0x0000000100a49dc4 0x100a49000 + 3524

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

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

Thread 3:
0   libsystem_kernel.dylib          0x00007fff6c6b4882 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff6c775425 _pthread_cond_wait + 698
2   libopenblas.0.dylib             0x000000010643a21f blas_thread_server + 207
3   libsystem_pthread.dylib         0x00007fff6c775109 _pthread_start + 148
4   libsystem_pthread.dylib         0x00007fff6c770b8b thread_start + 15

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0xbd8b726b2745000a  rbx: 0x0000000000000000  rcx: 0x0000000000000000  rdx: 0x00007fff6b3e0448
  rdi: 0x0000000000000000  rsi: 0x0000000000000cfa  rbp: 0x00007ffeef1b3dd0  rsp: 0x00007ffeef1b3dc0
   r8: 0x0000800000000040   r9: 0x0000000000000081  r10: 0x00007fe5cac00000  r11: 0x00007fe5cacd3ad0
  r12: 0x00007fe5cacd3480  r13: 0x000000000000008d  r14: 0x0000000000000000  r15: 0x00007fe5cacd0c10
  rip: 0x00007fff324d1488  rfl: 0x0000000000010246  cr2: 0x0000000000000010
  
Logical CPU:     0
Error Code:      0x00000004 (no mapping for user data read)
Trap Number:     14
python
macos
crash
segmentation-fault
pyinstaller
asked on Stack Overflow Mar 29, 2021 by Michael Cheng

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0