Since we updated 3D Slicer to use ITK5, we got multiple error reports on Windows and Linux that the application crashes at startup in GDCM due to illegal instruction.
- Displayed to user in popup
The application was unable to start correctly (0xc0000142). Click OK to close the application.
- With debugger: exception 0xc000001d (Illegal instruction) in ITKIOGDCM-5.1.dll
- Displayed to the user:
error: [/home/user/programs/Slicer-4.11.0-2019-08-22-linuxamd64/bin/SlicerApp-real] exit abnormally - Report the problem.
- With debugger:
[21639.829126] traps: SlicerApp-real trap invalid opcode ip:7f8aa07fa1c8 sp:7ffce616fca8 error:0 in libitkgdcmcharls-5.0.so.1[7f8aa07e4000+84000]
It seems that operations in GDCM (probably related to bitfield handling) generate
shlx instructions, which are part of BMI2 instruction set. These instructions are only supported in 4+ generation Intel CPUs. These are typically 6-8-year-old computers, so there are a good number of them still out there. See more details and discussion here.
Probably there is not much to do about this at ITK level, as build options are usually passed down from the application. I just posted this information here so that ITK users become aware of this issue and maybe save some debugging time.