GithubHelp home page GithubHelp logo

tuyoogame / huatuo Goto Github PK

View Code? Open in Web Editor NEW
2.3K 68.0 376.0 5.11 MB

huatuo是一个特性完整、零成本、高性能、低内存的近乎完美的Unity全平台原生c#热更方案。 Huatuo is a fully featured, zero-cost, high-performance, low-memory solution for Unity's all-platform native c# hotfix

License: MIT License

C++ 99.96% CMake 0.03% Shell 0.01%
unity hotfix hotupdate il2cpp csharp ilruntime lua slua tolua xlua

huatuo's Introduction

huatuo

license


icon


huatuo是一个特性完整、零成本、高性能、低内存近乎完美的Unity全平台原生c#热更方案。

huatuo扩充了il2cpp的代码,使它由纯AOT runtime变成‘AOT+Interpreter’ 混合runtime,进而原生支持动态加载assembly,使得基于il2cpp backend打包的游戏不仅能在Android平台,也能在IOS、Consoles等限制了JIT的平台上高效地以AOT+interpreter混合模式执行。从底层彻底支持了热更新。

huatuo开创性地实现了 differential hybrid dll 技术====。即可以对AOT dll任意增删改,huatuo会智能地让变化或者新增的类和函数以interpreter模式运行,但未改动的类和函数以AOT方式运行,让热更新的游戏逻辑的运行性能基本达到原生AOT的水平。

特性

  • 特性完整。 近乎完整实现了ECMA-335规范,除了 下文中"限制和注意事项" 之外的特性都支持。
  • 零学习和使用成本。 huatuo将纯AOT runtime增强为完整的runtime,使得热更新代码与AOT代码无缝工作。脚本类与AOT类在同一个运行时内,可以随意写继承、反射、多线程(volatile、ThreadStatic、Task、async)之类的代码。不需要额外写任何特殊代码、没有代码生成,也没有什么特殊限制。
  • 执行高效。实现了一个极其高效的寄存器解释器,所有指标都大幅优于其他热更新方案。性能测试报告
  • 内存高效。 热更新脚本中定义的类跟普通c#类占用一样的内存空间,远优于其他热更新方案。内存占用报告
  • 原生支持hotfix修复AOT部分代码。几乎不增加任何开发和运行开销。
  • 开创性地实现了 differential hybrid dll 技术。即可以将某个热更新dll先AOT形式打包,后面可以对该dll任意增删改,huatuo会智能地让变化或者新增的类和函数以interpreter模式运行,但未改动的类和函数以AOT方式运行。这意味着热更新的游戏逻辑的运行性能将接近原生AOT的水平。

工作原理

huatuo从mono的hybrid mode execution技术中得到启发,为unity的il2cpp之类的AOT runtime额外提供了interpreter模块,将它们由纯AOT运行时改造为"AOT + Interpreter"混合运行方式。

icon

更具体地说,huatuo做了以下几点工作:

  • 实现了一个高效的元数据(dll)解析库
  • 改造了元数据管理模块,实现了元数据的动态注册
  • 实现了一个IL指令集到自定义的寄存器指令集的compiler
  • 实现了一个高效的寄存器解释器
  • 额外提供大量的instinct函数,提升解释器性能
  • 提供hotfix AOT的支持

与其他流行的c#热更新方案的区别

本质比较

huatuo是原生的c#热更新方案。通俗地说,il2cpp相当于mono的aot模块,huatuo相当于mono的interpreter模块,两者合一成为完整mono。huatuo使得il2cpp变成一个全功能的runtime,原生(即通过System.Reflection.Assembly.Load)支持动态加载dll,从而支持ios平台的热更新。

正因为huatuo是原生runtime级别实现,热更新部分的类型与主工程AOT部分类型是完全等价并且无缝统一的。可以随意调用、继承、反射、多线程,不需要生成代码或者写适配器。

其他热更新方案则是独立vm,与il2cpp的关系本质上相当于mono中嵌入lua的关系。因此类型系统不统一,为了让热更新类型能够继承AOT部分类型,需要写适配器,并且解释器中的类型不能为主工程的类型系统所识别。特性不完整、开发麻烦、运行效率低下。

实际使用体验或者特性比较

  • huatuo学习和使用成本几乎为零。huatuo让il2cpp变成全功能的runtime,学习和使用成本几乎为零,几乎零侵入性。而其他方案则有大量的坑和需要规避的规则,学习和使用成本,需要对原项目作大量改造。
  • huatuo可以使用所有c#的特性。而其他方案往往有大量的限制。
  • huatuo中可以直接支持使用和继承主工程中的类型。其他方案要写适配器或者生成代码。
  • huatuo中热更新部分元数据与AOT元数据无缝统一。像反射代码能够正常工作的,AOT部分也可以通过标准Reflection接口创建出热更新对象。其他方案做不到。
  • huatuo对多线程支持良好。像多线程、ThreadStatic、async等等特性都是huatuo直接支持,其他方案除了async特性外均难以支持。
  • huatuo中Unity工作流与原生几乎完全相同。huatuo中热更新MonoBehaviour可以直接挂载在热更新资源上,并且正确工作。其他方案不行。
  • huatuo兼容性极高。各种第三方库只要在il2cpp下能工作,在huatuo下也能正常工作。其他方案往往要大量魔改源码。
  • huatuo内存效率极高。huatuo中热更新类型与主工程的AOT类型完全等价,占用一样多的空间。其他方案的同等类型则是假类型,不仅不能被runtime识别,还多占了数倍空间。
  • huatuo执行效率高。huatuo中热更新部分与主工程AOT部分交互属于il2cpp内部交互,效率极高。而其他方案则是独立虚拟机与il2cpp之间的效率,不仅交互麻烦还效率低下。

文档

稳定性状况

=== 庆祝于 2021.6.7 第一款使用huatuo的android和iOS双端休闲游戏正式上线 ===,7月份还有几款中重游戏上线或者对外测试。

技术评估上目前稳定性处于Beta版本。由于huatuo技术原理的先进性,bug本质上不多,稳定得非常快。

  • 目前PC、Android、iOS 已跑通所有单元测试,可稳定体验使用。
  • 测试了游戏常用库和框架的兼容性,兼容性良好。只要能在il2cpp backend下工作的库都可以在huatuo下正常工作。甚至那些与il2cpp因为AOT问题不兼容的库,现在因为huatuo对il2cpp的能力扩充,反而可以正常运行了。具体参见 兼容性报告
  • 已经有几十个大中型游戏项目较完整地接入huatuo,并且其中一些在紧锣密鼓作上线前测试。具体参见收集的一些 完整接入的商业项目列表

RoadMap

huatuo虽然与il2cpp相关,但绝大多数核心代码独立于il2cpp,很容易移植(预计一个月)到其他不支持AOT+Interpreter的CLR平台。无论unity如何版本变迁,哪怕废弃了il2cpp改用.net 6+,huatuo会持续跟进,稳定地提供跨平台的CLR热更新服务,直至某天.net官方直接支持AOT+Interpreter,则huatuo完成其历史使命。

  • 支持Unity 2019、2020和2021系列版本 (2022.6 -)
  • 支持32位 (2022.6 - 2022.7)
  • 指令优化,编译后指令数减少到原来1/4-1/2,基础指令和大多数对象模型指令有100%-300%的性能提升。 (2022.7 -)
  • 支持增量式gc (2022.8 -)

license

Huatuo is licensed under the MIT license

huatuo's People

Contributors

game404 avatar gmhevinci avatar pirunxi avatar shuaigao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

huatuo's Issues

定义泛型方法的泛型返回值运行异常

测试环境

  • Untiy 2017.3.7f1c1,PC,IL2CPP, NET4.x

测试代码

public class HotfixMain
{
    public static void Init()
    {
        Debug.Log("init");
        Foo<MyClass>();
    }

    public static void Foo<T>() where T : class, new()
    {
        Debug.Log("call foo");
        FooB<T>(); // error
    }

    public static T FooB<T>() where T : class, new()
    {
        Debug.Log("call foo b");
        return null;
    }
}

public class MyClass
{
        
}

预期结果

调用后打印"call foo b"并且能够正常接收正确的返回值

代码文件

test_case.zip

TaskCompletionSource<T>有问题

var tcs1 = new TaskCompletionSource();
public class VerifyTest
{
public string s;
public string Address;
}
上面的代码在AOT中使用

` public static async void Enter()
{
Debug.Log("Send---a");
await Send();
}
public static async Task Send()
{
var tcs = new TaskCompletionSource();
Debug.Log("Send---b");

}`

VerifyTest声明在AOT的代码中,TaskCompletionSource已经在AOT中注册,调用Enter时会出错:MissingMethodException:MethodPointerNotImplement System.Void System.Threading.Tasks.TaskCompletionSource'1[t_RecursiveFallbackBytes]:ctor()

继承泛型类闪退,但是将泛型类放到热更层就正常

AOT代码

public interface IStateOwner
{
     Task TranslateState<TState>(object[] args);
}
public abstract class State <TOwner> where TOwner: IStateOwner
{
    public abstract Task OnEnter();

}

热更层代码

public class GameManager: IStateOwner
{
    public Task TranslateState<TState>(object[] args)
    {
        throw new NotImplementedException();
    }
}
public class GameState_Version : State<GameManager>
{
    public override  Task OnEnter()
    {
        Debug.Log("GameState_Version->OnEnter");
        return null;
    }
}

使用全热更状态下的ETTask测试异常

将ETTask全放入到热更程序集种,使用如下代码测试,工作异常

        public static void Start()
        {
            AsyncMethod().Coroutine();
        }

        static async ETTask AsyncMethod()
        {
            Debug.Log("Begin");
            await ETTask.CompletedTask;
            Debug.Log("End");
        }

注释掉Coroutine方法中的InnerCoroutine调用后可正常工作

        [DebuggerHidden]
        private async ETVoid InnerCoroutine()
        {
            await this;
        }

        [DebuggerHidden]
        public void Coroutine()
        {
            InnerCoroutine().Coroutine();
        }

经打断点调试发现是libil2cpp\huatuo\transform.cpp 3895行的断言引起的,此时size为24,GetTypeValueSize得到的size为8
初步怀疑是是由C#方法InnerCoroutine引起的该方法await的是一个ETTask返回的是一个async ETvoid

	PopStack();
	PushStackByType(&objKlass->byval_arg);
	IL2CPP_ASSERT(size == GetTypeValueSize(&objKlass->byval_arg));
	InsertMemoryBarrier();
	ResetPrefixFlags();
	ip += 5;
	continue;

ETTask的源码文件地址https://github.com/egametang/ET/tree/master/Unity/Assets/ThirdParty/ETTask
将整个ETTask文件夹放入热更程序集复制上述代码RefTypes中加入Queue泛型(印象中示例工程没加Queue)即可测试。

Task<T>崩溃的例子

首先在AOT定义AckMsg和IMessageTest接口,并添加泛型接口的引用

public struct AckMsg<T>
{
    public bool cancel;
    public T msg;

    public AckMsg(T msg, bool cancel)
    {
        this.msg = msg;
        this.cancel = cancel;
    }
}
public interface IMessageTest
{
    int CalculateSize();
}
public interface IMessageTest<T> : IMessageTest where T : IMessageTest<T>
{
    void MergeFrom(T message);
}
TaskAwaiter aw = default;
var c11 = new AsyncTaskMethodBuilder<AckMsg<IMessageTest>>();
c11.Start(ref stateMachine);
c11.AwaitUnsafeOnCompleted(ref aw, ref stateMachine);
c11.AwaitOnCompleted(ref aw, ref stateMachine);
c11.SetException(null);
c11.SetResult(default);
bl = aw.IsCompleted;

TaskAwaiter<AckMsg<IMessageTest>> awAckMsg = default;
var c12 = new AsyncVoidMethodBuilder();
var c12B = AsyncVoidMethodBuilder.Create();
c12.Start(ref stateMachine);
c12.AwaitUnsafeOnCompleted(ref awAckMsg, ref stateMachine);
c12.SetException(null);
c12.SetResult();

然后在热更层定义类VerifyACKTest继承IMessageTest

public class VerifyACKTest: IMessageTest<VerifyACKTest>
{
    public void MergeFrom(VerifyACKTest message)
    {
    }

    public int CalculateSize()
    {
        //throw new System.NotImplementedException();
        return 0;
    }
}

最后热更层调用Enter()方法就会崩溃

public static async void Enter()
{
    await Send<VerifyACKTest>();
}
public static async Task<AckMsg<T>> Send<T>()
{
    var tcs = new TaskCompletionSource<T>();
    Debug.Log("Send---b");
    return new AckMsg<T>(default, true);
}

不支持git submodule

目前的目录结构不支持git submodule的方式,不利于管理,每次更新都需要手动copy.
能不能调整下目录结构。

使用桥接函数扫描过后依然提示泛型委托不支持

unity版本2021.3.0,huatuo更新至最新,桥接函数集扫描使用的huotuo_trail最新版本
委托类放在热更层提示不支持
05-24 09:11:19.299: E/Unity(30252): ExecutionEngineException: GetManaged2NativeMethodPointer. sinature:vi4i8sr not support. not support. Homy.Callback`3::Invoke
05-24 09:11:19.299: E/Unity(30252): at System.Runtime.CompilerServices.AsyncVoidMethodBuilder.Start[TStateMachine] (TStateMachine& stateMachine) [0x00000] in <00000000000000000000000000000000>:0
05-24 09:11:19.299: E/Unity(30252): at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) [0x00000] in <00000000000000000000000000000000>:0
05-24 09:11:19.299: E/Unity(30252): at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
05-24 09:11:19.299: E/Unity(30252): at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <00000000000000000000000000000000>:0
05-24 09:11:19.299: E/Unity(30252): at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunn

image

将委托移至AOT则闪退

05-24 09:24:41.495: E/AndroidRuntime(3248): FATAL EXCEPTION: UnityMain
05-24 09:24:41.495: E/AndroidRuntime(3248): Process: com.xmhomy.jjty, PID: 3248
05-24 09:24:41.495: E/AndroidRuntime(3248): java.lang.Error: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
05-24 09:24:41.495: E/AndroidRuntime(3248): Version '2021.3.0f1c1 (c833db084d5b)', Build type 'Release', Scripting Backend 'il2cpp', CPU 'arm64-v8a'
05-24 09:24:41.495: E/AndroidRuntime(3248): Build fingerprint: 'HUAWEI/LYA-AL00/HWLYA:10/HUAWEILYA-AL00/10.1.0.163C00:user/release-keys'
05-24 09:24:41.495: E/AndroidRuntime(3248): Revision: '0'
05-24 09:24:41.495: E/AndroidRuntime(3248): ABI: 'arm64'
05-24 09:24:41.495: E/AndroidRuntime(3248): Timestamp: 2022-05-24 09:24:41+0800
05-24 09:24:41.495: E/AndroidRuntime(3248): pid: 3248, tid: 3329, name: UnityMain >>> com.xmhomy.jjty <<<
05-24 09:24:41.495: E/AndroidRuntime(3248): uid: 10260
05-24 09:24:41.495: E/AndroidRuntime(3248): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x20
05-24 09:24:41.495: E/AndroidRuntime(3248): Cause: null pointer dereference
05-24 09:24:41.495: E/AndroidRuntime(3248): x0 0000000000000000 x1 000000747267f7f0 x2 0000000000000000 x3 000000747a76f940
05-24 09:24:41.495: E/AndroidRuntime(3248): x4 000000747267f7f8 x5 0000007482141008 x6 000000748298acd0 x7 000000748298acd0
05-24 09:24:41.495: E/AndroidRuntime(3248): x8 000000747267ef2e x9 0000000000000000 x10 000000745fdc1b00 x11 000000745dda1c2d
05-24 09:24:41.495: E/AndroidRuntime(3248): x12 000000745ddfe6b2 x13 000000745dda1d20 x14 000000745dda1d4f x15 000000745dda1c9d
05-24 09:24:41.495: E/AndroidRuntime(3248): x16 000000747267ef88 x17 0000000000000000 x18 00000073d0cb8ad8 x19 0000007472682b70
05-24 09:24:41.495: E/AndroidRuntime(3248): x20 000000748298acd0 x21 00000074d6d58c60 x22 0000007472682a40 x23 0000000000000000
05-24 09:24:41.495: E/AndroidRuntime(3248): x24 0000000000000000 x25 00000000166033c8 x26 00000000166385d8 x27 0000000000000000
05-24 09:24:41.495: E/AndroidRuntime(3248): x28 0000000000000001 x29 000000747267f7c0
05-24 09:24:41.495: E/AndroidRuntime(3248): sp 000000747267c8a0 lr 00000074555614a4 pc 00000074550a16b4
05-24 09:24:41.495: E/AndroidRuntime(3248): backtrace:
05-24 09:24:41.495: E/AndroidRuntime(3248): #00 pc 00000000026e06b4 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libil2cpp.so (huatuo::interpreter::Interpreter::Execute(MethodInfo const*, huatuo::interpreter::StackObject*, void*)+104) (BuildId: d56d4e5001e633ff41d62cc77167c3bed66978a3)
05-24 09:24:41.495: E/AndroidRuntime(3248): #1 pc 0000000002ba04a0 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libil2cpp.so (__Native2ManagedCall_v(MethodInfo const*)+68) (BuildId: d56d4e5001e633ff41d62cc77167c3bed66978a3)
05-24 09:24:41.495: E/AndroidRuntime(3248): #2 pc 0000000008bdae50 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libil2cpp.so (HomyMessenger_Broadcast_m8DCF08C1A1888C7A1C9291222C1372F23170F861+416) (BuildId: d56d4e5001e633ff41d62cc77167c3bed66978a3)
05-24 09:24:41.495: E/AndroidRuntime(3248): #3 pc 0000000008bdb6c8 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libil2cpp.so (MessengerEvent_Broadcast_mFE42AB21EE32F3D4B3D10B9FF62956F7B91D36A8+92) (BuildId: d56d4e5001e633ff41d62cc77167c3bed66978a3)
05-24 09:24:41.495: E/AndroidRuntime(3248): #4 pc 0000000002c3e224 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libil2cpp.so (__Managed2NativeCall_vi8(MethodInfo const*, unsigned short*, huatuo::interpreter::StackObject*, void*)+260) (BuildId: d56d4e5001e633ff41d62cc77167c3bed66978a3)
05-24 09:24:41.495: E/AndroidRuntime(3248): #5 pc 00000000026f1588 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libil2cpp.so (huatuo::interpreter::Interpreter::Execute(MethodInfo const*, huatuo::interpreter::StackObject*, void*)+69436) (BuildId: d56d4e5001e633ff41d62cc77167c3bed66978a3)
05-24 09:24:41.495: E/AndroidRuntime(3248): #6 pc 0000000002f35bb8 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libil2cpp.so (__Invoke_instance_v(void ()(), MethodInfo const, void*, void**, void*)+92) (BuildId: d56d4e5001e633ff41d62cc77167c3bed66978a3)
05-24 09:24:41.495: E/AndroidRuntime(3248): #7 pc 0000000003017e58 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libil2cpp.so (il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**)+96) (BuildId: d56d4e5001e633ff41d62cc77167c3bed66978a3)
05-24 09:24:41.495: E/AndroidRuntime(3248): #8 pc 0000000003017c00 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libil2cpp.so (il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**)+228) (BuildId: d56d4e5001e633ff41d62cc77167c3bed66978a3)
05-24 09:24:41.495: E/AndroidRuntime(3248): #9 pc 00000000027bc43c /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libil2cpp.so (il2cpp_runtime_invoke+44) (BuildId: d56d4e5001e633ff41d62cc77167c3bed66978a3)
05-24 09:24:41.495: E/AndroidRuntime(3248): #10 pc 0000000000562a78 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libunity.so (BuildId: 7082753427e558d7ca747e09196173612e07af1d)
05-24 09:24:41.495: E/AndroidRuntime(3248): #11 pc 0000000000571d1c /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libunity.so (BuildId: 7082753427e558d7ca747e09196173612e07af1d)
05-24 09:24:41.495: E/AndroidRuntime(3248): #12 pc 000000000058015c /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libunity.so (BuildId: 7082753427e558d7ca747e09196173612e07af1d)
05-24 09:24:41.495: E/AndroidRuntime(3248): #13 pc 0000000000386874 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libunity.so (BuildId: 7082753427e558d7ca747e09196173612e07af1d)
05-24 09:24:41.495: E/AndroidRuntime(3248): #14 pc 000000000045c658 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libunity.so (BuildId: 7082753427e558d7ca747e09196173612e07af1d)
05-24 09:24:41.495: E/AndroidRuntime(3248): #15 pc 000000000045c698 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libunity.so (BuildId: 7082753427e558d7ca747e09196173612e07af1d)
05-24 09:24:41.495: E/AndroidRuntime(3248): #16 pc 000000000045c8d0 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libunity.so (BuildId: 7082753427e558d7ca747e09196173612e07af1d)
05-24 09:24:41.495: E/AndroidRuntime(3248): #17 pc 00000000005f42d8 /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libunity.so (BuildId: 7082753427e558d7ca747e09196173612e07af1d)
05-24 09:24:41.495: E/AndroidRuntime(3248): #18 pc 000000000060d6fc /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/lib/arm64/libunity.so (BuildId: 7082753427e558d7ca747e09196173612e07af1d)
05-24 09:24:41.495: E/AndroidRuntime(3248): #19 pc 000000000000ab8c /data/app/com.xmhomy.jjty-HTPCM8s6WiAE389yWfA8QA==/oat/arm64/base.odex
05-24 09:24:41.495: E/AndroidRuntime(3248): at libil2cpp.huatuo::interpreter::Interpreter::Execute(MethodInfo const*, huatuo::interpreter::StackObject*, void*)(Execute:104)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libil2cpp.__Native2ManagedCall_v(MethodInfo const*)(__Native2ManagedCall_v:68)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libil2cpp.HomyMessenger_Broadcast_m8DCF08C1A1888C7A1C9291222C1372F23170F861(HomyMessenger_Broadcast_m8DCF08C1A1888C7A1C9291222C1372F23170F861:416)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libil2cpp.MessengerEvent_Broadcast_mFE42AB21EE32F3D4B3D10B9FF62956F7B91D36A8(MessengerEvent_Broadcast_mFE42AB21EE32F3D4B3D10B9FF62956F7B91D36A8:92)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libil2cpp.__Managed2NativeCall_vi8(MethodInfo const*, unsigned short*, huatuo::interpreter::StackObject*, void*)(__Managed2NativeCall_vi8:260)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libil2cpp.huatuo::interpreter::Interpreter::Execute(MethodInfo const*, huatuo::interpreter::StackObject*, void*)(Execute:69436)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libil2cpp.__Invoke_instance_v(void ()(), MethodInfo const, void*, void**, void*)(__Invoke_instance_v:92)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libil2cpp.il2cpp::vm::Runtime::InvokeWithThrow(MethodInfo const*, void*, void**)(InvokeWithThrow:96)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libil2cpp.il2cpp::vm::Runtime::Invoke(MethodInfo const*, void*, void**, Il2CppException**)(Invoke:228)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libil2cpp.il2cpp_runtime_invoke(il2cpp_runtime_invoke:44)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libunity.0x562a78(Native Method)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libunity.0x571d1c(Native Method)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libunity.0x58015c(Native Method)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libunity.0x386874(Native Method)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libunity.0x45c658(Native Method)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libunity.0x45c698(Native Method)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libunity.0x45c8d0(Native Method)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libunity.0x5f42d8(Native Method)
05-24 09:24:41.495: E/AndroidRuntime(3248): at libunity.0x60d6fc(Native Method)
05-24 09:24:41.495: E/AndroidRuntime(3248): at base.0xab8c(Native Method)

image

提3个bug

using UnityEngine;
using UnityEngine.UI;

public class App
{
public static int Main()
{
Test0(2);
Test1("123,456");
Test2(null, null, Color.black);
return 0;
}

private static void Test0(int c)
{
    //出错在 MetadataParser.cpp 524行 IL2CPP_ASSERT(paramCount == methodDef.parameterCount);
    //B的函数定义只有一个参数 编译成il后会有两个参数
    void B(int d)
    {
        Debug.LogError(c + d);
    }

    B(1);
    B(2);
}

private static void Test1(string str)
{
    //出错在 libil2cpp/vm/Array.cpp 54行 不用huatuo时不出错
    var ss = str.Split(',');
    ss[0] += "qwe";
}

private static void Test2(Image img1, Image img2, Color c1)
{
    //出错在 Transform.cpp 1011行 IL2CPP_ASSERT(false);
    img1.color = img2.color = c1;
}

}

Macos下打包WebGL失败

运行环境

OS: Macos 10.13.6
Unity: 2020.3.33

在huatuo_trial 尝试打包WebGL过程中编译il2cpp失败
错误日志:

Exception: Unity.IL2CPP.Building.BuilderFailedException: In file included from /Volumes/Workspace/Github/huatuo_trial/Library/Il2cppBuildCache/WebGL/il2cppOutput/lumpedcpp/Lump_libil2cpp_icalls.cpp:109:
In file included from /Applications/Unity/Hub/Editor/2020.3.33f1c2/Unity.app/Contents/il2cpp/libil2cpp/icalls/mscorlib/System/AppDomain.cpp:36:
In file included from /Applications/Unity/Hub/Editor/2020.3.33f1c2/Unity.app/Contents/il2cpp/libil2cpp/huatuo/metadata/Assembly.h:3:
/Applications/Unity/Hub/Editor/2020.3.33f1c2/Unity.app/Contents/il2cpp/libil2cpp/huatuo/metadata/../CommonDef.h:24:2: error: "only support 64bit"
#error "only support 64bit"
 ^
1 error generated.
ERROR:root:compiler frontend failed to generate LLVM bitcode, halting


Invocation was: Executable: /usr/bin/python
Arguments: -E "/Applications/Unity/Hub/Editor/2020.3.33f1c2/PlaybackEngines/WebGLSupport/BuildTools/Emscripten/em++" -Wno-unused-value -Wno-invalid-offsetof -nostdinc -fno-strict-overflow -Wno-null-conversion -std=c++11 -O3 -Oz -DIL2CPP_EXCEPTION_DISABLED=1  -DNET_4_0 -DUNITY_AOT -DIL2CPP_MONO_DEBUGGER_DISABLED -DGC_NOT_DLL -DRUNTIME_IL2CPP -DBASELIB_INLINE_NAMESPACE=il2cpp_baselib -DNDEBUG -I"/Applications/Unity/Hub/Editor/2020.3.33f1c2/Unity.app/Contents/il2cpp/libil2cpp" -I"/Applications/Unity/Hub/Editor/2020.3.33f1c2/Unity.app/Contents/il2cpp/libil2cpp" -I"/Applications/Unity/Hub/Editor/2020.3.33f1c2/Unity.app/Contents/il2cpp/external/bdwgc/include" -I"/Applications/Unity/Hub/Editor/2020.3.33f1c2/Unity.app/Contents/il2cpp/external/xxHash" -I"/Applications/Unity/Hub/Editor/2020.3.33f1c2/Unity.app/Contents/il2cpp/external/baselib/Include" -I"/Applications/Unity/Hub/Editor/2020.3.33f1c2/Unity.app/Contents/il2cpp/external/baselib/Platforms/WebGL/Include" -I"/Applications/Unity/Hub/Editor/2020.3.33f1c2/Unity.app/Contents/il2cpp/libil2cpp/pch" "/Volumes/Workspace/Github/huatuo_trial/Library/Il2cppBuildCache/WebGL/il2cppOutput/lumpedcpp/Lump_libil2cpp_icalls.cpp" -o "/Volumes/Workspace/Github/huatuo_trial/Library/il2cpp_cache/libil2cpp/4C89EA9DE395E337999D9B3C6532F7D0.o"

   at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable`1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector) in /Users/bokken/build/output/fmwang/il2cpp/Unity.IL2CPP.Building/CppProgramBuilder.cs:line 217
   at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) in /Users/bokken/build/output/fmwang/il2cpp/Unity.IL2CPP.Building/CppProgramBuilder.cs:line 149
   at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection`1 matchedAssemblyMethodSourceFiles) in /Users/bokken/build/output/fmwang/il2cpp/il2cpp/Compilation/CompilationDriver.cs:line 65
   at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions) in /Users/bokken/build/output/fmwang/il2cpp/il2cpp/Program.cs:line 74
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:129)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action`1[T] setupStartInfo) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:65)
UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List`1[T] arguments, System.Action`1[T] setupStartInfo) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:818)
UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:785)
UnityEditorInternal.IL2CPPBuilder.Run () (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:604)
UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action`1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:276)
UnityEditor.WebGL.WebGlBuildPostprocessor.CompileBuild (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:365)
UnityEditor.WebGL.WebGlBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /Users/bokken/buildslave/unity/build/PlatformDependent/WebGL/Extensions/Unity.WebGL.extensions/BuildPostprocessor.cs:918)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at /Users/bokken/buildslave/unity/build/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:29)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /Users/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:337)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /Users/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

Android Build Error: Lump_libil2cpp_huatuo.cpp:8

Platform: Android
Scripting Backend: IL2CPP
ApiCompatibilityLevel: .NET 4.x

Unity.IL2CPP.Building.BuilderFailedException: In file included from proj.android/unityLibrary/src/main/Il2CppOutputProject/Source/il2cppOutput/lumpedcpp/Lump_libil2cpp_huatuo.cpp:8:

是否支持像 InjectFix 这种形式的HotFix

看示例代码貌似跟 ILRuntime 之类的使用方式类似(实现不同),但是 InjectFix 之类的能够 Patch 原有 AOT 代码的模式才是更有价值的,请问这种模式是否支持,如果不支持的话将来是否有计划提供支持?
InjectFix 的 HotFix 原理是对 IL 插桩, 如果 huatuo 不采用插桩而是替换 meta 的话,只会对反射调用的函数生效吧。

[Bug] 函数 out byte 导致的 bug

void Hello(out byte c)
{
    c = 1;
}

void Awake()
{
    byte c;
    Hello(out c);
    for (int i = 0; i < c; i++)
    {
        Debug.Log("AAAAAAAAAAAA " + i);
    }
}

就这段代码,放 Hotfix 去跑,可能出现的结果是:打印出无数行
注意:另一个问题是,有时候 c 打印出来的确是 1,但是却也被循环了多次
(猜测:所以可能问题出在于 int 和 byte 的比较上)

Vector3使用问题

public static UnityEngine.Vector3 Func(bool b)
{
    var v = new UnityEngine.Vector3(1, 2);
    if (b)
    {
        v = new UnityEngine.Vector3(1, 2, 3);
    }

    return v;
}

libil2cpp/huatuo/transform/Transform.cpp 的第2622行 IL2CPP_ASSERT(evalStackTop >= 4); 会出问题

Task<T>的泛型方法调用失败

AOT部分

public struct AckMsg<T>
{
    public bool cancel;
    public T msg;

    public AckMsg(T msg, bool cancel)
    {
        this.msg = msg;
        this.cancel = cancel;
    }
}
public class RcvMsgTest
{
    public int id;

}
public static async Task<AckMsg<T>> RefTypeAddTask<T>()
{
    var tcs = new TaskCompletionSource<T>();
    Debug.Log("Send---b");
    var task = tcs.Task;
    await task;
    return new AckMsg<T>((T)tcs.Task.Result, false);
}

热更新部分调用Enter方法,奇怪的是我将Send2函数内容放到Send方法里面就正常

public static async void Enter()
{
    await Send<RcvMsgTest>();
}
public static async Task<AckMsg<T>> Send<T>()
{
    return await Send2<T>();
}

public static async Task<AckMsg<T>> Send2<T>()
{
    var tcs = new TaskCompletionSource<T>();
    var task = tcs.Task;
    await task;
    return new AckMsg<T>((T) tcs.Task.Result, false);
}

enum相关出错

using UnityEngine;

public class App
{
public static int Main()
{
Test8();
TestClass.Test9(Ea.A3);
return 0;
}

public static void Test8()
{
    Debug.LogError("Test8");
    object e = Ec.C1;
    var b = (long) e; //转换出错
    Debug.LogError(b);
}

public enum Ec : long
{
    C0,
    C1
}

public class TestClass
{
    public static Ea Field1 = Ea.A1;
    public static Ea Field2 = Ea.A2;
    public static Eb FieldB = Eb.B3;

    public static void A()
    {
        Debug.LogError("-----");
        Debug.LogError(Field1);
        Debug.LogError(Field2);
        Debug.LogError(FieldB);
    }

    public static void Test9(Ea a)
    {
        Debug.LogError("Test9");
        A(); //第一次输出正确
        Field1 = a;
        A(); //第二次输出 Field2输出不对
        Field2 = a;
        A(); //第三次输出 FieldB输出不对
    }
}

public enum Ea
{
    A0,
    A1,
    A2,
    A3,
}

public enum Eb
{
    B0,
    B1,
    B2,
    B3,
}

}

release dll会出现的问题

using System;
using System.Collections.Generic;
using UnityEngine;

public class App
{
public static int Main()
{
Test3();
Test4();
Test6();
Test7();
return 0;
}

public static void Test3()
{
    Debug.LogError("Test3");
    //release会崩 debug不崩
    var a1 = new A1();
    a1.Test<string>((a) => { });
    a1.Test<string>((a) => { });
}

public class A1
{
    public void Test<T>(Action<T> callback)
    {
        callback?.Invoke(default);
    }
}

public static void Test4()
{
    Debug.LogError("Test4");
    //release会崩 debug不崩
    var b = new B2();
    b.Dict = new Dictionary<string, string>();
    b.Dict.Add("123", "123");
    b.Dict["123"] = "456";
    Debug.LogError(b.Dict["123"]);
}

public class B2
{
    public Dictionary<string, string> Dict { get; set; }
}

public static void Test6()
{
    Debug.LogError("Test6");
    //release下输出错误
    var a = new[] {1, 2, 3};
    Debug.LogError(a[0]);
    Swap1(a, 0, 1);
    Debug.LogError(a[0]); //release输出1 debug输出2
    Swap2(a, 0, 2);
    Debug.LogError(a[0]); //release输出1 debug输出3
}

public static void Swap1(int[] arr, int idx1, int idx2)
{
    var temp = arr[idx1];
    arr[idx1] = arr[idx2];
    arr[idx2] = temp;
}

public static void Swap2<T>(T[] arr, int idx1, int idx2)
{
    var temp = arr[idx1];
    arr[idx1] = arr[idx2];
    arr[idx2] = temp;
}

public static void Test7()
{
    Debug.LogError("Test7");
    //release下输出错误
    var aa = new[,]
    {
        {1, 2, 3},
        {4, 5, 6}
    };
    Debug.LogError(aa[0, 0]);
    Debug.LogError(aa[0, 1]);
    Debug.LogError(aa[0, 2]);
    Debug.LogError(aa[1, 0]);
    Debug.LogError(aa[1, 1]);
    Debug.LogError(aa[1, 2]);
}

}

release下编译出的dll
附上dll的压缩包
HotFix.zip

System.Runtime.CompilerServices Crash

Game.zip

TableManager.cs Crash
ReadOnlySpan<byte> span = new ReadOnlySpan<byte>(new byte[] { 0x0, 0x0, 0x0, 0x0 }); Unsafe.ReadUnaligned<int>(ref System.Runtime.InteropServices.MemoryMarshal.GetReference(span));

3个直接崩溃的例子

2020.3.7f1 standalone包

using System;
using System.Collections.Generic;
using UnityEngine;

public class App
{
public static int Main()
{
Test3();
Test4();
Test5();
return 0;
}

public static void Test3()
{
    var a1 = new A1();
    a1.Test<string>((a) => { });
    a1.Test<string>((a) => { });
}

public class A1
{
    public void Test<T>(Action<T> callback)
    {
        callback?.Invoke(default);
    }
}

public static void Test4()
{
    var b = new B2();
    b.Dict = new Dictionary<string, string>();
    b.Dict.Add("123", "123");
    b.Dict["123"] = "456";
}

public class B2
{
    public Dictionary<string, string> Dict { get; set; }
}

public static void Test5()
{
    C3 a;
    a.F = 123;
    a.V = new Vector3(4, 5, 6);
    var pos = a.V;
    pos.x += 111;
}

public struct C3
{
    public float F;
    public Vector3 V;
}

}

使用Stream的Write方法有问题

public class CircularBufferTest : Stream
{

    public override bool CanRead { get; }
    public override bool CanSeek { get; }
    public override bool CanWrite { get; }
    public override long Length { get; }
    public override long Position { get; set; }
    
    
    public override void Flush()
    {
        throw new NotImplementedException();
    }


    public override int Read(byte[] buffer, int offset, int count)
    {
        throw new NotImplementedException();
    }

    public override long Seek(long offset, SeekOrigin origin)
    {
        throw new NotImplementedException();
    }

    public override void SetLength(long value)
    {
        throw new NotImplementedException();
    }
    public override void Write(byte[] buffer, int offset, int count)
    {
        
    }

    public void Write(int l)
    {
        byte[] s_Cached = new byte[4];
        s_Cached[0] = (byte)(l >> 0);
        s_Cached[1] = (byte)(l >> 8);
        s_Cached[2] = (byte)(l >> 16);
        s_Cached[3] = (byte)(l >> 24);
        Write(s_Cached, 0, 4);
    }
}

public static void CircularBufferTest()
{
    var capacity = 1024 * 512;
    CircularBufferTest m_SendBuffer = new CircularBufferTest();
    var msgLen = 1;
    m_SendBuffer.Write(msgLen);
}

属性字段在最上面定义时,调用write方法时会卡死
但是将上面定义的属性字段放到Plush()方法下面时,会报NotImplementedException:The method or operation is not implemented

catch代码块不执行

using System;
using System.Collections.Generic;

namespace CSharp
{
public struct A
{
public int i;
}

public class Main
{
    public static void Entry()
    {
        try
        {
            Console.WriteLine("CSharp.Main.Entry Fix");
            
            // case 1 正常,catch里的逻辑正常执行
            // throw new MissingMethodException();
            
            // case 2
            var list = new List<A>(); // 这里应该报异常,然后执行catch里面的逻辑,测试结果是catch里的逻辑没有执行
            list.Add(new A());
            var a = new A();
            Console.WriteLine(a);
        }
        catch (Exception e)
        {
            Console.WriteLine(e);
        }
    }
}

}

一个崩溃bug(Coroutine 或 ?.Invoke 相关)

    public event Action OnPerSecond;
    void OnEnable()
    {
        StartCoroutine(this.KeepUpdate());
    }

    IEnumerator KeepUpdate()
    {
        while (true)
        {
            yield return new WaitForSeconds(1f);
            try
            {
                this.OnPerSecond?.Invoke();
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
        }
    }

【Linux】deepin 20.5 编译报错

下载的huatuo_trail尝试打包的,unity2020.3.33

unity log ``` Exception: Unity.IL2CPP.Building.BuilderFailedException: In file included from /media/windys-dde/DATA/WorkSpaceDemo/huatuo_trial/Library/Il2cppBuildCache/StandaloneLinux64/il2cppOutput/lumpedcpp/Lump_libil2cpp_icalls.cpp:109: In file included from /home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/libil2cpp/icalls/mscorlib/System/AppDomain.cpp:36: In file included from /home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/libil2cpp/huatuo/metadata/Assembly.h:3: /home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/libil2cpp/huatuo/metadata/../CommonDef.h:66:11: error: no member named 'strcmp' in namespace 'std'; did you mean simply 'strcmp'? return std::strcmp(_Left, _Right) == 0; ^~~~~~~~~~~ strcmp /usr/include/string.h:136:12: note: 'strcmp' declared here extern int strcmp (const char *__s1, const char *__s2) ^ In file included from /media/windys-dde/DATA/WorkSpaceDemo/huatuo_trial/Library/Il2cppBuildCache/StandaloneLinux64/il2cppOutput/lumpedcpp/Lump_libil2cpp_icalls.cpp:109: In file included from /home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/libil2cpp/icalls/mscorlib/System/AppDomain.cpp:36: In file included from /home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/libil2cpp/huatuo/metadata/Assembly.h:3: /home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/libil2cpp/huatuo/metadata/../CommonDef.h:72:47: error: no member named 'strlen' in namespace 'std'; did you mean simply 'strlen'? return il2cpp::utils::StringView(str, std::strlen(str)); ^~~~~~~~~~~ strlen /usr/include/string.h:384:15: note: 'strlen' declared here extern size_t strlen (const char *__s) ^ 2 errors generated.

Invocation was: Executable: /bin/clang++
Arguments: -DNET_4_0 -DUNITY_AOT -DIL2CPP_MONO_DEBUGGER_DISABLED -DGC_NOT_DLL -DRUNTIME_IL2CPP -DIL2CPP_DEBUG=1 -DBASELIB_INLINE_NAMESPACE=il2cpp_baselib -D__linux__ -DLINUX -D_GNU_SOURCE -D__STDC_FORMAT_MACROS -I"/home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/libil2cpp" -I"/home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/libil2cpp" -I"/home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/external/bdwgc/include" -I"/home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/external/xxHash" -I"/home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/external/baselib/Include" -I"/home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/external/baselib/Platforms/Linux/Include" -I"/home/windys-dde/Applications/Unity/2020.3.33f1c2/Editor/Data/il2cpp/libil2cpp/pch" -g -c -fvisibility=hidden -fvisibility-inlines-hidden -fno-strict-overflow -fexceptions -fno-rtti -ffunction-sections -fdata-sections -fPIC -pthread -std=c++11 -m64 -Wno-null-conversion -O0 -mcx16 -Wno-extern-initializer -Wno-trigraphs -Wno-tautological-compare -Wswitch -Wno-invalid-offsetof -Wno-unused-value -Wno-null-conversion "/media/windys-dde/DATA/WorkSpaceDemo/huatuo_trial/Library/Il2cppBuildCache/StandaloneLinux64/il2cppOutput/lumpedcpp/Lump_libil2cpp_icalls.cpp" -o "/media/windys-dde/DATA/WorkSpaceDemo/huatuo_trial/Library/il2cpp_cache/libil2cpp/BA29F9BB13090D217E862EED76C4D5A1.o"

at Unity.IL2CPP.Building.CppProgramBuilder.BuildAllCppFiles(IEnumerable1 sourceFilesToCompile, IBuildStatisticsCollector statisticsCollector) in /Users/bokken/build/output/fmwang/il2cpp/Unity.IL2CPP.Building/CppProgramBuilder.cs:line 217 at Unity.IL2CPP.Building.CppProgramBuilder.Build(IBuildStatistics& statistics) in /Users/bokken/build/output/fmwang/il2cpp/Unity.IL2CPP.Building/CppProgramBuilder.cs:line 149 at il2cpp.Compilation.CompilationDriver.Run(RuntimePlatform platform, BuildingOptions buildingOptions, ReadOnlyCollection1 matchedAssemblyMethodSourceFiles) in /Users/bokken/build/output/fmwang/il2cpp/il2cpp/Compilation/CompilationDriver.cs:line 65
at il2cpp.Program.DoRun(String[] args, RuntimePlatform platform, BuildingOptions buildingOptions, Boolean throwExceptions) in /Users/bokken/build/output/fmwang/il2cpp/il2cpp/Program.cs:line 74
UnityEditorInternal.Runner.RunProgram (UnityEditor.Utils.Program p, System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser) (at /home/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:129)
UnityEditorInternal.Runner.RunManagedProgram (System.String exe, System.String args, System.String workingDirectory, UnityEditor.Scripting.Compilers.CompilerOutputParserBase parser, System.Action1[T] setupStartInfo) (at /home/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/BuildUtils.cs:65) UnityEditorInternal.IL2CPPBuilder.RunIl2CppWithArguments (System.Collections.Generic.List1[T] arguments, System.Action1[T] setupStartInfo) (at /home/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:818) UnityEditorInternal.IL2CPPBuilder.ConvertPlayerDlltoCpp (UnityEditor.Il2Cpp.Il2CppBuildPipelineData data) (at /home/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:785) UnityEditorInternal.IL2CPPBuilder.Run () (at /home/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:604) UnityEditorInternal.IL2CPPUtils.RunIl2Cpp (System.String stagingAreaData, UnityEditorInternal.IIl2CppPlatformProvider platformProvider, System.Action1[T] modifyOutputBeforeCompile, UnityEditor.RuntimeClassRegistry runtimeClassRegistry) (at /home/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/Il2Cpp/IL2CPPUtils.cs:276)
DesktopStandalonePostProcessor.RunIL2CPP (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditorInternal.IIl2CppPlatformProvider il2cppPlatformProvider, System.Collections.Generic.List1[T] cppPlugins) (at /home/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:256) DesktopStandalonePostProcessor.SetupStagingArea (UnityEditor.Modules.BuildPostProcessArgs args, System.Collections.Generic.HashSet1[T] filesToNotOverwrite) (at /home/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:232)
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /home/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:42)
Rethrow as BuildFailedException: Exception of type 'UnityEditor.Build.BuildFailedException' was thrown.
DesktopStandalonePostProcessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args) (at /home/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:60)
UnityEditor.Modules.DefaultBuildPostprocessor.PostProcess (UnityEditor.Modules.BuildPostProcessArgs args, UnityEditor.BuildProperties& outProperties) (at /home/bokken/buildslave/unity/build/Editor/Mono/Modules/DefaultBuildPostprocessor.cs:29)
UnityEditor.PostprocessBuildPlayer.Postprocess (UnityEditor.BuildTargetGroup targetGroup, UnityEditor.BuildTarget target, System.String installPath, System.String companyName, System.String productName, System.Int32 width, System.Int32 height, UnityEditor.BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.Build.Reporting.BuildReport report) (at /home/bokken/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:337)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&) (at /home/bokken/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:189)

</details>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.