-
Notifications
You must be signed in to change notification settings - Fork 228
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
Cannot run dcm2niix on Apple's M1 Max chip #658
Comments
This is an artificial limitation imposed by Apple, and is not specific to dcm2niix. Apple requires all native executables on an Apple Silicon CPU (M1/M2) to be code signed. These restrictions are not applied to emulated x86 code. Therefore, the issue is that dcm2niix does natively support Apple Silicon. One thing you can do is download and install the notarized stable release of dcm2niix. If you wish to compile any native code on your M1 you will have to codesign it yourself. Another strange peculiarity of M1 executables is that they will be quarantined if you overwrite an existing executable. Therefore, while the command line will not generate any errors, the following command will bork your executable:
and you must run
It is unfortunate that Apple has done such a poor job of documenting notarization, code signing and other security features. Tools will fail without any clear explanation to the user for the error. The arcane steps evolve over time. If you do wish to notarize macOS executables, I document the method used by dcm2niix. In general, Apple is very hostile to any development that does not use XCode, so while it is possible to create your own executables, it remains a dark art. While I appreciate Apple's attempts to protect users from Malware, the developer facing support for concepts like path randomization, sandboxing and notarization leave a lot to be desired. |
Thanks a lot for the info! I had a look at the crash report and I get:
Is is still related to the codesigning? Based on https://developer.apple.com/forums/thread/698167 I should see |
Is this an issue with an insanely long filename that is not supported by libc? Does the same problem persist if you convert the validation images? Since the error is with a base library, I do not think this is a core dcm2niix problem. However, you can always build dcm2niix in sanitize mode to debug any exceptions:
|
In case you know something about it or interested in it, here is the output that I got from running dcm2niix in the sanitize mode: `==16886==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x00016fc5a454 at pc 0x0001007609f4 bp 0x00016fc5a3c0 sp 0x00016fc59b48 Address 0x00016fc5a454 is located in stack of thread T0 at offset 52 in frame This frame has 2 object(s): I will try to get help from the Apple's support. Thanks for your efforts and time! |
I see, Apple is restricting the software from reading the ini file from the user's home directory as it is not in the applications sandbox. I presume that this is yet another security feature added by Apple. Why don't you see if this is fixed in the development version:
|
Fantastic! Works well now. Thanks a lot! Can I use this development version by simply building it from the source? |
Yes. the
I do think we are getting ready for a new stable release. @ningfei if you have a chance, it would be great to have your expert thoughts on issues 629 and 647. Those cmake questions are outside my expertise, but seem the last remaining unresolved issues. |
I have downloaded a version of dcm2niix for Mac OS X (macos_dcm2niix.pkg) and was able to successfully run it several times. However, after 5 or 7 tries it suddenly stopped working; I get the following in the terminal: "zsh: abort ./dcm2niix". I ran in the bash as well but this time I get: "Abort trap: 6". I've also built from the source but still get the same issue. Any ideas of why it suddenly stopped working? I have a Mac Studio with M1 Max chip which may be the cause of it.
EDIT: the program stopped working after I ran "dcm2niix -f DTIvol -g y DTI". Before I did not use -g flag. Could that have triggered some unexpected behaviour?
The text was updated successfully, but these errors were encountered: