anthonygelibert/QLColorCode

Not working on Apple M1 devices

ozzag opened this issue · 17 comments

ozzag commented

I test many times but it not working on Apple M1 devices

0x5e commented

Same to me, here's my crash log:

Process:               highlight [92180]
Path:                  /Users/USER/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources/highlight
Identifier:            highlight
Version:               0
Code Type:             X86-64 (Translated)
Parent Process:        zsh [92176]
Responsible:           quicklookd [92155]
User ID:               501

Date/Time:             2021-05-18 11:52:31.237 +0800
OS Version:            macOS 11.2.3 (20D91)
Report Version:        12
Anonymous UUID:        9064CB04-388D-BAAD-90E2-C0D497B0CDA5

Sleep/Wake UUID:       FF7D79E8-9055-41EE-9748-0BEEE7B9CC8E

Time Awake Since Boot: 53000 seconds
Time Since Wake:       7800 seconds

System Integrity Protection: disabled

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

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Illegal instruction: 4
Termination Reason:    Namespace SIGNAL, Code 0x4
Terminating Process:   exc handler [92180]

Application Specific Information:
dyld2 mode

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   highlight                     	0x0000000104718069 lua_newstate + 89
1   libsystem_malloc.dylib        	0x00007fff2019cec4 small_malloc_should_clear + 1567
2   highlight                     	0x00000001047259d4 luaL_newstate + 20
3   highlight                     	0x00000001046f8668 Diluculum::LuaState::LuaState(bool) + 40
4   highlight                     	0x000000010468b93a DataDir::loadFileTypeConfig(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) + 122
5   highlight                     	0x0000000104633025 HLCmdLineApp::run(int, char const**) + 309
6   highlight                     	0x0000000104636af1 main + 49
7   libdyld.dylib                 	0x00007fff20391621 start + 1

Thread 1:: com.apple.rosetta.exceptionserver
0   runtime                       	0x00007ffdffc23238 0x7ffdffc21000 + 8760
1   runtime                       	0x00007ffdffc2d354 0x7ffdffc21000 + 50004
2   runtime                       	0x00007ffdffc2e1f8 0x7ffdffc21000 + 53752

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x00007f98f58082c8  rbx: 0x00007f98f5808200  rcx: 0x0000000000000000  rdx: 0x0000000000000004
  rdi: 0x000000010cae6a00  rsi: 0x000000010cae6a00  rbp: 0x000000030d225bb0  rsp: 0x000000030d225b60
   r8: 0x0000000002000001   r9: 0x9e3779b97f4a7c55  r10: 0x0000000000000003  r11: 0x0000000000000007
  r12: 0x0000000104725a10  r13: 0x0000000000000650  r14: 0x00007f98f5808208  r15: 0x0000000000000000
  rip: 0x0000000104718069  rfl: 0x0000000000000203


Binary Images:
       0x104627000 -        0x104762fff +highlight (0) <4AEF2963-F593-3139-BAE7-4048ACFE4B67> /Users/USER/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources/highlight
       0x204ae8000 -        0x204b83fff  dyld (832.7.3) <0D4EA85F-7E30-338B-9215-314A5A5539B6> /usr/lib/dyld
    0x7ffdffc21000 -     0x7ffdffc94fff +runtime (203.30) <C98E75A6-BDC8-3D5C-B95B-6422005E96D8> /Library/Apple/*/runtime
    0x7fff200aa000 -     0x7fff200abfff  libsystem_blocks.dylib (78) <E644CAA0-65B7-36E4-8041-520F3301F3DB> /usr/lib/system/libsystem_blocks.dylib
    0x7fff200ac000 -     0x7fff200e1fff  libxpc.dylib (2038.80.3) <70F26262-01AA-3CEC-9FAD-2701D24096F0> /usr/lib/system/libxpc.dylib
    0x7fff200e2000 -     0x7fff200f9fff  libsystem_trace.dylib (1277.80.2) <87FEF600-48D9-31C9-B8FC-D5249B2AE95D> /usr/lib/system/libsystem_trace.dylib
    0x7fff200fa000 -     0x7fff20199fff  libcorecrypto.dylib (1000.80.5) <1EB11CFB-ABD7-36DD-97C7-C112A6601416> /usr/lib/system/libcorecrypto.dylib
    0x7fff2019a000 -     0x7fff201c6fff  libsystem_malloc.dylib (317.40.8) <A498D1EF-E43D-310C-84E8-9C0AADA0C475> /usr/lib/system/libsystem_malloc.dylib
    0x7fff201c7000 -     0x7fff2020bfff  libdispatch.dylib (1271.40.12) <AD988EEA-1A2F-3404-9A6E-390FC2504223> /usr/lib/system/libdispatch.dylib
    0x7fff2020c000 -     0x7fff20245fff  libobjc.A.dylib (818.2) <0F399805-A533-3DC9-A951-1D3DF1442BD9> /usr/lib/libobjc.A.dylib
    0x7fff20246000 -     0x7fff20248fff  libsystem_featureflags.dylib (28.60.1) <9CECB43A-094E-3CA9-B730-24DEA1A6DE05> /usr/lib/system/libsystem_featureflags.dylib
    0x7fff20249000 -     0x7fff202d1fff  libsystem_c.dylib (1439.40.11) <4AF71812-4099-3E96-B271-1F259491A2B2> /usr/lib/system/libsystem_c.dylib
    0x7fff202d2000 -     0x7fff20327fff  libc++.1.dylib (904.4) <B217D905-4F9C-3DE0-8844-88FAA3C2C851> /usr/lib/libc++.1.dylib
    0x7fff20328000 -     0x7fff20340fff  libc++abi.dylib (904.4) <3C9FE530-3CD2-3A64-8A36-70816AEBDF0D> /usr/lib/libc++abi.dylib
    0x7fff20341000 -     0x7fff2036ffff  libsystem_kernel.dylib (7195.81.3) <AB413518-ECDE-3F04-A61C-278D3CF43076> /usr/lib/system/libsystem_kernel.dylib
    0x7fff20370000 -     0x7fff2037bfff  libsystem_pthread.dylib (454.80.2) <B989DF6C-ADFE-3AF9-9C91-07D2521F9E47> /usr/lib/system/libsystem_pthread.dylib
    0x7fff2037c000 -     0x7fff203b6fff  libdyld.dylib (832.7.3) <4641E48F-75B5-3CC7-8263-47BF79F15394> /usr/lib/system/libdyld.dylib
    0x7fff203b7000 -     0x7fff203c0fff  libsystem_platform.dylib (254.80.2) <1C3E1A0A-92A8-3CDE-B622-8940B43A5DF2> /usr/lib/system/libsystem_platform.dylib
    0x7fff203c1000 -     0x7fff203ecfff  libsystem_info.dylib (542.40.3) <0C96CFE8-71F5-3335-8423-581BC3DE5846> /usr/lib/system/libsystem_info.dylib
    0x7fff22710000 -     0x7fff22719fff  libsystem_darwin.dylib (1439.40.11) <E016D8F7-C87F-36F8-B8A0-6A61B8E4BACB> /usr/lib/system/libsystem_darwin.dylib
    0x7fff22b2b000 -     0x7fff22b36fff  libsystem_notify.dylib (279.40.4) <B2BF20C7-448A-3FBD-A2F5-AB7618D173F6> /usr/lib/system/libsystem_notify.dylib
    0x7fff24a87000 -     0x7fff24a95fff  libsystem_networkextension.dylib (1295.80.3) <5213D866-7D0E-3FD9-8E1A-03C0E39CEC44> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff24af3000 -     0x7fff24b09fff  libsystem_asl.dylib (385) <5B48071E-85EB-33B0-AE9B-127AEB398AEC> /usr/lib/system/libsystem_asl.dylib
    0x7fff26221000 -     0x7fff26228fff  libsystem_symptoms.dylib (1431.40.36) <BC85B46C-02EE-31FF-861D-F0DE01E8F6CF> /usr/lib/system/libsystem_symptoms.dylib
    0x7fff28553000 -     0x7fff28563fff  libsystem_containermanager.dylib (318.80.2) <6F08275F-B912-3D8E-9D74-4845158AE4F3> /usr/lib/system/libsystem_containermanager.dylib
    0x7fff29264000 -     0x7fff29267fff  libsystem_configuration.dylib (1109.60.2) <4917D824-4DE8-32CC-9ED2-1FBF371FEB9F> /usr/lib/system/libsystem_configuration.dylib
    0x7fff29268000 -     0x7fff2926cfff  libsystem_sandbox.dylib (1441.60.4) <5F7F3DD1-4B38-310C-AA8F-19FF1B0F5276> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff29e77000 -     0x7fff29e79fff  libquarantine.dylib (119.40.2) <40D35D75-524B-3DA6-8159-E7E0FA66F5BC> /usr/lib/system/libquarantine.dylib
    0x7fff2a3fa000 -     0x7fff2a3fefff  libsystem_coreservices.dylib (127) <529A0663-A936-309C-9318-1B04B7F70658> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff2a615000 -     0x7fff2a660fff  libsystem_m.dylib (3186.40.2) <7BE9BAE3-ADED-35DD-B920-34F590BAB507> /usr/lib/system/libsystem_m.dylib
    0x7fff2a662000 -     0x7fff2a667fff  libmacho.dylib (973.4) <C2584BC4-497B-3170-ADDF-21B8E10B4DFD> /usr/lib/system/libmacho.dylib
    0x7fff2a684000 -     0x7fff2a68ffff  libcommonCrypto.dylib (60178.40.2) <822A29CE-BF54-35AD-BB15-8FAECB800C7D> /usr/lib/system/libcommonCrypto.dylib
    0x7fff2a690000 -     0x7fff2a69afff  libunwind.dylib (200.10) <1D0A4B4A-4370-3548-8DC1-42A7B4BD45D3> /usr/lib/system/libunwind.dylib
    0x7fff2a69b000 -     0x7fff2a6a2fff  liboah.dylib (203.30) <44C477D9-013F-3A6D-A9FE-68A89214E6A5> /usr/lib/liboah.dylib
    0x7fff2a6a3000 -     0x7fff2a6adfff  libcopyfile.dylib (173.40.2) <39DBE613-135B-3AFE-A6AF-7898A37F70C2> /usr/lib/system/libcopyfile.dylib
    0x7fff2a6ae000 -     0x7fff2a6b5fff  libcompiler_rt.dylib (102.2) <62EE1D14-5ED7-3CEC-81C0-9C93833641F1> /usr/lib/system/libcompiler_rt.dylib
    0x7fff2a6b6000 -     0x7fff2a6b8fff  libsystem_collections.dylib (1439.40.11) <C53D5E0C-0C4F-3B35-A24B-E0D7101A3F95> /usr/lib/system/libsystem_collections.dylib
    0x7fff2a6b9000 -     0x7fff2a6bbfff  libsystem_secinit.dylib (87.60.1) <E05E35BC-1BAB-365B-8BEE-D774189EFD3B> /usr/lib/system/libsystem_secinit.dylib
    0x7fff2a6bc000 -     0x7fff2a6befff  libremovefile.dylib (49.40.3) <5CC12A16-82CB-32F0-9040-72CFC88A48DF> /usr/lib/system/libremovefile.dylib
    0x7fff2a6bf000 -     0x7fff2a6bffff  libkeymgr.dylib (31) <803F6AED-99D5-3CCF-B0FA-361BCF14C8C0> /usr/lib/system/libkeymgr.dylib
    0x7fff2a6c0000 -     0x7fff2a6c7fff  libsystem_dnssd.dylib (1310.80.1) <E0A0CAB3-6779-3C83-AC67-046CFE69F9C2> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff2a6c8000 -     0x7fff2a6cdfff  libcache.dylib (83) <1A98B064-8FED-39CF-BB2E-5BDA1EF5B65A> /usr/lib/system/libcache.dylib
    0x7fff2a6ce000 -     0x7fff2a6cffff  libSystem.B.dylib (1292.60.1) <83503CE0-32B1-36DB-A4F0-3CC6B7BCF50A> /usr/lib/libSystem.B.dylib
    0x7fff2dc63000 -     0x7fff2dc63fff  liblaunch.dylib (2038.80.3) <C7C51322-8491-3B78-9CFA-2B4753662BCF> /usr/lib/system/liblaunch.dylib
    0x7fff30117000 -     0x7fff30117fff  libsystem_product_info_filter.dylib (8.40.1) <20310EE6-2C3F-361A-9ECA-4223AFC03B65> /usr/lib/system/libsystem_product_info_filter.dylib

Translated Code Information:
  tmp0: 0x0000000104718069 tmp1: 0x4311f8c5c057f8c5 tmp2: 0x00c748c957f0c538


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: 5251979
    thread_create: 0
    thread_set_state: 230

VM Region Summary:
ReadOnly portion of Libraries: Total=513.3M resident=0K(0%) swapped_out_or_unallocated=513.3M(100%)
Writable regions: Total=177.7M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=177.7M(100%)
 
                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Activity Tracing                   256K        1 
Kernel Alloc Once                    8K        1 
MALLOC                            28.1M       13 
MALLOC guard page                   96K        4 
Rosetta Arena                     2048K        1 
Rosetta Generic                    744K      183 
Rosetta IndirectBranch              32K        1 
Rosetta JIT                      128.0M        1 
Rosetta Return Stack                20K        2 
Rosetta Thread Context              20K        2 
Stack                             8176K        1 
Stack Guard                       56.0M        1 
VM_ALLOCATE                       7712K        1 
__DATA                             453K       45 
__DATA_CONST                       275K       34 
__DATA_DIRTY                        58K       21 
__LINKEDIT                       506.7M        6 
__OBJC_RO                         60.6M        1 
__OBJC_RW                         2449K        2 
__TEXT                            6740K       45 
mapped file                        4.1G       73 
shared memory                       32K        2 
unshared pmap                     2880K        2 
===========                     =======  ======= 
TOTAL                              4.9G      443 

Same here

Me too.
Device: MBP M1
OS: BigSur 11.5

This helped me.
whomwah/qlstephen#112

I've downloaded the project and compiled myself, but still, on M1 I'm having problems:

  • QLColorCode has no permission to read preferences. Check error on console app: "accessing preferences outside an application's container requires user-preference-read or file-read-data sandbox access"

  • colorize.sh seems not able to exec subprocess in go4it func, they get killed with a permission denied (enabling setStandardError on runtask shows script errors on preview window)

As a result, an empty white preview window is shown.

I've tried adding a new target that would be sandboxed with permissions, but I miss macOS development and quicklook plugin knowledge to be able to add the cli app into the bundle package and get it executed (maybe if I retake this in the future I can use this post as help https://blog.timac.org/2021/0516-mac-app-store-embedding-a-command-line-tool-using-paths-as-arguments/)

No problems on m1 for me. Just compiled latest lua/highlight and $ xcodebuild

$ file QLColorCode
QLColorCode: Mach-O universal binary with 2 architectures: [x86_64:Mach-O 64-bit bundle x86_64] [arm64:Mach-O 64-bit bundle arm64]
QLColorCode (for architecture x86_64):	Mach-O 64-bit bundle x86_64
QLColorCode (for architecture arm64):	Mach-O 64-bit bundle arm64
$ arch
arm64
$

@serge-ivamov is it compiling? is it working properly? or both?

both.

I found the reason for the blank screen.
This is the absence of a dark theme file 'darkplus.theme'.
So u can just

$ cd ~/Library/QuickLook/QLColorCode.qlgenerator/Contents/Resources/themes
$ ln -s darkness.theme darkplus.theme

or edit Common.m for it.

P.S. lol, looks like I got highlight from old location (https://github.com/andre-simon/highlight)
The gitlab version has darkplus.theme.

P.P.S. Found another problem for m1 - bad signing. Just need to resign.

codesign -vv ~/Library/QuickLook/QLColorCode.qlgenerator/Contents/MacOS/QLColorCode
codesign -fs - ~/Library/QuickLook/QLColorCode.qlgenerator/Contents/MacOS/QLColorCode
codesign -vv ~/Library/QuickLook/QLColorCode.qlgenerator/Contents/MacOS/QLColorCode
qlmanage -r
qlmanage -r cache
pkill -1 Finder

btw adding public.json to Info.plist will add support for .json files.

$ diff -b -C 3 Info.plist.orig Info.plist
*** Info.plist.orig	2021-09-15 12:48:20.000000000 +0400
--- Info.plist	2021-09-15 12:41:28.000000000 +0400
***************
*** 22,27 ****
--- 22,28 ----
  					<string>com.microsoft.c-sharp</string>
  					<string>com.microsoft.f-sharp</string>
  					<string>public.css</string>
+ 					<string>public.json</string>
  					<string>com.apple.applescript.script</string>
  					<string>public.xml</string>
  					<string>com.apple.property-list</string>
jpc commented

I made a few adjustments to the build configuration (#91) and went through the pain of getting it signed and notarized. Here is a working universal release for both Apple M1 and 64-bit Intel:

https://github.com/jpc/QLColorCode/releases/tag/release-4.1.2%2Bm1

@jpc absolute legend, thank you so much!

deden commented

@jpc , thank you, it's working👍🏻

Probably close. It's working for me on M1.

Not working in MacOS 12.4, M1Pro.

$ qlmanage -p ~/Downloads/testing.fun.Rmd
Testing Quick Look preview with files:
	/Users/massisenergy/Downloads/testing.fun.Rmd
2022-06-10 13:56:56.433 qlmanage[9564:36798] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x9503, name = 'com.apple.coredrag'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2022-06-10 13:56:56.454 qlmanage[9564:36798] *** CFMessagePort: bootstrap_register(): failed 1100 (0x44c) 'Permission denied', port = 0x7e07, name = 'com.apple.tsm.portname'
See /usr/include/servers/bootstrap_defs.h for the error codes.

I added the dyn.ah62d4rv4ge81e5pe in proper place in ~/Library/QuickLook/QLColorCode.qlgenerator/Contents/Info.plist but it still doesn't work. It used to work for .Rmd files before.

$ mdls -name kMDItemContentType -name kMDItemContentTypeTree ~/Downloads/testing.fun.Rmd
kMDItemContentType     = "dyn.ah62d4rv4ge81e5pe"
kMDItemContentTypeTree = (
    "public.item",
    "dyn.ah62d4rv4ge81e5pe",
    "public.data"
)

I get the same errors as massisenergy when attempting to preview .py files. I have an M1Max computer with macOS 12.5

Probably this repo is abandoned & out of maintenance. For now, I am using QLMarkdown and SourceCodeSyntaxHighlight, which does the job fine (quicklook preview) so far for all my required files.