Compile failure on Mac OSX M1 arm64

637 views
Skip to first unread message

John Murray

unread,
Feb 27, 2021, 12:26:04 PM2/27/21
to Orthanc Users
Has anyone successfully compiled the server on an M1 Laptop for an M1 laptop?

When I run the cmake command on an M1 laptop:

cmake -GXcode -DCMAKE_OSX_DEPLOYMENT_TARGET=10.9 -DSTATIC_BUILD=ON -DSTANDALONE_BUILD=ON -DALLOW_DOWNLOADS=ON ../OrthancServer

OR

cmake -GXcode -DCMAKE_OSX_DEPLOYMENT_TARGET=11.0 -DSTATIC_BUILD=ON -DSTANDALONE_BUILD=ON -DALLOW_DOWNLOADS=ON ../OrthancServer

I get an error that seems like Xcode is running a test for a webassembly target on an x86

Here is one of the errors that I get:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x c++ -target arm64-apple-macos10.9 -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -Wno-trigraphs -fpascal-strings -O0 -Wno-missing-field-initializers -Wno-missing-prototypes -Wno-return-type -Wno-non-virtual-dtor -Wno-overloaded-virtual -Wno-exit-time-destructors -Wno-missing-braces -Wparentheses -Wswitch -Wno-unused-function -Wno-unused-label -Wno-unused-parameter -Wno-unused-variable -Wunused-value -Wno-empty-body -Wno-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wno-constant-conversion -Wno-int-conversion -Wno-bool-conversion -Wno-enum-conversion -Wno-float-conversion -Wno-non-literal-null-conversion -Wno-objc-literal-conversion -Wno-shorten-64-to-32 -Wno-newline-eof -Wno-c++11-extensions -DCMAKE_INTDIR\=\"Release\" -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk -fstrict-aliasing -Wdeprecated-declarations -Winvalid-offsetof -Wno-sign-conversion -Wno-infinite-recursion -Wno-move -Wno-comma -Wno-block-capture-autoreleasing -Wno-strict-prototypes -Wno-range-loop-analysis -Wno-semicolon-before-method-body -I/Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/CMakeTmp/Arith/CMakeFiles/CMakeTmp/Release/include -I/Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/CMakeTmp/Arith/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Release/cmTC_1c6c0.build/DerivedSources-normal/arm64 -I/Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/CMakeTmp/Arith/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Release/cmTC_1c6c0.build/DerivedSources/arm64 -I/Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/CMakeTmp/Arith/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Release/cmTC_1c6c0.build/DerivedSources -F/Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/CMakeTmp/Arith/CMakeFiles/CMakeTmp/Release -I/Users/jmurray/code/orthanc/Build/dcmtk-3.6.6//config/include -I/Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/ofstd/include -I/Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/ofstd/libsrc -MMD -MT dependencies -MF /Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/CMakeTmp/Arith/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Release/cmTC_1c6c0.build/Objects-normal/arm64/arith.d --serialize-diagnostics /Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/CMakeTmp/Arith/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Release/cmTC_1c6c0.build/Objects-normal/arm64/arith.dia -c /Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/config/tests/arith.cc -o /Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/CMakeTmp/Arith/CMakeFiles/CMakeTmp/CMAKE_TRY_COMPILE.build/Release/cmTC_1c6c0.build/Objects-normal/arm64/arith.o

  In file included from
  /Users/jmurray/code/orthanc/Build/dcmtk-3.6.6/config/tests/arith.cc:45:

  In file included from
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/xmmintrin.h:13:


  
  /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include/mmintrin.h:33:5:
  error: use of undeclared identifier '__builtin_ia32_emms'; did you mean
  '__builtin_isless'?

      __builtin_ia32_emms();

Bryan Dearlove

unread,
Feb 27, 2021, 1:37:23 PM2/27/21
to Orthanc Users

I just downloaded the compiled one from Osimis and it works no problem. 

John Murray

unread,
Feb 27, 2021, 2:33:28 PM2/27/21
to Orthanc Users
Thank you, Bryan!  I tried to load the binary image, but I did not understand how the command file worked.  After about 10 overrides of non-Apple Store files, I got the binary version of the server to work.  Thank you!!!

I am curious to know if there is some special command to compile the code on an M1 or if it was cross-compiled from an x86 mac.

thank you!

john

Sébastien Jodogne

unread,
Feb 28, 2021, 4:37:31 AM2/28/21
to Orthanc Users
Hello,

This compilation error means that either DCMTK doesn't support M1 (unlikely), *or* that the following files must be adapted in the source code of Orthanc (more probable):

Similar compilation errors have been reported for other software, for instance:

Unfortunately, I don't have access to such an Apple computer, so I can't provide any fix by myself.

To answer the second part of your question, the Osimis binary package is built on a x86 MacMini from 2014. Full info:

$ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: OS X 10.9.5 (13F1911)
      Kernel Version: Darwin 13.4.0

Sébastien-

James Manners

unread,
Feb 28, 2021, 4:55:13 AM2/28/21
to Sébastien Jodogne, Orthanc Users
I have an M1 Mac so can help to troubleshoot. I did try to install dmctk using home brew a week or so back and it didn’t compile either. 

Are there any pointers you can give so I can look into it?

James

Binary Logo
James Manners • Director
Suite 3, Level 2, 10 Queens Road, Melbourne, Victoria 3004, Australia

On 28 Feb 2021, at 8:37 pm, Sébastien Jodogne <s.jo...@gmail.com> wrote:

Hello,
--
You received this message because you are subscribed to the Google Groups "Orthanc Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to orthanc-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orthanc-users/756f38e1-d654-4abd-b9bd-197054a0fe50n%40googlegroups.com.

Sébastien Jodogne

unread,
Feb 28, 2021, 8:17:46 AM2/28/21
to Orthanc Users
Hello James,

Thanks for your feedback! The first thing to try would indeed be to compile DCMTK 3.6.6 from source (using CMake) on M1 Mac, without even considering Orthanc.

If the compilation doesn't succeed, this should be reported to the DCMTK team:

Sébastien-

ja...@binary.com.au

unread,
Feb 28, 2021, 5:44:23 PM2/28/21
to Orthanc Users
Hi Sebastien, 

I had a quick look on the DCMTK Issue Tracker and this issue is open regarding compilation on a Mac M1 (ARM) chip https://support.dcmtk.org/redmine/issues/957

So it looks like there are issues with DCMTK compiling on an M1.

HTH

James

John Murray

unread,
Feb 28, 2021, 8:06:45 PM2/28/21
to ja...@binary.com.au, Orthanc Users
Thank you to all.  I am using the cross-compiled binary.  I appreciate the investigation. 

We can let this one go for now.

john

You received this message because you are subscribed to a topic in the Google Groups "Orthanc Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/orthanc-users/QDeNjKLcEBA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to orthanc-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/orthanc-users/e7bb3130-f9e6-42fb-bda9-59ec27fea33dn%40googlegroups.com.


--

Alain Mazy

unread,
Mar 28, 2022, 5:39:54 PM3/28/22
to Orthanc Users
Hi,

Here are 2 fixes which seems to solve the Apple M1 build issues:

At least, I've been able to produce a universal binary on an Intel Mac but I have not been able to run it on a M1 processor (because I don't have any :-) ).  Any feedback is welcome.

HTH

Alain.

Salim Kanoun

unread,
Mar 31, 2022, 5:20:32 AM3/31/22
to Orthanc Users
Just for information,
In case you need a M1 environement to code / test 

You can have a M1 instance for few hours in some cloud providers such as scaleway : https://www.scaleway.com/en/hello-m1

This way no need to pay for overpriced mac products ^^

Salim
Reply all
Reply to author
Forward
0 new messages