3-manifolds / Sage_macOS

SageMath as a macOS application bundle.
150 stars 15 forks source link

Installed app file gives an error on its first execution. #17

Closed byeongsuyu closed 3 years ago

byeongsuyu commented 3 years ago

I've download the latest release of SageMath-9-3.dmg. I follow the instructions 1) move app file into Application folder 2) Install pkg file. Then I just execute SageMath-9-3.app as usual in the Finder. Then it says that the execution was closed due to error. Below is the error message I've got.

Process: python3.9 [46987] Path: /Applications/SageMath-9-3.app/Contents/MacOS/SageMath Identifier: org.computop.SageMath Version: ??? Code Type: X86-64 (Native) Parent Process: ??? [1] Responsible: python3.9 [46987] User ID: 501

Date/Time: 2021-07-01 23:35:21.447 -0500 OS Version: Mac OS X 10.15.7 (19H1217) Report Version: 12 Anonymous UUID: 2691FC16-3F4F-4A28-BABE-30A65002BF16

Sleep/Wake UUID: 3A51F756-1D53-4688-AA9A-FAC6196EF1D9

Time Awake Since Boot: 730000 seconds Time Since Wake: 10000 seconds

System Integrity Protection: enabled

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 [46987]

Application Specific Information: dyld2 mode

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libpython3.9.dylib 0x000000010e97932c 0x10e8b6000 + 799532 1 libpython3.9.dylib 0x000000010e97916e _Py_DecodeUTF8Ex + 254 2 libpython3.9.dylib 0x000000010ea41fb1 Py_DecodeLocale + 49 3 libpython3.9.dylib 0x000000010ea221f0 _PyArgv_AsWstrList + 96 4 libpython3.9.dylib 0x000000010ea22d5c 0x10e8b6000 + 1494364 5 libpython3.9.dylib 0x000000010ea240c7 _Py_PreInitializeFromPyArgv + 295 6 libpython3.9.dylib 0x000000010ea468ec 0x10e8b6000 + 1640684 7 libpython3.9.dylib 0x000000010ea46a3b Py_BytesMain + 43 8 libdyld.dylib 0x00007fff6c4aacc9 start + 1

Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000000000000 rbx: 0x000000000000002f rcx: 0x00007ffee135c588 rdx: 0x00007fd3865041b0 rdi: 0x00007ffee135c580 rsi: 0x00007ffee135cc96 rbp: 0x00007ffee135c550 rsp: 0x00007ffee135c528 r8: 0x00007fd3865041b0 r9: 0x00007ffee135cc28 r10: 0x00007ffee135cc90 r11: 0x8080808080808080 r12: 0x0000000000000000 r13: 0x000000000000002f r14: 0x6163696c7070412f r15: 0x00007fd3865041b0 rip: 0x000000010e97932c rfl: 0x0000000000010246 cr2: 0x000000010ead05a0

Logical CPU: 0 Error Code: 0x00000000 Trap Number: 6

Binary Images: 0x10e8a3000 - 0x10e8a6ff3 +SageMath (0) <353C3350-2970-3C72-A885-219F979F24F4> /Applications/SageMath-9-3.app/Contents/Frameworks/Sage.framework/Versions/9.3/local/bin/python3.9 0x10e8b6000 - 0x10eb2dfef +libpython3.9.dylib (0) <86451832-18F4-37B4-B6F5-FDA94047BF08> /Applications/SageMath-9-3.app/Contents/Frameworks/Sage.framework/Versions/9.3/local/lib/libpython3.9.dylib 0x11d050000 - 0x11d0e1f47 dyld (750.6) /usr/lib/dyld 0x7fff25299000 - 0x7fff252baff7 libKoreanConverter.dylib (76) /System/Library/CoreServices/Encodings/libKoreanConverter.dylib 0x7fff3226d000 - 0x7fff326edff2 com.apple.CoreFoundation (6.9 - 1677.207) <80681FA0-C758-301F-8FB6-F23FFADD5481> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x7fff68f2b000 - 0x7fff68f2dff7 libDiagnosticMessagesClient.dylib (112) /usr/lib/libDiagnosticMessagesClient.dylib 0x7fff69401000 - 0x7fff69402fff libSystem.B.dylib (1281.100.1) <2564569B-F0A8-3C30-A9FC-1F634F02A886> /usr/lib/libSystem.B.dylib 0x7fff6977d000 - 0x7fff697cffff libc++.1.dylib (902.1) <59A8239F-C28A-3B59-B8FA-11340DC85EDC> /usr/lib/libc++.1.dylib 0x7fff697d0000 - 0x7fff697e5ffb libc++abi.dylib (902) /usr/lib/libc++abi.dylib 0x7fff6a250000 - 0x7fff6a252fff libfakelink.dylib (149.1) <36146CB2-E6A5-37BB-9EE8-1B4034D8F3AD> /usr/lib/libfakelink.dylib 0x7fff6a362000 - 0x7fff6a5b9fff libicucore.A.dylib (64260.0.1) <8AC2CB07-E7E0-340D-A849-186FA1F27251> /usr/lib/libicucore.A.dylib 0x7fff6b2f8000 - 0x7fff6b32afde libobjc.A.dylib (787.1) <265783CE-6D74-36C9-B6D2-95D3910199EC> /usr/lib/libobjc.A.dylib 0x7fff6b9cb000 - 0x7fff6b9ddff3 libz.1.dylib (76) <793D9643-CD83-3AAC-8B96-88D548FAB620> /usr/lib/libz.1.dylib 0x7fff6c28c000 - 0x7fff6c291ff3 libcache.dylib (83) /usr/lib/system/libcache.dylib 0x7fff6c292000 - 0x7fff6c29dfff libcommonCrypto.dylib (60165.120.1) /usr/lib/system/libcommonCrypto.dylib 0x7fff6c29e000 - 0x7fff6c2a5fff libcompiler_rt.dylib (101.2) <49B8F644-5705-3F16-BBE0-6FFF9B17C36E> /usr/lib/system/libcompiler_rt.dylib 0x7fff6c2a6000 - 0x7fff6c2afff7 libcopyfile.dylib (166.40.1) <3C481225-21E7-370A-A30E-0CCFDD64A92C> /usr/lib/system/libcopyfile.dylib 0x7fff6c2b0000 - 0x7fff6c342fdb libcorecrypto.dylib (866.140.2) /usr/lib/system/libcorecrypto.dylib 0x7fff6c44f000 - 0x7fff6c48fff0 libdispatch.dylib (1173.100.2) /usr/lib/system/libdispatch.dylib 0x7fff6c490000 - 0x7fff6c4c6fff libdyld.dylib (750.6) <789A18C2-8AC7-3C88-813D-CD674376585D> /usr/lib/system/libdyld.dylib 0x7fff6c4c7000 - 0x7fff6c4c7ffb libkeymgr.dylib (30) /usr/lib/system/libkeymgr.dylib 0x7fff6c4d5000 - 0x7fff6c4d5ff7 liblaunch.dylib (1738.140.3) /usr/lib/system/liblaunch.dylib 0x7fff6c4d6000 - 0x7fff6c4dbff7 libmacho.dylib (959.0.1) /usr/lib/system/libmacho.dylib 0x7fff6c4dc000 - 0x7fff6c4deff3 libquarantine.dylib (110.40.3) /usr/lib/system/libquarantine.dylib 0x7fff6c4df000 - 0x7fff6c4e0ff7 libremovefile.dylib (48) <7C7EFC79-BD24-33EF-B073-06AED234593E> /usr/lib/system/libremovefile.dylib 0x7fff6c4e1000 - 0x7fff6c4f8ff3 libsystem_asl.dylib (377.60.2) <1563EE02-0657-3B78-99BE-A947C24122EF> /usr/lib/system/libsystem_asl.dylib 0x7fff6c4f9000 - 0x7fff6c4f9ff7 libsystem_blocks.dylib (74) <0D53847E-AF5F-3ACF-B51F-A15DEA4DEC58> /usr/lib/system/libsystem_blocks.dylib 0x7fff6c4fa000 - 0x7fff6c581fff libsystem_c.dylib (1353.100.2) /usr/lib/system/libsystem_c.dylib 0x7fff6c582000 - 0x7fff6c585ffb libsystem_configuration.dylib (1061.141.1) <0EE84C33-64FD-372B-974A-AF7A136F2068> /usr/lib/system/libsystem_configuration.dylib 0x7fff6c586000 - 0x7fff6c589fff libsystem_coreservices.dylib (114.1) <72857ADA-AA97-398B-B089-F50B2E89064B> /usr/lib/system/libsystem_coreservices.dylib 0x7fff6c58a000 - 0x7fff6c592fff libsystem_darwin.dylib (1353.100.2) <5B12B5DB-3F30-37C1-8ECC-49A66B1F2864> /usr/lib/system/libsystem_darwin.dylib 0x7fff6c593000 - 0x7fff6c59afff libsystem_dnssd.dylib (1096.100.3) /usr/lib/system/libsystem_dnssd.dylib 0x7fff6c59b000 - 0x7fff6c59cffb libsystem_featureflags.dylib (17) <29FD922A-EC2C-3F25-BCCC-B58D716E60EC> /usr/lib/system/libsystem_featureflags.dylib 0x7fff6c59d000 - 0x7fff6c5eaff7 libsystem_info.dylib (538) <8A321605-5480-330B-AF9E-64E65DE61747> /usr/lib/system/libsystem_info.dylib 0x7fff6c5eb000 - 0x7fff6c617ff7 libsystem_kernel.dylib (6153.141.33) <174BBB20-B300-385A-A443-B1A4DD65748C> /usr/lib/system/libsystem_kernel.dylib 0x7fff6c618000 - 0x7fff6c663fef libsystem_m.dylib (3178) /usr/lib/system/libsystem_m.dylib 0x7fff6c664000 - 0x7fff6c68bfff libsystem_malloc.dylib (283.100.6) <8549294E-4C53-36EB-99F3-584A7393D8D5> /usr/lib/system/libsystem_malloc.dylib 0x7fff6c68c000 - 0x7fff6c699ffb libsystem_networkextension.dylib (1095.140.2) /usr/lib/system/libsystem_networkextension.dylib 0x7fff6c69a000 - 0x7fff6c6a3ff7 libsystem_notify.dylib (241.100.2) /usr/lib/system/libsystem_notify.dylib 0x7fff6c6a4000 - 0x7fff6c6acfef libsystem_platform.dylib (220.100.1) <009A7C1F-313A-318E-B9F2-30F4C06FEA5C> /usr/lib/system/libsystem_platform.dylib 0x7fff6c6ad000 - 0x7fff6c6b7fff libsystem_pthread.dylib (416.100.3) <62CB1A98-0B8F-31E7-A02B-A1139927F61D> /usr/lib/system/libsystem_pthread.dylib 0x7fff6c6b8000 - 0x7fff6c6bcff3 libsystem_sandbox.dylib (1217.141.2) <051C4018-4345-3034-AC98-6DE42FB8273B> /usr/lib/system/libsystem_sandbox.dylib 0x7fff6c6bd000 - 0x7fff6c6bffff libsystem_secinit.dylib (62.100.2) /usr/lib/system/libsystem_secinit.dylib 0x7fff6c6c0000 - 0x7fff6c6c7ffb libsystem_symptoms.dylib (1238.120.2) <702D0910-5C34-3D43-9631-8BD215DE4FE1> /usr/lib/system/libsystem_symptoms.dylib 0x7fff6c6c8000 - 0x7fff6c6deff2 libsystem_trace.dylib (1147.120.1) /usr/lib/system/libsystem_trace.dylib 0x7fff6c6e0000 - 0x7fff6c6e5ff7 libunwind.dylib (35.4) <42B7B509-BAFE-365B-893A-72414C92F5BF> /usr/lib/system/libunwind.dylib 0x7fff6c6e6000 - 0x7fff6c71bffe libxpc.dylib (1738.140.3) <8DA7D88F-AE2F-3BCF-8426-8D041E57A9AA> /usr/lib/system/libxpc.dylib

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

VM Region Summary: ReadOnly portion of Libraries: Total=403.3M resident=0K(0%) swapped_out_or_unallocated=403.3M(100%) Writable regions: Total=26.4M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=26.4M(100%)

                            VIRTUAL   REGION 

REGION TYPE SIZE COUNT (non-coalesced) =========== ======= ======= Kernel Alloc Once 8K 1 MALLOC 10.0M 8 MALLOC guard page 16K 4 STACK GUARD 4K 1 Stack 16.0M 1 DATA 2426K 50 DATA_CONST 20K 1 LINKEDIT 389.1M 6 OBJC_RO 32.3M 1 __OBJC_RW 1908K 2 TEXT 14.2M 47 UNICODE 564K 1 shared memory 8K 2 =========== ======= ======= TOTAL 466.5M 125

Model: MacBookAir5,1, BootROM 421.0.0.0.0, 2 processors, Dual-Core Intel Core i7, 2 GHz, 8 GB, SMC 2.4f19 Graphics: kHW_IntelHD4000Item, Intel HD Graphics 4000, spdisplays_builtin Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D5434353153364D465238412D50422020 Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D5434353153364D465238412D50422020 AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xE9), Broadcom BCM43xx 1.0 (7.21.190.33 AirPortDriverBrcm4360-1601.1) Bluetooth: Version 7.0.6f8, 3 services, 27 devices, 1 incoming serial ports Network Service: Wi-Fi, AirPort, en0 Network Service: iPad, Ethernet, en3 Serial ATA Device: APPLE SSD TS128E, 121.33 GB USB Device: USB 2.0 Bus USB Device: Hub USB Device: Hub USB Device: Apple Internal Keyboard / Trackpad USB Device: BRCM20702 Hub USB Device: Bluetooth USB Host Controller USB Device: USB 2.0 Bus USB Device: Hub USB Device: FaceTime HD Camera (Built-in) USB Device: USB 3.0 Bus USB Device: iPad Thunderbolt Bus: MacBook Air, Apple Inc., 23.4

culler commented 3 years ago

Thank you for the report. The traceback indicates that python is crashing when it attempts to decode its command line arguments into a wide character string. There should only be one argument, which is the path name of the main executable in the app. So I am guessing that when the locale is set to Korea, that path is being translated into Korean and perhaps encoded with an encoding other than the UTF-8 encoding which Python is expecting.

When you use the Finder does it show the /Applications folder with a Korean name?

Please try running /Applications/SageMath-9-3.app/Contents/MacOS/SageMath in your Terminal, using both a Korean keyboard and a US keyboard. What happens? Also please try running /usr/local/bin/sage in your Terminal, using both keyboards.

culler commented 3 years ago

The Sage python3 spkg defines the constant _PyFORCE_UTF8_LOCALE. Here it is in pyconfig.h:

#if defined(_Py_FORCE_UTF8_LOCALE) || defined(__APPLE__) /* Use UTF-8 as filesystem encoding */ #define _Py_FORCE_UTF8_FS_ENCODING #endif

When that constant is defined Py_DecodeLocale passes the strings in argv to _Py_DecodeUTF8Ex, which is where the crash occurs. So this means that Python is assuming that all command line arguments are UTF-8 encoded, but that assumption is apparently invalid when the SageMath-9-3 app is launched on a system with a Korean locale.

I am guessing that the UTF-8 assumption is valid when python is started by a shell. But when an app is launched by the macOS launchd, the argv array is constructed by launchd, not by the shell, and the launchd may be doing something different that depends on the locale.

culler commented 3 years ago

I attempted to reproduce this crash by creating a new user on my macbook air with region set to South Korea, language to Korean and imput method to 2-Set Korean. However, that user was able to launch the SageMath-9-3 app. There was no crash with either user interface.

NathanDunfield commented 3 years ago

There was no crash with either user interface.

One possibility is that the crash only happens when some path (perhaps from the user name) contains Korean characters (as we saw with SnapPy and the Japanese version of Windows at one point). That said, UTF-8 can encode Korean just fine and indeed this seems to be the default way to do so these days. There are two distinct ways to do so though, as precomposed blocks or individual jamos.

culler commented 3 years ago

One thing that puzzles me is that the crash occurs when Python is processing its argv array. That array should contain only one string, which should be the path to the main executable of the app. The app was installed in /Applications, so I am having a hard time imagining how decoding its path could lead to a crash. It is possible that the crash has nothing to do with Py_DecodeUTF8Ex (which seems unlikely to contain an illegal instruction). Perhaps that just happened to be the function that was executing when the gatekeeper killed the app for some signature-related reason. Apple seems to use the SIGILL signal in lots of situations which do not involve any illegal instructions. (Or maybe they reason that any instruction is illegal when executed by an app that they want to kill.)

It would be nice to know if the md5 hash of the diskimage is correct. Byeongsu, would it be possible for you to run the command below and verify that you get the same result?

% md5 SageMath-9.3.dmg MD5 (SageMath-9.3.dmg) = 21932db5a4a35edd87b803829464db15

byeongsuyu commented 3 years ago

Thank you very much for your rapid attention. To avoid locale issue, I just changed my Language as English, and change my user name with English name, and delete SageMath-9-3.app and install it again. However, I've still got the similar error.

Process: python3.9 [1051] Path: /Applications/SageMath-9-3.app/Contents/MacOS/SageMath Identifier: org.computop.SageMath Version: ??? Code Type: X86-64 (Native) Parent Process: ??? [1] Responsible: python3.9 [1051] User ID: 501

Date/Time: 2021-07-02 15:33:05.504 -0500 OS Version: Mac OS X 10.15.7 (19H1217) Report Version: 12 Anonymous UUID: 2691FC16-3F4F-4A28-BABE-30A65002BF16

Time Awake Since Boot: 600 seconds

System Integrity Protection: enabled

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 [1051]

Application Specific Information: dyld2 mode

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread 0 libpython3.9.dylib 0x000000010850432c 0x108441000 + 799532 1 libpython3.9.dylib 0x000000010850416e _Py_DecodeUTF8Ex + 254 2 libpython3.9.dylib 0x00000001085ccfb1 Py_DecodeLocale + 49 3 libpython3.9.dylib 0x00000001085ad1f0 _PyArgv_AsWstrList + 96 4 libpython3.9.dylib 0x00000001085add5c 0x108441000 + 1494364 5 libpython3.9.dylib 0x00000001085af0c7 _Py_PreInitializeFromPyArgv + 295 6 libpython3.9.dylib 0x00000001085d18ec 0x108441000 + 1640684 7 libpython3.9.dylib 0x00000001085d1a3b Py_BytesMain + 43 8 libdyld.dylib 0x00007fff70210cc9 start + 1

Thread 0 crashed with X86 Thread State (64-bit): rax: 0x0000000000000000 rbx: 0x000000000000002f rcx: 0x00007ffee77d0588 rdx: 0x00007fe1f6d041b0 rdi: 0x00007ffee77d0580 rsi: 0x00007ffee77d0c96 rbp: 0x00007ffee77d0550 rsp: 0x00007ffee77d0528 r8: 0x00007fe1f6d041b0 r9: 0x00007ffee77d0c28 r10: 0x00007ffee77d0c90 r11: 0x8080808080808080 r12: 0x0000000000000000 r13: 0x000000000000002f r14: 0x6163696c7070412f r15: 0x00007fe1f6d041b0 rip: 0x000000010850432c rfl: 0x0000000000010246 cr2: 0x000000010865b5a0

Logical CPU: 0 Error Code: 0x00000000 Trap Number: 6

Binary Images: 0x10842f000 - 0x108432ff3 +SageMath (0) <353C3350-2970-3C72-A885-219F979F24F4> /Applications/SageMath-9-3.app/Contents/Frameworks/Sage.framework/Versions/9.3/local/bin/python3.9 0x108441000 - 0x1086b8fef +libpython3.9.dylib (0) <86451832-18F4-37B4-B6F5-FDA94047BF08> /Applications/SageMath-9-3.app/Contents/Frameworks/Sage.framework/Versions/9.3/local/lib/libpython3.9.dylib 0x10e168000 - 0x10e1f9f47 dyld (750.6) /usr/lib/dyld 0x7fff35fd3000 - 0x7fff36453ff2 com.apple.CoreFoundation (6.9 - 1677.207) <80681FA0-C758-301F-8FB6-F23FFADD5481> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation 0x7fff6cc91000 - 0x7fff6cc93ff7 libDiagnosticMessagesClient.dylib (112) /usr/lib/libDiagnosticMessagesClient.dylib 0x7fff6d167000 - 0x7fff6d168fff libSystem.B.dylib (1281.100.1) <2564569B-F0A8-3C30-A9FC-1F634F02A886> /usr/lib/libSystem.B.dylib 0x7fff6d4e3000 - 0x7fff6d535fff libc++.1.dylib (902.1) <59A8239F-C28A-3B59-B8FA-11340DC85EDC> /usr/lib/libc++.1.dylib 0x7fff6d536000 - 0x7fff6d54bffb libc++abi.dylib (902) /usr/lib/libc++abi.dylib 0x7fff6dfb6000 - 0x7fff6dfb8fff libfakelink.dylib (149.1) <36146CB2-E6A5-37BB-9EE8-1B4034D8F3AD> /usr/lib/libfakelink.dylib 0x7fff6e0c8000 - 0x7fff6e31ffff libicucore.A.dylib (64260.0.1) <8AC2CB07-E7E0-340D-A849-186FA1F27251> /usr/lib/libicucore.A.dylib 0x7fff6f05e000 - 0x7fff6f090fde libobjc.A.dylib (787.1) <265783CE-6D74-36C9-B6D2-95D3910199EC> /usr/lib/libobjc.A.dylib 0x7fff6f731000 - 0x7fff6f743ff3 libz.1.dylib (76) <793D9643-CD83-3AAC-8B96-88D548FAB620> /usr/lib/libz.1.dylib 0x7fff6fff2000 - 0x7fff6fff7ff3 libcache.dylib (83) /usr/lib/system/libcache.dylib 0x7fff6fff8000 - 0x7fff70003fff libcommonCrypto.dylib (60165.120.1) /usr/lib/system/libcommonCrypto.dylib 0x7fff70004000 - 0x7fff7000bfff libcompiler_rt.dylib (101.2) <49B8F644-5705-3F16-BBE0-6FFF9B17C36E> /usr/lib/system/libcompiler_rt.dylib 0x7fff7000c000 - 0x7fff70015ff7 libcopyfile.dylib (166.40.1) <3C481225-21E7-370A-A30E-0CCFDD64A92C> /usr/lib/system/libcopyfile.dylib 0x7fff70016000 - 0x7fff700a8fdb libcorecrypto.dylib (866.140.2) /usr/lib/system/libcorecrypto.dylib 0x7fff701b5000 - 0x7fff701f5ff0 libdispatch.dylib (1173.100.2) /usr/lib/system/libdispatch.dylib 0x7fff701f6000 - 0x7fff7022cfff libdyld.dylib (750.6) <789A18C2-8AC7-3C88-813D-CD674376585D> /usr/lib/system/libdyld.dylib 0x7fff7022d000 - 0x7fff7022dffb libkeymgr.dylib (30) /usr/lib/system/libkeymgr.dylib 0x7fff7023b000 - 0x7fff7023bff7 liblaunch.dylib (1738.140.3) /usr/lib/system/liblaunch.dylib 0x7fff7023c000 - 0x7fff70241ff7 libmacho.dylib (959.0.1) /usr/lib/system/libmacho.dylib 0x7fff70242000 - 0x7fff70244ff3 libquarantine.dylib (110.40.3) /usr/lib/system/libquarantine.dylib 0x7fff70245000 - 0x7fff70246ff7 libremovefile.dylib (48) <7C7EFC79-BD24-33EF-B073-06AED234593E> /usr/lib/system/libremovefile.dylib 0x7fff70247000 - 0x7fff7025eff3 libsystem_asl.dylib (377.60.2) <1563EE02-0657-3B78-99BE-A947C24122EF> /usr/lib/system/libsystem_asl.dylib 0x7fff7025f000 - 0x7fff7025fff7 libsystem_blocks.dylib (74) <0D53847E-AF5F-3ACF-B51F-A15DEA4DEC58> /usr/lib/system/libsystem_blocks.dylib 0x7fff70260000 - 0x7fff702e7fff libsystem_c.dylib (1353.100.2) /usr/lib/system/libsystem_c.dylib 0x7fff702e8000 - 0x7fff702ebffb libsystem_configuration.dylib (1061.141.1) <0EE84C33-64FD-372B-974A-AF7A136F2068> /usr/lib/system/libsystem_configuration.dylib 0x7fff702ec000 - 0x7fff702effff libsystem_coreservices.dylib (114.1) <72857ADA-AA97-398B-B089-F50B2E89064B> /usr/lib/system/libsystem_coreservices.dylib 0x7fff702f0000 - 0x7fff702f8fff libsystem_darwin.dylib (1353.100.2) <5B12B5DB-3F30-37C1-8ECC-49A66B1F2864> /usr/lib/system/libsystem_darwin.dylib 0x7fff702f9000 - 0x7fff70300fff libsystem_dnssd.dylib (1096.100.3) /usr/lib/system/libsystem_dnssd.dylib 0x7fff70301000 - 0x7fff70302ffb libsystem_featureflags.dylib (17) <29FD922A-EC2C-3F25-BCCC-B58D716E60EC> /usr/lib/system/libsystem_featureflags.dylib 0x7fff70303000 - 0x7fff70350ff7 libsystem_info.dylib (538) <8A321605-5480-330B-AF9E-64E65DE61747> /usr/lib/system/libsystem_info.dylib 0x7fff70351000 - 0x7fff7037dff7 libsystem_kernel.dylib (6153.141.33) <174BBB20-B300-385A-A443-B1A4DD65748C> /usr/lib/system/libsystem_kernel.dylib 0x7fff7037e000 - 0x7fff703c9fef libsystem_m.dylib (3178) /usr/lib/system/libsystem_m.dylib 0x7fff703ca000 - 0x7fff703f1fff libsystem_malloc.dylib (283.100.6) <8549294E-4C53-36EB-99F3-584A7393D8D5> /usr/lib/system/libsystem_malloc.dylib 0x7fff703f2000 - 0x7fff703ffffb libsystem_networkextension.dylib (1095.140.2) /usr/lib/system/libsystem_networkextension.dylib 0x7fff70400000 - 0x7fff70409ff7 libsystem_notify.dylib (241.100.2) /usr/lib/system/libsystem_notify.dylib 0x7fff7040a000 - 0x7fff70412fef libsystem_platform.dylib (220.100.1) <009A7C1F-313A-318E-B9F2-30F4C06FEA5C> /usr/lib/system/libsystem_platform.dylib 0x7fff70413000 - 0x7fff7041dfff libsystem_pthread.dylib (416.100.3) <62CB1A98-0B8F-31E7-A02B-A1139927F61D> /usr/lib/system/libsystem_pthread.dylib 0x7fff7041e000 - 0x7fff70422ff3 libsystem_sandbox.dylib (1217.141.2) <051C4018-4345-3034-AC98-6DE42FB8273B> /usr/lib/system/libsystem_sandbox.dylib 0x7fff70423000 - 0x7fff70425fff libsystem_secinit.dylib (62.100.2) /usr/lib/system/libsystem_secinit.dylib 0x7fff70426000 - 0x7fff7042dffb libsystem_symptoms.dylib (1238.120.2) <702D0910-5C34-3D43-9631-8BD215DE4FE1> /usr/lib/system/libsystem_symptoms.dylib 0x7fff7042e000 - 0x7fff70444ff2 libsystem_trace.dylib (1147.120.1) /usr/lib/system/libsystem_trace.dylib 0x7fff70446000 - 0x7fff7044bff7 libunwind.dylib (35.4) <42B7B509-BAFE-365B-893A-72414C92F5BF> /usr/lib/system/libunwind.dylib 0x7fff7044c000 - 0x7fff70481ffe libxpc.dylib (1738.140.3) <8DA7D88F-AE2F-3BCF-8426-8D041E57A9AA> /usr/lib/system/libxpc.dylib

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

VM Region Summary: ReadOnly portion of Libraries: Total=403.2M resident=0K(0%) swapped_out_or_unallocated=403.2M(100%) Writable regions: Total=26.4M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=26.4M(100%)

                            VIRTUAL   REGION 

REGION TYPE SIZE COUNT (non-coalesced) =========== ======= ======= Kernel Alloc Once 8K 1 MALLOC 10.0M 8 MALLOC guard page 16K 4 STACK GUARD 4K 1 Stack 16.0M 1 DATA 2424K 47 DATA_CONST 20K 1 LINKEDIT 389.1M 6 OBJC_RO 32.3M 1 __OBJC_RW 1908K 2 TEXT 14.1M 46 UNICODE 564K 1 shared memory 8K 2 =========== ======= ======= TOTAL 466.3M 121

Model: MacBookAir5,1, BootROM 421.0.0.0.0, 2 processors, Dual-Core Intel Core i7, 2 GHz, 8 GB, SMC 2.4f19 Graphics: kHW_IntelHD4000Item, Intel HD Graphics 4000, spdisplays_builtin Memory Module: BANK 0/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D5434353153364D465238412D50422020 Memory Module: BANK 1/DIMM0, 4 GB, DDR3, 1600 MHz, 0x80AD, 0x484D5434353153364D465238412D50422020 AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0xE9), Broadcom BCM43xx 1.0 (7.21.190.33 AirPortDriverBrcm4360-1601.1) Bluetooth: Version 7.0.6f8, 3 services, 27 devices, 1 incoming serial ports Network Service: Wi-Fi, AirPort, en0 Network Service: iPhone, Ethernet, en3 Serial ATA Device: APPLE SSD TS128E, 121.33 GB USB Device: USB 3.0 Bus USB Device: BUP Portable USB Device: iPhone USB Device: USB 2.0 Bus USB Device: Hub USB Device: Hub USB Device: Apple Internal Keyboard / Trackpad USB Device: BRCM20702 Hub USB Device: Bluetooth USB Host Controller USB Device: USB 2.0 Bus USB Device: Hub USB Device: FaceTime HD Camera (Built-in) Thunderbolt Bus: MacBook Air, Apple Inc., 23.4

byeongsuyu commented 3 years ago

One thing that puzzles me is that the crash occurs when Python is processing its argv array. That array should contain only one string, which should be the path to the main executable of the app. The app was installed in /Applications, so I am having a hard time imagining how decoding its path could lead to a crash. It is possible that the crash has nothing to do with Py_DecodeUTF8Ex (which seems unlikely to contain an illegal instruction). Perhaps that just happened to be the function that was executing when the gatekeeper killed the app for some signature-related reason. Apple seems to use the SIGILL signal in lots of situations which do not involve any illegal instructions. (Or maybe they reason that any instruction is illegal when executed by an app that they want to kill.)

It would be nice to know if the md5 hash of the diskimage is correct. Byeongsu, would it be possible for you to run the command below and verify that you get the same result?

% md5 SageMath-9.3.dmg MD5 (SageMath-9.3.dmg) = 21932db5a4a35edd87b803829464db15

Yes, I've got the same MD5 as below

byeongsuyu@yubyeongsuui-MacBook-Air Downloads % md5 SageMath-9.3.dmg MD5 (SageMath-9.3.dmg) = 21932db5a4a35edd87b803829464db15

culler commented 3 years ago

Thanks for helping us find out what is causing this crash. I think we can rule out the locale issue and also the possibility of a corrupted disk image. So I guess the next thing to do would be for you to open Terminal.app and run the command: sage and report what happens. It would also be helpful if you could try running the commands: sage -python and /Applications/SageMath-9-3.app/Contents/MacOS/SageMath Thanks!

culler commented 3 years ago

One more thing. It is important to drag the application to the trash and empty the trash rather than using a shell command like rm. The operating system updates its database of installed applications when an app is moved to the trash.

byeongsuyu commented 3 years ago

Thank you very much for your guidance. When I deleted, I used trash and empty the trash instead of rm. However, to avoid possible database update issues, I just roll-back my system (using TimeMachine) to the time when I didn't have SageMath, then re-install SageMath. Still, the error I reported above happens, and here is the result of errors I've got.

byeongsuyu@yubyeongsuui-MacBook-Air share % sage /usr/local/bin/sage: line 20: 797 Illegal instruction: 4 $SYMLINK/local/bin/sage $@ byeongsuyu@yubyeongsuui-MacBook-Air share % sage -python /usr/local/bin/sage: line 20: 903 Illegal instruction: 4 $SYMLINK/local/bin/sage $@ byeongsuyu@yubyeongsuui-MacBook-Air share % /Applications/SageMath-9-3.app/Contents/MacOS/SageMath zsh: illegal hardware instruction /Applications/SageMath-9-3.app/Contents/MacOS/SageMath

Again, thank you very much for your concern.

culler commented 3 years ago

I have a macbook air with two disk partitions, one of which has Catalina on it. I upgraded the Catalina to 10.15.7 so I could test on the exact same hardware and OS version as you are using. I see no crash. (Interestingly, when installing the update I got messages reporting the time remaining in Korean. But at the end of the update they switched to English. This happened in spite of the fact that my test user with the Korean locale had been created on the Big Sur system, not the Catalina system, and subsequently deleted.)

At this point I am assuming that the app is being killed by Apple's system security policy daemon. Here are some things to try to find out why this might be happening.

Please run this command and report the result: spctl --assess -t execute -vvvv /Applications/SageMath-9-3.app

Then run this command and see if the app will start afterwards: sudo spctl --disable-master

After testing you should re-enable the policy daemon by running:: sudo spctl --enable-master

If the app starts when the policy daemon is disabled, you might consider resetting the policy database to its default state by running the command: sudo spctl --reset-default and then rebooting the system. I am not sure what all of the side effects of doing that will be, but I do know that you will have to agree again to run apps which were not purchased from the app store.

NathanDunfield commented 3 years ago

Looking at the detailed info provided, this particular MacBook Air came out in 2012 and has an i7-3667U processor which was the third generation (Ivy Bridge) of the Intel Core processors. Which means it doesn't support the AVX2 processor instructions introduced in the fourth generation (Haswell). So possibly this is an actual illegal hardware instruction? Though I would not expect sage -python to invoke any AVX2 instructions. The FMA instructions were also introduced in the fourth generation.

culler commented 3 years ago

Wow. I am sure you are right. The app really does contain an illegal instruction for this computer. It sounds like we don't support macbook air computers build before July 2013.

I don't know of any way to build Sage for Ivy Bridge processors other than by building it on a machine which has one.

NathanDunfield commented 3 years ago

I have one of those cylindrical MacPros (circa 2014) with an Ivy Bridge processor, but it's currently inaccessible. It also runs 10.12 which is too old for the current SageMath app. I think the folks who build Sage for Conda have been able to suppress such pesky instructions see https://github.com/conda-forge/sage-feedstock/issues/57

culler commented 3 years ago

I disassembled libpython3.9.dylib and found many instances of vmovapd, which is an AVX instruction. Many of them reference addresses relative to dyld_stub_binder. So maybe clang uses AVX instructions to speed up dynamic linking, which would mean that they are ubiquitous.

culler commented 3 years ago

The crash occurs at offset 799532 = 0xc332c in libpython3.9. In the disassembled library I find: c332c: c4 e2 7d 59 db vpbroadcastq %xmm3, %ymm3 The vpbroadcastq instruction is an AVX2 instruction. So, I guess that settles this question.

The next question is what to do about it. Do we want to try to compile sage for old CPUs? Or make two versions of the app? Presumably the first option would make Sage slower. And I have no idea whether the linear algebra libraries would be able to handle that.

It appears that clang has an option -mno-avx2 which could presumably be added to CFLAGS.

NathanDunfield commented 3 years ago

The more sophisticated numerics libraries include code for all different processors and enable the most modern possible version at runtime rather than compile time. So those don't actually take a performance hit as I understand it, though other code might.

I suggest @byeongsuyu try installing via Conda, which I believe is compiled to maximize the number of machines it works on. At least on Linux, I regularly use the Conda version with processors this old (or possibly even older) on a campus cluster.

byeongsuyu commented 3 years ago

Thank you very much @culler and @NathanDunfield for your advice. Now I just compiled Sage 9.3. from the source and it works.

culler commented 3 years ago

Thank you very much for your report! I will add a warning on the release page that the app requires at least a Haswell generation Intel CPU. I am glad that you were able to successfully compile sage on your laptop. That is probably the best solution in your case.