Deploy application on the device
There is Compilation error when I start deploying.
I've cleaned the solution, deleted both 'bin' and 'obj' folders, along with the '/Users/MyUser/Library/Caches/Xamarin' whole folder on the mac.
And there is still below compilation error occured: Could not compile the file(s) '/Users/MyUser/Library/Caches/Xamarin/mtbs/builds/MyProject.iOS/88a37a8ff8359042479f20abe19eb7ae/obj/iPhone/Debug/mtouch-cache/armv7/Xamarin.iOS.dll.s'. Please file a bug report at http://bugzilla.xamarin.com
There is no problem with debugging on ios simulators.
`Microsoft Visual Studio Professional 2017
Version 15.9.10
VisualStudio.15.Release/15.9.10+28307.557
Microsoft .NET Framework
Version 4.7.03056
Installed Version: Professional
Application Insights Tools for Visual Studio Package 8.14.20131.1
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2017 15.9.04012.0
ASP.NET and Web Tools 2017
ASP.NET Core Razor Language Services 15.8.31590
Provides languages services for ASP.NET Core Razor.
ASP.NET Web Frameworks and Tools 2017 5.2.60913.0
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 15.9.03024.0
Azure App Service Tools v3.0.0
Azure Functions and Web Jobs Tools 15.9.02046.0
Azure Functions and Web Jobs Tools
C# Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Extensibility Message Bus 1.1.49 (remotes/origin/d15-8@ee674f3)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.
JavaScript Language Service 2.0
JavaScript Language Service
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.0.0
Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 1.0
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual Studio Tools for Containers 1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Mono Debugging for Visual Studio 4.13.12-pre (9bc9548)
Support for debugging Mono processes with Visual Studio.
NuGet Package Manager 4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
ResourcePackage Extension 1.0
ResourcePackage Visual Studio Extension Detailed Info
SQL Server Data Tools 15.1.61903.01040
Microsoft SQL Server Data Tools
TypeScript Tools 15.9.20918.2001
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 10.2 for F# 4.5 15.8.0.0. Commit Hash: 6e26c5bacc8c4201e962f5bdde0a177f82f88691.
Microsoft Visual F# Tools 10.2 for F# 4.5
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
VisualStudio.Mac 1.0
Mac Extension for Visual Studio
Xamarin 4.12.3.81 (d15-9@780082716)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Designer 4.16.13 (45a16efd4)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.
Xamarin Templates 1.1.128 (6f5ebb2)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.
Xamarin.Android SDK 9.1.7.0 (HEAD/ba9da7a76)
Xamarin.Android Reference Assemblies and MSBuild support.
Xamarin.iOS and Xamarin.Mac SDK 12.2.1.16 (2dc06c7)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
`Xcode Version 10.2(10E125)
Severity Code Description Project File Line Suppression State
Error Could not compile the file(s) '/Users/MyUser/Library/Caches/Xamarin/mtbs/builds/MyProject.iOS/88a37a8ff8359042479f20abe19eb7ae/obj/iPhone/Debug/mtouch-cache/armv7/Xamarin.iOS.dll.s'. Please file a bug report at http://bugzilla.xamarin.com MyProject.iOS
This is the output & the Xamarin.iOS.dll file
LogFile&dll.zip
Thanks for the report. We'll need more details to investigate the issue. Please attach the
Xamarin.iOS.dll.s file from the cacheAlso experiencing this exact issue. Ive removed username and app name from the text below.
"Could not compile the file(s) '/Users/{macbookLoginUserNameHere}/Library/Caches/Xamarin/mtbs/builds/{myAppName}.iOS/553d53d741420ddbef87660700ae0ba6/obj/iPhone/Debug/mtouch-cache/armv7/Xamarin.iOS.dll.s'.
Please file a bug report at http://bugzilla.xamarin.com
My Error log points to a line number in Xamarin.iOs.dll.s:
C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\iOSXamarin.iOS.Common.targets 795
@OneBodyBlame no, that's the line number of the Xamarin.iOS.Common.targets (msbuild) that reported the error. It tells us nothing about what was inside Xamarin.iOS.dll.s.
Cool, just trying to give as much info as I can.
Edit: I only get this error with 'Linker Behavior: Dont Link'. The app builds correctly if I have it set to 'Link Framework SDKs Only'
I have the same issue. It started to fail after I updated VS studio on WIndows/Mac. @mariela111 updated the ticket with logs and etc. I see the same error messages in my build log too. @spouliot , do you need any other information?
@LGFox a test project we can use to reproduce this would be very nice. We _might_ be able to figure it out with just the full build log + the complete Xamarin.iOS.dll.s file the error message is complaining about, but a complete test project is better.
Thanks @rolfbjarne, @spouliot.
I run the "Debug|iPhone" configuration (iPhone7 Plus device) on Windows VS 15.9.10 and VS for Mac 7.8.3.
Test project: xam.ios5815
It throws the same "can not encode offset '...' in resulting scattered relocation" exception during the build stage.
At the same time, the @bsander88 's workaround works for me.
The can not encode offset '...' in resulting scattered relocation error means the 32-bit slice of the executable is too big (it hits a limitation in the Mach-O file format).
Possible workarounds:
Thanks @rolfbjarne! Workarounds # 1 and # 2 work for me either. But before I updated VS and XCode, everything worked without any workarounds. I don't know if the problem is in Xamarin.iOS, Visual studio or XCode. Before I updated everything, I had XCode 10.1 and Visual studio for Mac 7.7.4.
@LGFox it's possible you were very close to the size limit before, and then something in the update made your app surpass it.
VS2017 pro- 15.19.10 - XamForms 3.0.0.530893 See Logs Attached...
I was having the same error (4/3/2019)...coming to leave the bug with full logs. I saw #1 and #2 work around above so i tried #1 and it deployed to the device but crashed on startup. So then i tried #2 which worked fine. Then i thought let me get you the full logs to see if that's helpful for others, so i put it back to both ARMv7 & ARM64 and Don't Link. and of course now it builds fine...
outputlog.txt
i tried #1 and it deployed to the device but crashed on startup
You selected arm64 only and that made it crash on startup? That shouldn't happen (assuming you're trying to run on a 64-bit device). If you're willing to drop 32-bit support, you should look into this again (it will cut your device build times a lot, close to half in some cases) - my guess is that there were previous build artifacts around that caused things to go sideways, so if you try again, make sure to clean the solution and manually remove the app from the device first.
So then i tried #2 which worked fine.
Great :smile:
now it builds fine...
outputlog.txt
No, it didn't:
.../mtouch-cache/armv7/Xamarin.iOS.dll.s:3293391:8: error: can not encode offset '0x10ADCF8' in resulting scattered relocation. (TaskId:164)
.long mono_aot_Xamarin_iOS_got - . + 265320,1470437 (TaskId:164)
^ (TaskId:164)
...
error MT5106: Could not compile the file(s) '.../mtouch-cache/armv7/Xamarin.iOS.dll.s'. Please file a bug report at http://bugzilla.xamarin.com
which is the 32-bit size limitation in the Mach-O file format.
It did work fine (after the steps i explained above). That output i provided was the OLDER log (which i provided in case it helps solve the initial error/bug). So as of now it builds and works fine with don't link and armv7AND arm64...
@Amd3202, probably, you should try to clean solution to break it again... ))))
Anyway, I just tried brand new VS 2019: works for me again as it was, without any workarounds. The test project (xam.ios5815) works in VS2019 too.
@LGFox thanks i did jsut to test and didn't break, i both cleaned and restarted VS (didnt restart the mac). i'm not sure we're ready to go to VS19 yet but i'll try to make that happen over the next few months.
In my case the solution is to set both 'Link Framework SDKs Only' and 'ARMv7 + ARM64'.
All other setup of the configurations gave me the described error.
I'm closing this since it seems all occurrences of the problem is due to the 32-bit size limitation in the Mach-O file format as described in a previous comment.
If the issue still occurs after trying the workarounds in https://github.com/xamarin/xamarin-macios/issues/5815#issuecomment-478930656, please open a new bug (since it's probably a different issue), and attach the complete build log.
In my case the solution is to set both 'Link Framework SDKs Only' and 'ARMv7 + ARM64'.
All other setup of the configurations gave me the described error.
This the best solution for non 64 bit cpus
Most helpful comment
The
can not encode offset '...' in resulting scattered relocationerror means the 32-bit slice of the executable is too big (it hits a limitation in the Mach-O file format).Possible workarounds: