TUTORIAL: Compile DCMTK for Apple Silicon (M1)

Compilation and installation of DCMTK

Moderator: Moderator Team

Post Reply
Posts: 1
Joined: Mon, 2022-01-03, 16:08

TUTORIAL: Compile DCMTK for Apple Silicon (M1)

#1 Post by latinusveridas » Tue, 2022-01-04, 18:47

Hi everyone,
Please find below a quick tutorial to help you compile DCMTK for Apple Silicon.

Tested on Apple Macbook Air A2337

The compilation issues are coming from the SSE librairies, which are specific to x86 arch. Luckily, there is a lib "SSE2NEON" that works.

STEP 1, Download required data
git clone https://github.com/DCMTK/dcmtk
git clone https://github.com/DLTcollab/sse2neon

STEP 2, Download from Homebrew or compile "zlib"

STEP 3 Inject the SSE2Neon lib into the DCMTK source folder
go into the folder DCMTK >> config >> tests
Copy paste sse2neon.h to DCTMK >> config >> include >> dcmtk >> config (on the side of osconfig.h.in)

STEP 4 Shunt the controls
Open arith.cc in order to shunt some controls

Code: Select all

#ifdef __APPLE__
// For controlling floating point exceptions on OS X.
#include <xmmintrin.h>

Code: Select all

#ifdef __APPLE__
// For controlling floating point exceptions on OS X.
#include "../include/dcmtk/config/sse2neon.h"

comment line 348 by adding double slash at the beginning on the lines "//"

Code: Select all

comment line 390

Code: Select all


STEP 5: Fix libiconv ( including libcharset)
On XCode, Go to Build Settings and search for “Other Linker Flags”
add “-lcharset.1” and “-lliconv.2”
Explanation: The corresponding dylib libs are already included in Xcode Content Package, so you don’t have to “copy the libs (.a or .dylib) in the project files. We just have to indicate which libs we have to link.

ADDITIONAL STEP 6: If you have an error “No data dictionary loaded”
It’s an issue related to the absence of the dicom.dic file in the expected default location, which is normally
So just copy paste the dicom.dic from your downloaded folder to the folder mentioned above. Don’t be afraid to create the directory if not exist.


Marco Eichelberg
Posts: 1352
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany

Re: TUTORIAL: Compile DCMTK for Apple Silicon (M1)

#2 Post by Marco Eichelberg » Wed, 2022-08-17, 14:07

As a brief follow-up, the current development version of DCMTK available from our git repository compiles and runs on MacOS ARM "out of the box", without any modifications.
We have meanwhile integrated an M1 MacMini into our nightly build infrastructure to make sure it stays that way :wink:

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest