-
Notifications
You must be signed in to change notification settings - Fork 533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to rebuild project with hybrid AOT enabled #1240
Comments
It looks like this error is happening before we IL-strip the assemblies, so it doesn't appear to be a build task ordering issue. |
Could you upload the tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/obj/Release directory ? |
@vargaz here's the intermediate output - https://microsoft-my.sharepoint.com/:u:/p/pecolli/EZcB-AYr2z5NlFocWnr_u1MBsJcXYNImuhgF8CSzqIsaVQ?e=ypELnj I'll try to remember to include this in the report for such issues in the future. |
Are you sure that is the correct obj dir ? I get a mscorlib version mismatch error: Corlib not in sync with this runtime: expected corlib version 1050800000, found 1050400003. 1050800000 is for mono 2.10, while 10504 is for an older version. |
The invalid IL messages all reference 'ret', which means the AOT compiler is ran on the IL stripped code. Also, the aot compiler command line references the 'shrunk' directory which seems to contain the IL stripped versions: MONO_PATH="/Users/xamarinqa/myagent/_work/r3/a/monodroid/external/xamarin-android/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/obj/Release/android/assets/shrunk" MONO_ENV_OPTIONS="" /Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin/cross-arm --llvm --aot=hybrid,outfile=/Users/xamarinqa/myagent/_work/r3/a/monodroid/external/xamarin-android/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/obj/Release/aot/armeabi/libaot-Java.Interop.dll.so,asmwriter,mtriple=armv5-linux-gnueabi,tool-prefix=/Users/xamarinqa/Library/Developer/Xamarin/android-sdk-macosx/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-,ld-flags=/Users/xamarinqa/Library/Developer/Xamarin/android-sdk-macosx/ndk-bundle/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/lib/gcc/arm-linux-androideabi/4.9.x/libgcc.a;/Users/xamarinqa/Library/Developer/Xamarin/android-sdk-macosx/ndk-bundle/platforms/android-9/arch-arm/usr/lib/libc.so;/Users/xamarinqa/Library/Developer/Xamarin/android-sdk-macosx/ndk-bundle/platforms/android-9/arch-arm/usr/lib/libm.so,llvm-path=/Library/Frameworks/Xamarin.Android.framework/Libraries/xbuild/Xamarin/Android/Darwin,temp-path=/Users/xamarinqa/myagent/_work/r3/a/monodroid/external/xamarin-android/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/obj/Release/aot/armeabi/Java.Interop.dll /Users/xamarinqa/myagent/_work/r3/a/monodroid/external/xamarin-android/tests/CodeGen-Binding/Xamarin.Android.JcwGen-Tests/obj/Release/android/assets/shrunk/Java.Interop.dll (TaskId:1362) |
@vargaz The local repro uploaded in the previous comment is from d15-5, the issue is reproducible both there and in d15-6. Should I upload another obj dir built against d15-6 or master? |
Not needed any more, I think |
@vargaz: I don't understand how it's the problem. The AOT compilation ends on line 317765 -- 146 lines before the IL strip. How are we attempting to AOT stripped assemblies when we don't execute the task to strip assemblies until after AOT runs? A plausible answer would be "the project is built multiple times, with the second build processing the stripped outputs of the first build." However, I see no evidence of that scenario in the log file. |
Does the 'shrunk' directory contain linker output files ? It could be a problem with the linker, i.e. it creates invalid il ? |
The input file contains stuff like this: .method public hidebysig static string which is not valid IL. |
The
Possible, but what's really weird is that the linker doesn't appear to be running: the @radekdoulik: Do you know why the assemblies used as input to AOT would appear to be invalid? |
This is still reproducible using XA d15.8 - 8.3.99.12 (monodroid/de662f58d). http://xqa.blob.core.windows.net/gist/log-8294c709d0bc4d099ae5273bb88bf162.txt |
@radekdoulik: Please take another look at this. |
I wasn't able to reproduce with XA master and d15.8 branch. Will try the monodroid/de662f58d |
OK, I am now able to reproduce with master. The steps are following:
It looks different to the original problem where aot-compiler reported errors. In my case I don't see aot-compiler errors, only CilStrip problem at the end of the log mentioned in #1240 (comment) From my build log:
|
Better repro, with aot-compiler errors as well:
Looks like build process error to me, where we try to AOT compile the already stripped assemblies in the second build. Linker doesn't even run as the output files are newer than input files. @dellis1972 could you take a look at this please? This is my command line to build the test with hybrid AOT |
ok I think there are a couple of problems here. The main on is that the
This then results is |
…tribute.cs Context dotnet#1240 As part of the build process MSBuild generates an `AssemblyAttribute.cs` class, such as MonoAndroid,Version=v9.0.AssemblyAttributes.cs This is the file which adds the `TargetFrameworkAttribute` to the assembly. While investigating dotnet#1240 I noticed that `_GenerateJavaStubs` was ALWAYS running, even on incremental builds with no changes. Digging into the build logs, `CoreCompile` was running because it thought one of the binding project assemblies was newer..? Digging in a bit more and I found this in the Binding Library build output on the `CoreCompile` target. Input file "/var/folders/n_/vt_nzq1n04schx5yy2jgcgcw0000gn/T/MonoAndroid,Version=v9.0.AssemblyAttributes.cs" is newer than output file "obj/Release/Xamarin.Android.McwGen-Tests.pdb". It turns out our binding targets were missing a few lines which exist in the common targets. These line set the `TargetFrameworkMonikerAssemblyAttributesPath` msbuild property to be located in the `$(IntermediateOutputPath)`. If this value is NOT set it turns out MSBuild defaults to dropping this file into a temp directory. That means it can be cleaned up at any point which will trigger a full build. :face_palm. So lets use the same few lines from the common targets to make sure we generate this file in our `$(IntermediateOutputPath)`. This stopped `_GenerateJavaStubs` from running when there were no changes (as expected). I updated one of our binding tests to check to make sure certain targets DO NOT run on an incremental build. Similar to what we do with our application targets.
…tribute.cs Context dotnet#1240 As part of the build process MSBuild generates an `AssemblyAttribute.cs` class, such as MonoAndroid,Version=v9.0.AssemblyAttributes.cs This is the file which adds the `TargetFrameworkAttribute` to the assembly. While investigating dotnet#1240 I noticed that `_GenerateJavaStubs` was ALWAYS running, even on incremental builds with no changes. Digging into the build logs, `CoreCompile` was running because it thought one of the binding project assemblies was newer..? Digging in a bit more and I found this in the Binding Library build output on the `CoreCompile` target. Input file "/var/folders/n_/vt_nzq1n04schx5yy2jgcgcw0000gn/T/MonoAndroid,Version=v9.0.AssemblyAttributes.cs" is newer than output file "obj/Release/Xamarin.Android.McwGen-Tests.pdb". It turns out our binding targets were missing a few lines which exist in the common targets. These line set the `TargetFrameworkMonikerAssemblyAttributesPath` msbuild property to be located in the `$(IntermediateOutputPath)`. If this value is NOT set it turns out MSBuild defaults to dropping this file into a temp directory. That means it can be cleaned up at any point which will trigger a full build. :face_palm. So lets use the same few lines from the common targets to make sure we generate this file in our `$(IntermediateOutputPath)`. This stopped `_GenerateJavaStubs` from running when there were no changes (as expected). I updated one of our binding tests to check to make sure certain targets DO NOT run on an incremental build. Similar to what we do with our application targets.
…tribute.cs (#3354) Context #1240 As part of the build process MSBuild generates an `AssemblyAttribute.cs` class, such as MonoAndroid,Version=v9.0.AssemblyAttributes.cs This is the file which adds the `TargetFrameworkAttribute` to the assembly. While investigating #1240 I noticed that `_GenerateJavaStubs` was ALWAYS running, even on incremental builds with no changes. Digging into the build logs, `CoreCompile` was running because it thought one of the binding project assemblies was newer..? Digging in a bit more and I found this in the Binding Library build output on the `CoreCompile` target. Input file "/var/folders/n_/vt_nzq1n04schx5yy2jgcgcw0000gn/T/MonoAndroid,Version=v9.0.AssemblyAttributes.cs" is newer than output file "obj/Release/Xamarin.Android.McwGen-Tests.pdb". It turns out our binding targets were missing a few lines which exist in the common targets. These line set the `TargetFrameworkMonikerAssemblyAttributesPath` msbuild property to be located in the `$(IntermediateOutputPath)`. If this value is NOT set it turns out MSBuild defaults to dropping this file into a temp directory. That means it can be cleaned up at any point which will trigger a full build. :face_palm. So lets use the same few lines from the common targets to make sure we generate this file in our `$(IntermediateOutputPath)`. This stopped `_GenerateJavaStubs` from running when there were no changes (as expected). I updated one of our binding tests to check to make sure certain targets DO NOT run on an incremental build. Similar to what we do with our application targets.
Fixes dotnet#1240 The `CilStrp` task was not able to handle being called incrementally. When called a second time the resulting error would be raised. error XA3001: System.IO.IOException: The file '/Users/dean/Projects/Foo5F/Foo/obj/Release/android/assets/non-stripped/Foo.dll' already exists. at System.IO.FileSystem.LinkOrCopyFile (System.String sourceFullPath, System.String destFullPath) [0x000b9] in <06589f46f7f64859943a6a461f88c56e>:0 at System.IO.FileSystem.MoveFile (System.String sourceFullPath, System.String destFullPath) [0x0003a] in <06589f46f7f64859943a6a461f88c56e>:0 at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00083] in <06589f46f7f64859943a6a461f88c56e>:0 at Xamarin.Android.Tasks.CilStrip.DoExecute () [0x000a8] in <fd1a3c6c66de470d989dd70ca1f91267>:0 at Xamarin.Android.Tasks.CilStrip.Execute () [0x00000] in <fd1a3c6c66de470d989dd70ca1f91267>:0 This commit make sure we do not try to strip an assembly if it has already been stripped. It also adds a new Unit Test to make sure the build system behaves as we expect.
Fixes dotnet#1240 The `CilStrp` task was not able to handle being called incrementally. When called a second time the resulting error would be raised. error XA3001: System.IO.IOException: The file '/Users/dean/Projects/Foo5F/Foo/obj/Release/android/assets/non-stripped/Foo.dll' already exists. at System.IO.FileSystem.LinkOrCopyFile (System.String sourceFullPath, System.String destFullPath) [0x000b9] in <06589f46f7f64859943a6a461f88c56e>:0 at System.IO.FileSystem.MoveFile (System.String sourceFullPath, System.String destFullPath) [0x0003a] in <06589f46f7f64859943a6a461f88c56e>:0 at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00083] in <06589f46f7f64859943a6a461f88c56e>:0 at Xamarin.Android.Tasks.CilStrip.DoExecute () [0x000a8] in <fd1a3c6c66de470d989dd70ca1f91267>:0 at Xamarin.Android.Tasks.CilStrip.Execute () [0x00000] in <fd1a3c6c66de470d989dd70ca1f91267>:0 This commit make sure we do not try to strip an assembly if it has already been stripped. It also adds a new Unit Test to make sure the build system behaves as we expect.
) Fixes: #1240 The `<CilStrip/>` task was not able to handle being called incrementally. When called a second time the resulting error would be raised. error XA3001: System.IO.IOException: The file '/Users/dean/Projects/Foo5F/Foo/obj/Release/android/assets/non-stripped/Foo.dll' already exists. at System.IO.FileSystem.LinkOrCopyFile (System.String sourceFullPath, System.String destFullPath) [0x000b9] in <06589f46f7f64859943a6a461f88c56e>:0 at System.IO.FileSystem.MoveFile (System.String sourceFullPath, System.String destFullPath) [0x0003a] in <06589f46f7f64859943a6a461f88c56e>:0 at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00083] in <06589f46f7f64859943a6a461f88c56e>:0 at Xamarin.Android.Tasks.CilStrip.DoExecute () [0x000a8] in <fd1a3c6c66de470d989dd70ca1f91267>:0 at Xamarin.Android.Tasks.CilStrip.Execute () [0x00000] in <fd1a3c6c66de470d989dd70ca1f91267>:0 This commit make sure we do not try to strip an assembly if it has already been stripped. It also adds a new Unit Test to make sure the build system behaves as we expect.
) Fixes: #1240 The `<CilStrip/>` task was not able to handle being called incrementally. When called a second time the resulting error would be raised. error XA3001: System.IO.IOException: The file '/Users/dean/Projects/Foo5F/Foo/obj/Release/android/assets/non-stripped/Foo.dll' already exists. at System.IO.FileSystem.LinkOrCopyFile (System.String sourceFullPath, System.String destFullPath) [0x000b9] in <06589f46f7f64859943a6a461f88c56e>:0 at System.IO.FileSystem.MoveFile (System.String sourceFullPath, System.String destFullPath) [0x0003a] in <06589f46f7f64859943a6a461f88c56e>:0 at System.IO.File.Move (System.String sourceFileName, System.String destFileName) [0x00083] in <06589f46f7f64859943a6a461f88c56e>:0 at Xamarin.Android.Tasks.CilStrip.DoExecute () [0x000a8] in <fd1a3c6c66de470d989dd70ca1f91267>:0 at Xamarin.Android.Tasks.CilStrip.Execute () [0x00000] in <fd1a3c6c66de470d989dd70ca1f91267>:0 This commit make sure we do not try to strip an assembly if it has already been stripped. It also adds a new Unit Test to make sure the build system behaves as we expect.
Release status update A new Preview version has now been published that includes the fix for this item. The fix is not yet included in a Release version. I will update this item again when a Release version is available that includes the fix. Fix included in Xamarin.Android 10.1.0.1. Fix included on Windows in Visual Studio 2019 version 16.4 Preview 2. To try the Preview version that includes the fix, check for the latest updates in Visual Studio Preview. Fix included on macOS in Visual Studio 2019 for Mac version 8.4 Preview 1. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel. |
Release status update A new Release version has now been published on Windows that includes the fix for this item. The fix is not yet published in a Release version on macOS. I will update this item again when a Release version is available on macOS that includes the fix. Fix included in Xamarin.Android 10.1.0.30. Fix included on Windows in Visual Studio 2019 version 16.4. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/. (Fix also included on macOS in Visual Studio 2019 for Mac version 8.4 Preview 2.1 and higher. To try the Preview version that includes the fix, check for the latest updates on the Preview updater channel.) |
Release status update A new Release version has now been published on macOS that includes the fix for this item. Fix included in Xamarin.Android 10.1.1.0. Fix included on macOS in Visual Studio 2019 for Mac version 8.4. To get the new version that includes the fix, check for the latest updates on the Stable updater channel. (Fix also included on Windows in Visual Studio 2019 version 16.4 and higher. To get the new version that includes the fix, check for the latest updates or install the latest version from https://visualstudio.microsoft.com/downloads/.) |
Steps to Reproduce
Expected Behavior
I'm able to compile and run any XA project with Hybrid AOT enabled.
Actual Behavior
Notice multiple errors coming from the aot task informing that methods can not be compiled successfully:
The build ultimately fails with
error XA3001: System.IO.IOException: Win32 IO returned ERROR_ALREADY_EXISTS.
during Xamarin.Android.Tasks.CilStrip.Execute.Version Information
https://gist.github.com/pjcollins/7d20f81013c7e00982c91340af2cf560
Log File
http://xqa.blob.core.windows.net/gist/log-63b871d9098d441d80a2838bb9fa2860.txt
The text was updated successfully, but these errors were encountered: