[BUG] `Pyarmor 9.2.1 causing unknown crashes`
Firstly, it is confirmed that this issue does not occur in Pyarmor version 9.2.0. Current situation: When packaging a PyQt6 application using Pyarmor, the application fails to launch properly and crashes immediately. However, the crash reason cannot be retrieved via the console; the error can only be directly observed through the Resource Monitor.
Base Info:
D:\Downloads\pyarmor_demo\xImageViewer>pyarmor --version
Pyarmor 9.2.1 (group), 006040, non-profits
License Type : pyarmor-group
License No. : pyarmor-vax-006040
License To : xAccel
License Product : non-profits
BCC Mode : Yes
RFT Mode : Yes
CI/CD Mode : No
Notes
* Offline obfuscation
447.22
D:\Downloads\pyarmor_demo\xImageViewer>Python -V
Python 3.13.9
D:\Downloads\pyarmor_demo\xImageViewer>ver
Microsoft Windows [Version 10.0.26200.7171]
Build Command:
D:\Downloads\pyarmor_demo\xImageViewer\source>pyi-makespec --onefile --windowed --name xImageViewer main.py
Wrote D:\Downloads\pyarmor_demo\xImageViewer\source\xImageViewer.spec.
Now run pyinstaller.py to build the executable.
D:\Downloads\pyarmor_demo\xImageViewer\source>cd ../
D:\Downloads\pyarmor_demo\xImageViewer>pyarmor cfg data_files=*
INFO Python 3.13.9
INFO Pyarmor 9.2.1 (group), 006040, non-profits
INFO Platform windows.x86_64
INFO change option "data_files" to new value "*"
------------------------------------------------------------
Section: finder
Current settings
data_files = 0
Global settings
Local settings
data_files = *
D:\Downloads\pyarmor_demo\xImageViewer>pyarmor gen --recursive --enable-bcc --obf-code 2 --output release --pack source/xImageViewer.spec source
INFO Python 3.13.9
INFO Pyarmor 9.2.1 (group), 006040, non-profits
INFO Platform windows.x86_64
INFO implicitly save obfuscated scripts to ".pyarmor\pack\dist"
INFO search inputs ...
INFO find package at source
INFO find 1 top resources
INFO start to generate runtime files
INFO target platforms {'windows.amd64'}
INFO write .pyarmor\pack\dist\pyarmor_runtime_006040\pyarmor_runtime.pyd
INFO generate runtime files OK
INFO start to obfuscate scripts
INFO process resource "source"
INFO obfuscating file config.py
INFO start to generate bcc code ...
INFO no bcc code generated
INFO write .pyarmor\pack\dist\source\config.py
INFO obfuscating file function.py
INFO start to generate bcc code ...
INFO generate bcc code successfully
INFO write .pyarmor\pack\dist\source\function.py
INFO obfuscating file icon_view.py
INFO start to generate bcc code ...
INFO no bcc code generated
INFO write .pyarmor\pack\dist\source\icon_view.py
INFO obfuscating file initial.py
INFO start to generate bcc code ...
INFO generate bcc code successfully
INFO write .pyarmor\pack\dist\source\initial.py
INFO obfuscating file main.py
INFO start to generate bcc code ...
INFO no bcc code generated
INFO write .pyarmor\pack\dist\source\main.py
INFO obfuscating file signalslot.py
INFO start to generate bcc code ...
INFO generate bcc code successfully
INFO write .pyarmor\pack\dist\source\signalslot.py
INFO copy data file source\xImageViewer.spec
INFO obfuscating file __init__.py
INFO start to generate bcc code ...
INFO no bcc code generated
INFO write .pyarmor\pack\dist\source\__init__.py
INFO obfuscating file search_function.py
INFO start to generate bcc code ...
INFO generate bcc code successfully
INFO write .pyarmor\pack\dist\source\search\search_function.py
INFO obfuscating file search_initial.py
INFO start to generate bcc code ...
INFO generate bcc code successfully
INFO write .pyarmor\pack\dist\source\search\search_initial.py
INFO obfuscating file search_main.py
INFO start to generate bcc code ...
INFO no bcc code generated
INFO write .pyarmor\pack\dist\source\search\search_main.py
INFO obfuscating file search_signalslot.py
INFO start to generate bcc code ...
INFO generate bcc code successfully
INFO write .pyarmor\pack\dist\source\search\search_signalslot.py
INFO obfuscating file search_layout.py
INFO start to generate bcc code ...
INFO generate bcc code successfully
INFO write .pyarmor\pack\dist\source\search\ui\search_layout.py
INFO copy data file source\search\ui\search_layout.ui
INFO obfuscate scripts OK
68 INFO: PyInstaller: 6.17.0, contrib hooks: 2025.9
69 INFO: Python: 3.13.9
84 INFO: Platform: Windows-11-10.0.26200-SP0
84 INFO: Python environment: D:\App\Python
85 INFO: Removing temporary files and cleaning cache in C:\Users\xAccel\AppData\Local\pyinstaller
86 INFO: Module search paths (PYTHONPATH):
['D:\\Downloads\\pyarmor_demo\\xImageViewer',
'D:\\xAccel\\Joker\\xLib\\xqt\\xqt_release',
'D:\\xAccel\\Joker\\xLib\\xicon\\xicon_release',
'D:\\Downloads\\pyarmor_demo\\xImageViewer',
'D:\\App\\Python\\python313.zip',
'D:\\App\\Python\\DLLs',
'D:\\App\\Python\\Lib',
'D:\\App\\Python',
'D:\\App\\Python\\Lib\\site-packages',
'D:\\App\\Python\\Lib\\site-packages\\win32',
'D:\\App\\Python\\Lib\\site-packages\\win32\\lib',
'D:\\App\\Python\\Lib\\site-packages\\Pythonwin',
'D:\\Downloads\\pyarmor_demo\\xImageViewer']
258 INFO: checking Analysis
258 INFO: Building Analysis because Analysis-00.toc is non existent
258 INFO: Looking for Python shared library...
258 INFO: Using Python shared library: D:\App\Python\python313.dll
258 INFO: Running Analysis Analysis-00.toc
258 INFO: Target bytecode optimization level: 0
258 INFO: Initializing module dependency graph...
259 INFO: Initializing module graph hook caches...
265 INFO: Analyzing modules for base_library.zip ...
896 INFO: Processing standard module hook 'hook-encodings.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks'
1908 INFO: Processing standard module hook 'hook-pickle.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks'
2497 INFO: Processing standard module hook 'hook-heapq.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks'
2745 INFO: Caching module dependency graph...
2769 INFO: Analyzing D:\Downloads\pyarmor_demo\xImageViewer\source\main.py
2771 INFO: Processing standard module hook 'hook-PyQt6.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks'
3202 INFO: Processing standard module hook 'hook-PyQt6.QtWidgets.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks'
3563 INFO: Processing standard module hook 'hook-PyQt6.QtCore.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks'
4013 INFO: Processing standard module hook 'hook-PyQt6.QtGui.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks'
4131 INFO: Processing standard module hook 'hook-PyQt6.QtSvgWidgets.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks'
4170 INFO: Processing standard module hook 'hook-PyQt6.QtSvg.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks'
4216 INFO: Processing standard module hook 'hook-regex.py' from 'D:\\App\\Python\\Lib\\site-packages\\_pyinstaller_hooks_contrib\\stdhooks'
4375 INFO: Processing module hooks (post-graph stage)...
4400 INFO: Performing binary vs. data reclassification (114 entries)
4407 INFO: Looking for ctypes DLLs
4410 INFO: Analyzing run-time hooks ...
4411 INFO: Including run-time hook 'pyi_rth_inspect.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks'
4413 INFO: Including run-time hook 'pyi_rth_pyqt6.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks'
4415 INFO: Processing pre-find-module-path hook 'hook-_pyi_rth_utils.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks\\pre_find_module_path'
4415 INFO: Processing standard module hook 'hook-_pyi_rth_utils.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks'
4417 INFO: Including run-time hook 'pyi_rth_pkgutil.py' from 'D:\\App\\Python\\Lib\\site-packages\\PyInstaller\\hooks\\rthooks'
4421 INFO: Creating base_library.zip...
4432 INFO: Looking for dynamic libraries
4488 INFO: Extra DLL search directories (AddDllDirectory): ['D:\\App\\Python\\Lib\\site-packages\\PyQt6\\Qt6\\bin']
4488 INFO: Extra DLL search directories (PATH): ['D:\\App\\Python\\Lib\\site-packages\\PyQt6\\Qt6\\bin']
4744 INFO: Warnings written to D:\Downloads\pyarmor_demo\xImageViewer\.pyarmor\pack\build\xImageViewer.patched\warn-xImageViewer.patched.txt
4765 INFO: Graph cross-reference written to D:\Downloads\pyarmor_demo\xImageViewer\.pyarmor\pack\build\xImageViewer.patched\xref-xImageViewer.patched.html
4773 INFO: checking PYZ
4773 INFO: Building PYZ because PYZ-00.toc is non existent
4774 INFO: Building PYZ (ZlibArchive) D:\Downloads\pyarmor_demo\xImageViewer\.pyarmor\pack\build\xImageViewer.patched\PYZ-00.pyz
5055 INFO: Building PYZ (ZlibArchive) D:\Downloads\pyarmor_demo\xImageViewer\.pyarmor\pack\build\xImageViewer.patched\PYZ-00.pyz completed successfully.
5058 INFO: checking PKG
5058 INFO: Building PKG because PKG-00.toc is non existent
5058 INFO: Building PKG (CArchive) xImageViewer.pkg
11824 INFO: Building PKG (CArchive) xImageViewer.pkg completed successfully.
11826 INFO: Bootloader D:\App\Python\Lib\site-packages\PyInstaller\bootloader\Windows-64bit-intel\runw.exe
11826 INFO: checking EXE
11826 INFO: Building EXE because EXE-00.toc is non existent
11826 INFO: Building EXE from EXE-00.toc
11826 INFO: Copying bootloader EXE to D:\Downloads\pyarmor_demo\xImageViewer\release\xImageViewer.exe
11828 INFO: Copying icon to EXE
11829 INFO: Copying 0 resources to EXE
11829 INFO: Embedding manifest in EXE
11830 INFO: Appending PKG archive to EXE
11849 INFO: Fixing EXE headers
11958 INFO: Building EXE from EXE-00.toc completed successfully.
11960 INFO: Build complete! The results are available in: D:\Downloads\pyarmor_demo\xImageViewer\release
D:\Downloads\pyarmor_demo\xImageViewer>cd release
D:\Downloads\pyarmor_demo\xImageViewer\release>xImageViewer.exe
Source Code: xImageViewer.zip
If using bcc mode, try to change bcc default cflags, for example
pyarmor cfg windows.x86_64.bcc:cflags += " -DENABLE_PYAPI_REFCNT"
Just run this once, and then run pyarmor gen ...
D:\Downloads\pyarmor_demo\xImageViewer>pip install -U pyarmor
Requirement already satisfied: pyarmor in d:\app\python\lib\site-packages (9.2.0)
Collecting pyarmor
Using cached pyarmor-9.2.1-py3-none-any.whl.metadata (2.5 kB)
Requirement already satisfied: pyarmor.cli.core~=8.1.0 in d:\app\python\lib\site-packages (from pyarmor) (8.1.0)
Using cached pyarmor-9.2.1-py3-none-any.whl (3.1 MB)
Installing collected packages: pyarmor
Attempting uninstall: pyarmor
Found existing installation: pyarmor 9.2.0
Uninstalling pyarmor-9.2.0:
Successfully uninstalled pyarmor-9.2.0
Successfully installed pyarmor-9.2.1
D:\Downloads\pyarmor_demo\xImageViewer>cd source
D:\Downloads\pyarmor_demo\xImageViewer\source>pyi-makespec --onefile --windowed --name xImageViewer main.py
Wrote D:\Downloads\pyarmor_demo\xImageViewer\source\xImageViewer.spec.
Now run pyinstaller.py to build the executable.
D:\Downloads\pyarmor_demo\xImageViewer\source>cd ..
D:\Downloads\pyarmor_demo\xImageViewer>pyarmor cfg data_files=* windows.x86_64.bcc:cflags += " -DENABLE_PYAPI_REFCNT"
INFO Python 3.13.9
INFO Pyarmor 9.2.1 (group), 006040, non-profits
INFO Platform windows.x86_64
INFO change option "data_files" to new value "*"
INFO change option "cflags" to new value " -DENABLE_PYAPI_REFCNT"
------------------------------------------------------------
Section: finder
Current settings
data_files = 0
Global settings
Local settings
data_files = *
------------------------------------------------------------
Section: builder
Current settings
Global settings
Local settings
------------------------------------------------------------
Section: windows.x86_64.bcc
Current settings
cflags = -O3 -Wno-unsequenced -fno-asynchronous-unwind-tables -fno-unwind-tables --target=x86_64-elf-windows -c -DENABLE_BCC_MEMSET
Global settings
Local settings
cflags = -DENABLE_PYAPI_REFCNT
D:\Downloads\pyarmor_demo\xImageViewer>pyarmor gen --recursive --enable-bcc --obf-code 2 --output release --pack source/xImageViewer.spec source
INFO Python 3.13.9
INFO Pyarmor 9.2.1 (group), 006040, non-profits
INFO Platform windows.x86_64
INFO implicitly save obfuscated scripts to ".pyarmor\pack\dist"
INFO search inputs ...
INFO find package at source
INFO find 1 top resources
INFO start to generate runtime files
INFO target platforms {'windows.amd64'}
INFO write .pyarmor\pack\dist\pyarmor_runtime_006040\pyarmor_runtime.pyd
INFO generate runtime files OK
INFO start to obfuscate scripts
INFO process resource "source"
INFO obfuscating file config.py
INFO start to generate bcc code ...
INFO no bcc code generated
INFO write .pyarmor\pack\dist\source\config.py
INFO obfuscating file function.py
INFO start to generate bcc code ...
clang: error: linker command failed with exit code 1561 (use -v to see invocation)
ERROR Command '['clang.exe', '-DENABLE_PYAPI_REFCNT', '-o', '.pyarmor\\bcc\\source.function.c.o', '.pyarmor\\bcc\\source.function.c']' returned non-zero exit status 1561
Maybe pyarmor cfg name += value doesn't work as expected in windows shell, the current value of cflags is only -DENABLE_PYAPI_REFCNT
Well, make sure the final value of cflags is
-O3 -Wno-unsequenced -fno-asynchronous-unwind-tables -fno-unwind-tables --target=x86_64-elf-windows -c -DENABLE_BCC_MEMSET -DENABLE_PYAPI_REFCNT
Fixed in v9.2.2, it should not need extra cflags -DENABLE_PYAPI_REFCNT for BCC mode in Windows.x86_64