MemoryInterop.ILPatcher on linux (for Unity)

Issue #46 resolved
Dongho Kang created an issue

Hi, thank you very much for awesome project.

As the latest Unity supports Linux (in my case Ubuntu 18.04 LTS), I’m trying to build Unity plugin in Linux.

My dotnet --info output is

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  18.04
 OS Platform: Linux
 RID:         ubuntu.18.04-x64
 Base Path:   /usr/share/dotnet/sdk/3.0.100/

Host (useful for support):
  Version: 3.0.0
  Commit:  95a0a61858

.NET Core SDKs installed:
  3.0.100 [/usr/share/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

After I dotnet build $PROJECT_NAME --framework $FRAMEWORK --configuration $CONFIG (in this case $FRAMEWORK is netstandard1.3 and $PROJECT_NAME is AssimpNet) I got

Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 18.68 ms for /home/donghok/Workspace/git/assimpnet/AssimpNet/AssimpNet.csproj.
  AssimpNet -> /home/donghok/Workspace/git/assimpnet/AssimpNet/bin/Release/netstandard1.3/AssimpNet.dll
        >> INFO: BEGIN patching assembly 'AssimpNet.dll'
        >> INFO: Symbols file found, will write out a new PDB file.
        >> INFO: Strong name key not found. Assembly will not be signed.
        >> INFO: Resolved AsssemblyReference 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
        >> INFO: Removing Type 'Assimp.MemoryInterop'
        >> INFO: DONE patching assembly 'AssimpNet.dll'

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.66

But as I want to dotnet msbuild -p:Configuration=Release -p:TargetFramework=netstandard1.3 for MemoryInterop.ILPatcher (in AssimpNet directory), I got

Microsoft (R) Build Engine version 16.3.0+0f4c62fea for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  AssimpNet -> /home/donghok/Workspace/git/assimpnet/AssimpNet/bin/Release/netstandard1.3/AssimpNet.dll
        >> INFO: BEGIN patching assembly 'AssimpNet.dll'
        >> INFO: Symbols file found, will write out a new PDB file.
        >> INFO: Strong name key not found. Assembly will not be signed.
        >> INFO: Resolved AsssemblyReference 'System.Runtime, Version=4.0.20.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
        >> INFO: Removing Type 'Assimp.MemoryInterop'
        >> INFO: DONE patching assembly 'AssimpNet.dll'

But still I got NotImplementationException from Unity:

System.NotImplementedException: The method or operation is not implemented.
  at Assimp.MemoryInterop.ReadInline[T] (System.Void* pSrc) [0x00000] in <d40f2b0ad6814d4c8094142d8473733f>:0 
  at Assimp.MemoryHelper.Read[T] (System.IntPtr pSrc, T& value) [0x00007] in <d40f2b0ad6814d4c8094142d8473733f>:0 
  at Assimp.MemoryHelper.FromNativePointer[Managed,Native] (System.IntPtr ptr) [0x00027] in <d40f2b0ad6814d4c8094142d8473733f>:0 
  at Assimp.Scene.FromUnmanagedScene (System.IntPtr scenePtr) [0x0000f] in <d40f2b0ad6814d4c8094142d8473733f>:0 
  at Assimp.AssimpContext.ImportFile (System.String file, Assimp.PostProcessSteps postProcessFlags) [0x0009d] in <d40f2b0ad6814d4c8094142d8473733f>:0 
  at UnityMeshImporter.LoaderController.<Awake>b__8_3 (System.String path) [0x00008] in 

Could you give me any suggestion?

+ just minor suggestion. Dotnet build command for building a project with dotnet cli would be very helpful to beginners.

+ I installed MemoryInterop.ILPatcher by nuget.

Project 'AssimpNet' has the following package references                                                 
   [net35]:                                                                                              
   Top-level Package              Requested   Resolved                                                   
   > MemoryInterop.ILPatcher      2.1.0       2.1.0                                                      
                                                                                                         
   [net40]:                                                                                              
   Top-level Package              Requested   Resolved                                                   
   > MemoryInterop.ILPatcher      2.1.0       2.1.0                                                      
                                                                                                         
   [netstandard1.3]:                                                                                     
   Top-level Package                 Requested   Resolved                                                
   > MemoryInterop.ILPatcher         2.1.0       2.1.0                                                   
   > NETStandard.Library       (A)   [1.6.1, )   1.6.1                                                   
                                                                                                         
(A) : Auto-referenced package.  

Comments (6)

  1. Log in to comment