[Android] BuildMethodException (2017.3.1, IL2CPP)

After adding <assembly fullname="Nethereum.Unity" preserve="all"/> node to link.xml I’ve got this build error. No human-readable message. What does it mean, how to solve?

UnityEditor.BuildPlayerWindow+BuildMethodException: 3 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x0020e] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:181
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00065] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:88
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:LogError(Object)
UnityEditor.BuildPlayerWindow:CallBuildMethods(Boolean, BuildOptions) (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:93)
UnityEditor.BuildPlayerWindow:GUIBuildButtons(IBuildWindowExtension, Boolean, Boolean, Boolean, BuildPlatform) (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:881)
UnityEditor.BuildPlayerWindow:ShowBuildTargetSettings() (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:812)
UnityEditor.BuildPlayerWindow:OnGUI() (at C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindow.cs:426)
System.Reflection.MonoMethod:InternalInvoke(MonoMethod, Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
UnityEditor.HostView:Invoke(String, Object) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:295)
UnityEditor.HostView:Invoke(String) (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:288)
UnityEditor.HostView:OldOnGUI() (at C:\buildslave\unity\build\Editor\Mono\HostView.cs:107)
UnityEngine.Experimental.UIElements.IMGUIContainer:smile:oOnGUI(Event) (at C:\buildslave\unity\build\Runtime\UIElements\Managed\IMGUIContainer.cs:182)
UnityEngine.Experimental.UIElements.IMGUIContainer:HandleIMGUIEvent(Event) (at C:\buildslave\unity\build\Runtime\UIElements\Managed\IMGUIContainer.cs:338)
UnityEngine.Experimental.UIElements.IMGUIContainer:HandleEvent(EventBase) (at C:\buildslave\unity\build\Runtime\UIElements\Managed\IMGUIContainer.cs:322)
UnityEngine.Experimental.UIElements.EventDispatcher:smile:ispatchEvent(EventBase, IPanel) (at C:\buildslave\unity\build\Runtime\UIElements\Managed\EventDispatcher.cs:250)
UnityEngine.Experimental.UIElements.UIElementsUtility:smile:oDispatch(BaseVisualElementPanel) (at C:\buildslave\unity\build\Runtime\UIElements\Managed\UIElementsUtility.cs:251)
UnityEngine.Experimental.UIElements.UIElementsUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Runtime\UIElements\Managed\UIElementsUtility.cs:78)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:\buildslave\unity\build\Runtime\IMGUI\Managed\GUIUtility.cs:175)

@Yury-Habets Are there any estimates when Unity is stable and usable? Should I try 2018.1 beta, or there are no chances build process is fixed there?

Is there anything else in the Editor.log which looks like it is related? I would hope Unity provides some additional information, as this error message is not actionable.

I see nothing like that.

That’s the issue.

I cannot upload log file via “Upload a File” button: “The uploaded file does not have an allowed extension. Editor-1.log”. Let me try Pastebin… https://pastebin.com/raw/E0Kb5ktL

Yeah, wow, that is not good. I have no idea what the problem is. Can you submit a bug report? We should at least determine why there is no actionable error reported.

1 Like

After some manipulations (like reimporting, removing Library/, restarting, etc.) I’ve got another log-file. The error is the same, no human-friendly message again, but contains more details somewhat related to IL2CPP. (Again: everything works fine in case of Mono+Android or IL2CPP+Editor; the problem reveals in case of IL2CPP+Android. If entry in link.xml is not added, then build is fine, but runtime error related to stripping arises.)

https://pastebin.com/raw/R5PiE6gt

For example:

il2cpp.exe didn't catch exception: Unity.IL2CPP.Building.BuilderFailedException: D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:26085:27: error: no viable conversion from 'BigInteger_t1403543702' to 'BigInteger_t1403543703'
                BigInteger_t1403543703  L_30 = ((Transaction_t125474940_StaticFields*)il2cpp_codegen_static_fields_for(Transaction_t125474940_il2cpp_TypeInfo_var))->get_DEFAULT_GAS_PRICE_0();
                                        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:8869:9: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'BigInteger_t1403543702' to 'const BigInteger_t1403543703 &' for 1st argument
struct  BigInteger_t1403543703
        ^
D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:26107:27: error: no viable conversion from 'BigInteger_t1403543702' to 'BigInteger_t1403543703'
                BigInteger_t1403543703  L_36 = ((Transaction_t125474940_StaticFields*)il2cpp_codegen_static_fields_for(Transaction_t125474940_il2cpp_TypeInfo_var))->get_DEFAULT_GAS_LIMIT_1();
                                        ^      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:8869:9: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'BigInteger_t1403543702' to 'const BigInteger_t1403543703 &' for 1st argument
struct  BigInteger_t1403543703
        ^
D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:26147:67: error: cannot initialize a parameter of type 'HexRPCType_1_t3727270449 *' with an lvalue of type 'HexBigInteger_t3583925460 *'
                BigInteger_t1403543703  L_51 = HexRPCType_1_get_Value_m78796562(L_50, /*hidden argument*/HexRPCType_1_get_Value_m78796562_RuntimeMethod_var);
                                                                                ^~~~
D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:15512:183: note: expanded from macro 'HexRPCType_1_get_Value_m78796562'
#define HexRPCType_1_get_Value_m78796562(__this, method) ((  BigInteger_t1403543703  (*) (HexRPCType_1_t3727270449 *, const RuntimeMethod*))HexRPCType_1_get_Value_m78796562_gshared)(__this, method)
                                                                                                                                                                                      ^~~~~~
D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:26149:95: error: cannot initialize a parameter of type 'HexRPCType_1_t3727270449 *' with an lvalue of type 'HexBigInteger_t3583925460 *'
                BigInteger_t1403543703  L_53 = HexRPCType_1_op_Implicit_m405091519(NULL /*static, unused*/, L_52, /*hidden argument*/HexRPCType_1_op_Implicit_m405091519_RuntimeMethod_var);
                                                                                                            ^~~~
D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:15514:281: note: expanded from macro 'HexRPCType_1_op_Implicit_m405091519'
#define HexRPCType_1_op_Implicit_m405091519(__this /* static, unused */, p0, method) ((  BigInteger_t1403543703  (*) (RuntimeObject * /* static, unused */, HexRPCType_1_t3727270449 *, const RuntimeMethod*))HexRPCType_1_op_Implicit_m405091519_gshared)(__this /* static, unused */, p0, method)
                                                                                                                                                                                                                                                                                        ^~
D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:26152:67: error: cannot initialize a parameter of type 'HexRPCType_1_t3727270449 *' with an lvalue of type 'HexBigInteger_t3583925460 *'
                BigInteger_t1403543703  L_55 = HexRPCType_1_get_Value_m78796562(L_54, /*hidden argument*/HexRPCType_1_get_Value_m78796562_RuntimeMethod_var);
                                                                                ^~~~
D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:15512:183: note: expanded from macro 'HexRPCType_1_get_Value_m78796562'
#define HexRPCType_1_get_Value_m78796562(__this, method) ((  BigInteger_t1403543703  (*) (HexRPCType_1_t3727270449 *, const RuntimeMethod*))HexRPCType_1_get_Value_m78796562_gshared)(__this, method)
                                                                                                                                                                                      ^~~~~~
D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:26155:67: error: cannot initialize a parameter of type 'HexRPCType_1_t3727270449 *' with an lvalue of type 'HexBigInteger_t3583925460 *'
                BigInteger_t1403543703  L_57 = HexRPCType_1_get_Value_m78796562(L_56, /*hidden argument*/HexRPCType_1_get_Value_m78796562_RuntimeMethod_var);
                                                                                ^~~~
D:\Viktor\Projects\block-paper-scissors\bps-unity-client\Temp\StagingArea\Il2Cpp\il2cppOutput\Bulk_Nethereum.Unity_0.cpp:15512:183: note: expanded from macro 'HexRPCType_1_get_Value_m78796562'
#define HexRPCType_1_get_Value_m78796562(__this, method) ((  BigInteger_t1403543703  (*) (HexRPCType_1_t3727270449 *, const RuntimeMethod*))HexRPCType_1_get_Value_m78796562_gshared)(__this, method)

Ok, this makes some sense now. It looks like that assembly is causing some problem with IL2CPP. I think that this is a bug in IL2CPP, as it should never generate C++ code that fails to compile. Can you submit a bug report with this project?

1 Like

https://fogbugz.unity3d.com/default.asp?1002169_dgfv0vagd5osjk09

Looks like same types like BigInteger are compiled to different (hence incompatible) C++ types, depending on which assembly they are referenced from.

Please let me know if something becomes clear or workaround is found. Maybe the issue is fixed in newer versions; any ETA for Unity 2018 non-beta?

Thanks! We will let you know via the bug report about the status of this issue. I’m not sure when 2018.1 will be out of beta, sorry. I expect that we will back port a fix for this to at least 2017.3 as well though.

2 Likes