Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Unity3D 5.6 iOS build always fails with: DirectoryNotFoundException UnsafeNativeMethods.h

Discussion in 'iOS and tvOS' started by JDMulti, Jul 6, 2017.

  1. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    I'm trying to build a Google Cardboard App for iOS. However it always fails as soon IL2CPP kicks in to convert everything to C++. I've tried all 5.6 versions and I can't find out why this error is being generated.

    The main error:

    DirectoryNotFoundException: Could not find a part of the path "D:\Software\Unity3D 5.6.2f1\Editor\Data\PlaybackEngines\iOSSupport\il2cpp\libil2cpp\include\icalls\mscorlib\System.Runtime.InteropServices.WindowsRuntime\UnsafeNativeMethods.h" or "D:\BACKUP\jdmulti\projects\Cardboard\unity3d\Unity3d project - iOS\Temp\StagingArea\Trampoline\Libraries\libil2cpp\include\icalls\mscorlib\System.Runtime.InteropServices.WindowsRuntime\UnsafeNativeMethods.h"
    System.IO.File.Copy (System.String sourceFileName, System.String destFileName, Boolean overwrite) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:124)
    UnityEditorInternal.FileMirroring.MirrorFile (System.String from, System.String to, System.Func`3 comparer) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/FileMirroring.cs:30)
    UnityEditorInternal.FileMirroring.MirrorFolder (System.String from, System.String to, System.Func`3 comparer) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/FileMirroring.cs:82)
    UnityEditorInternal.FileMirroring.MirrorFolder (System.String from, System.String to) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/FileMirroring.cs:35)
    UnityEditorInternal.FileMirroring.MirrorFolder (System.String from, System.String to, System.Func`3 comparer) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/FileMirroring.cs:78)
    UnityEditorInternal.FileMirroring.MirrorFolder (System.String from, System.String to) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/FileMirroring.cs:35)
    UnityEditorInternal.FileMirroring.MirrorFolder (System.String from, System.String to, System.Func`3 comparer) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/FileMirroring.cs:78)
    UnityEditorInternal.FileMirroring.MirrorFolder (System.String from, System.String to) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/FileMirroring.cs:35)
    UnityEditorInternal.FileMirroring.MirrorFolder (System.String from, System.String to, System.Func`3 comparer) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/FileMirroring.cs:78)
    UnityEditorInternal.FileMirroring.MirrorFolder (System.String from, System.String to) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/FileMirroring.cs:35)
    UnityEditorInternal.FileMirroring.MirrorFolder (System.String from, System.String to, System.Func`3 comparer) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/FileMirroring.cs:78)
    UnityEditor.iOS.PostProcessiPhonePlayer.UpdateInstallLocation (UnityEditor.iOS.ProjectPaths paths, BuildSettings bs, UnityEditor.iOS.IncludedFileList includedFiles) (at C:/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:1400)
    UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (BuildSettings bs, UnityEditor.iOS.ProjectPaths paths, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport buildReport) (at C:/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:702)
    UnityEditor.iOS.PostProcessiPhonePlayer.PostProcess (PostProcessorSettings postProcessorSettings, BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/BuildPostProcessor.cs:546)
    UnityEditor.iOS.iOSBuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/iPhonePlayer/Extensions/Common/ExtensionModule.cs:34)
    UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTargetGroup targetGroup, BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:186)
    UnityEditor.HostView:OnGUI()

    While building I also get another message spamming my console where bytes and at are different values.

    Allocation of 35 bytes at 064b02f0
    UnityEditor.HostView:OnGUI()

    Could someone shed a light on what is happening?
     
  2. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,773
    The IL2CPP error indicates that something might be wrong with the installation on the machine. Does the file "D:\Software\Unity3D 5.6.2f1\Editor\Data\PlaybackEngines\iOSSupport\il2cpp\libil2cpp\include\icalls\mscorlib\System.Runtime.InteropServices.WindowsRuntime\UnsafeNativeMethods.h" exist?
     
  3. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    I just checked and it does exists on that path.
     
  4. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,773
    Thanks! I should have asked as well, does "D:\BACKUP\jdmulti\projects\Cardboard\unity3d\Unity3d project - iOS\Temp\StagingArea\Trampoline\Libraries\libil2cpp\include\icalls\mscorlib\System.Runtime.InteropServices.WindowsRuntime\UnsafeNativeMethods.h" exist, and is it writable?

    The code in this case is trying to copy the headers needed by IL2CPP into the project directory so that Xcode can find them to build the generated C++ code.
     
  5. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    When checking the file properties is has 6 different things to enable the file for for which 2 are not select, (I translated because it's dutch, not sure if correctly translated:
    - Full acces
    - Special acces

    The onces wich are selected:
    - change
    - read and run
    - read
    - write

    So I guess it is writeable. However I noticed there are multiple admin options, like system, user and the windows profile and all have different accesabilities.
     
  6. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    I've changed the accessibility of all the accounts that have access to this file to full control, but it seems not to help anything.

    I also reinstalled Unity as administrator to see if that fixed the problem, but still I'm unable to build on my Windows 7 PC.

    At the moment I'm clueless on how to solve this. The worst is that I have to get the app build by tomorrow for a deadline.
     
    Last edited: Jul 6, 2017
  7. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,773
    Can you build an empty project with the same Unity installation?
     
  8. JDMulti

    JDMulti

    Joined:
    Jan 4, 2012
    Posts:
    384
    I think I found the issue, it had to do with a path that was too long or something. I've reduced the amount of directory levels and it seemed to be fixed somehow. Also an empty project works now as I tried that before and also didn't work.

    I had this same issue 2 years ago with building an Android app which also didn't build because of the same problem. However I forgot about it and didn't test that for the iOS build before.

    Anyway, thanks for taking a look at it, now I can finish this app by tomorrow.
     
    JoshPeterson likes this.
  9. m_asad_ali

    m_asad_ali

    Joined:
    Sep 14, 2017
    Posts:
    2
    Josh Peterson !!
    I'm facing the same issue but when I build empty project it work perfectly.
    Any help would be much appreciated
     
  10. JoshPeterson

    JoshPeterson

    Unity Technologies

    Joined:
    Jul 21, 2014
    Posts:
    6,773
    Do you happen to have a path which is too long?
     
  11. DaniyarGilymov

    DaniyarGilymov

    Joined:
    Dec 26, 2017
    Posts:
    14
    I faced with the same problem, i tried to change my project's path to shorter and i worked for me
     
  12. Jon_Olive

    Jon_Olive

    Joined:
    Sep 26, 2017
    Posts:
    23
    I also had the same problem - and I can confirm that reducing the path length did the trick (I think I removed two levels of nesting).
     
  13. calavasktipmedia

    calavasktipmedia

    Joined:
    Oct 11, 2021
    Posts:
    1
    I know its years later but yeh. I changed the project folder name to something smaller and it fixed it!