2 errors when trying to build Unity+MagicLeap plugin

I’m trying to create a native plugin that uses the Insight Toolkit in a Unity scene on a MagicLeap headset. I’ve built my library binaries with CMake and I’ve also used CMake to build a plugin that works inside the Unity Editor. My problem arises when I try to export to the Magicleap headset. I get the following two errors inside the unity console:

In file included from C:/Users/henry/Desktop/DrChang/ITKProjects/ITKCodeBackup/DRRPlugin.cpp:20:
In file included from C:/Users/henry/ITK/ITK-master/Modules/Remote/RTK/include\rtkJosephForwardProjectionImageFilter.h:22:
In file included from C:/Users/henry/ITK/ITKbin/Modules/Remote/RTK\rtkConfiguration.h:24:
In file included from C:/Users/henry/ITK/ITKbin/Modules/Core/Common\itkConfigure.h:22:
C:/Users/henry/ITK/ITKbin/Modules/Core/Common/itk_compiler_detection.h:158:6: error: Unsupported compiler
    error Unsupported compiler
     ^
In file included from C:/Users/henry/Desktop/DrChang/ITKProjects/ITKCodeBackup/DRRPlugin.cpp:20:
In file included from C:/Users/henry/ITK/ITK-master/Modules/Remote/RTK/include\rtkJosephForwardProjectionImageFilter.h:22:
In file included from C:/Users/henry/ITK/ITKbin/Modules/Remote/RTK\rtkConfiguration.h:25:
In file included from C:/Users/henry/ITK/ITK-master/Modules/Core/Common/include\itkIntTypes.h:21:
C:/Users/henry/ITK/ITK-master/Modules/Core/Common/include/itkMacro.h:45:10: fatal error: 'typeinfo' file not found
#include '<'typeinfo'>'

I looked at the cmake compiler list and found that it was trying to use aarch64-linux-android-clang++ for the CXX compiler and aarch64-linux-android-clang for the C compiler. Are these compilers not supported by ITK?
I believe that the second error stems from the first error. From what I’ve read here, it seems that at least the C compiler is not playing well with ITK. Also teh workaround does not work for me as I am US based and using US locale.

I guess that the problem here might be that itk_compiler_detection.h is generated for one compiler, and then another compiler tries to include it. In my case (Visual Studio) the key section which causes the error for you looks like this:

#  if ITK_COMPILER_IS_MSVC

#    include "compilers/ITK_COMPILER_INFO_MSVC_CXX.h"

#  else
#    error Unsupported compiler
#  endif

I guess this problem is more related to MagicLeap than ITK. Do they have a support forum of some kind, or other technical support channel? You are probably not the first person to encounter this.

Thanks for the quick reply Dženan, Yes MagicLeap has a support forum, however a lot of their staff was laid off due to COVID-19 so the reply time is abysmal. I was just seeing if there was anything to be done from the ITK end.

I also forgot to add that when I click configure generate I get this error:
CMake Error in CMakeLists.txt:
No known features for CXX compiler

“”

version .
I’m guessing this is related to itk_compiler_detection.h?

Probably. That code fragment is at lines 153-159 of itk_compiler_detection.h. What is there for you?

At line 153 - 159:
if ITK_COMPILER_IS_MSVC

include "compilers/ITK_COMPILER_INFO_MSVC_CXX.h"

else
error Unsupported compiler
endif

Would configuring and building with Unix Makefiles as my generator be better?
*I built the original ITK bin with Windows VS 2019

If you don’t have a Unix-compatible make installed, you would not be able to compile it. But what matters is the compiler, not the make tool. If you tried clang (preferably the same one as used in MagicLeap) it should resolve the problem.

This can occur when ITK and the application are built with a different compiler or toolchain – make sure that the same compiler and toolchain is used throughout your project.

Thank you both for the answers, I’m trying to rebuild ITK to use with “Unix Makefiles” because magic leap requires that I follow these steps for building libraries with CMake:

  1. Generate a Lumin-specific toolchain file.
mabu -t lumin --create-cmake-toolchain magicleap.toolchain.cmake 

This outputs a toolchain file that you use to modify your cmake v3.x build process.
2. Configure your CMake build using the Lumin-specific toolchain. Makefiles are required for cross building. The -G “Unix Makefiles” option is required for Windows.

cmake -DCMAKE_TOOLCHAIN_FILE=mlsdk.toolchain.cmake -G "Unix Makefiles" -other args 
  1. Build your library.

However when I try to make with “Unix Makefiles” ( I’m using MinGW) run into errors involving the module KWSys:

ITK-master/Modules/ThirdParty/KWSys/src/KWSys/Directory.cxx:118:23: error: aggregate ‘itksys::Directory::Load(const string&)::_wfinddata_t data’ has incomplete type and cannot be defined
struct _wfinddata_t data; // data of current file

When I go to definition of _wfinddata_t, I see it as defined in file C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\ucrt\corecrt_wio.h.

I don’t know whether your error is due to mucking with MinGW, tool-chain or missing Windows 10 kit.