Bug 15622 - copying read only binary causes build to fail
Summary: copying read only binary causes build to fail
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools ()
Version: 7.0.3.x
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Rolf Bjarne Kvinge [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2013-10-23 11:23 UTC by Neil Pepper
Modified: 2013-10-25 08:15 UTC (History)
4 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Neil Pepper 2013-10-23 11:23:54 UTC
We have various binary files .dll that are checked into the source control and included as a reference in monotouch project, as they made read only by the source control system, when they first copy across it copies the read only flag but builds, 2nd time you build it gives an error as readonly file cannot be copied over. This didnt used to be a problem, started probably 2-3 months ago , causing us to clean before every build. Doesnt seem to be problem with assets which will  have same readonly flag. Exapmple of error below :-



Error MT1009: Could not copy the assembly '/Users/mannyvw/dev/tesco/TescoApps-WIP/AppLibraries/iOS/External/References/IQEngine.dll' to '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/IQEngine.dll': Access to the path "/Users/mannyvw/dev/tesco/TescoApps-WIP/AppLibraries/iOS/External/References/IQEngine.dll" or "/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/IQEngine.dll" is denied. (MT1009) (SAYS)
Comment 1 Sebastien Pouliot 2013-10-23 13:33:09 UTC
I'm pretty sure this was fixed recently. Are you sure you're using 7.0.3 (alpha) ?

Just to be sure please confirm the versions for all the Xamarin software you're using.

The easiest way to get exact version information is to use the "Xamarin Studio" menu, "About Xamarin Studio" item, "Show Details" button and copy/paste the version informations (you can use the "Copy Information" button).
Comment 2 Neil Pepper 2013-10-24 05:37:57 UTC
Not running the alpha channel, so was on 7.0.2.7, have just switched to the alpha channel to check and it still seems to be an issue on 7.0.3.213, although the error has changed

error MT2001: Could not link assemblies. Reason: Access to the path "/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/IQEngine.dll" or "/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/PreBuild/IQEngine.dll" is denied.

still have to clean every time :(

thanks
Comment 3 Rolf Bjarne Kvinge [MSFT] 2013-10-25 05:18:16 UTC
Can you add "-v -v -v -v" (without the quotes) to the additional mtouch arguments in the project's iOS Build options, rebuild, and attach the full build output?
Comment 4 Neil Pepper 2013-10-25 06:25:26 UTC
Sure here you go, seems to just do it when building now when building for device. thanks



Building: Revision (Debug)

Build started 25/10/2013 11:23:50.
__________________________________________________
Project "/Users/mannyvw/dev/tesco/SAYS/Revision/Revision.csproj" (Build target(s)):
	
	Target PrepareForBuild:
		Configuration: Debug Platform: AnyCPU
	
	Target GenerateSatelliteAssemblies:
	No input files were specified for target GenerateSatelliteAssemblies, skipping.
	
	Target GenerateBindings:
	Skipping target "GenerateBindings" because its outputs are up-to-date.
	
	Target GenerateTargetFrameworkMonikerAttribute:
	Skipping target "GenerateTargetFrameworkMonikerAttribute" because its outputs are up-to-date.
	
	Target CoreCompile:
	Skipping target "CoreCompile" because its outputs are up-to-date.
Done building project "/Users/mannyvw/dev/tesco/SAYS/Revision/Revision.csproj".

Build succeeded.
	 0 Warning(s)

Building: SAYS (Debug|iPhone)

Detecting signing identity...
Multiple provisioning profiles match the bundle identifier; using the first match.
  1. Provisioning Profile: "Tesco Apps Dev" (07E2C321-AFD7-4DF0-82EF-4096B608443C)
     Signing Identity: "iPhone Developer: Neil Pepper (HNK6H9F94X)"
  2. Provisioning Profile: "TescoNewGroceryDevProvision" (D9CDFB19-A412-44BA-90D1-2211BB262469)
     Signing Identity: "iPhone Developer: Kishan S (8XKS7Y435T)"
Provisioning Profile: "Tesco Apps Dev" (07E2C321-AFD7-4DF0-82EF-4096B608443C)
Signing Identity: "iPhone Developer: Neil Pepper (HNK6H9F94X)"
App ID: "E66MK6GV6M.com.tesco.SAYS"
Performing main compilation...
/Library/Frameworks/Mono.framework/Versions/3.2.3/bin/mcs /noconfig "/r:/Developer/MonoTouch/usr/lib/mono/2.1/mscorlib.dll" -nostdlib "/out:/Users/mannyvw/dev/tesco/SAYS/SAYS/bin/iPhone/Debug/SAYS.exe" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" "/r:/Users/mannyvw/dev/tesco/TescoApps-WIP/AppLibraries/iOS/External/References/IQEngine.dll" "/r:/Users/mannyvw/dev/tesco/SAYS/Revision/bin/Debug/Revision.dll" "/r:/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" /nologo /warn:4 /debug:full /optimize- /codepage:utf8 "/define:DEBUG;__MOBILE__;__IOS__"  /t:exe "/Users/mannyvw/dev/tesco/SAYS/SAYS/Main.cs" "/Users/mannyvw/dev/tesco/SAYS/SAYS/AppDelegate.cs" "/Users/mannyvw/dev/tesco/SAYS/SAYS/MainViewController.cs" "/Users/mannyvw/dev/tesco/SAYS/SAYS/MainViewController.designer.cs" "/Users/mannyvw/dev/tesco/SAYS/SAYS/ScanViewController.cs" "/Users/mannyvw/dev/tesco/SAYS/SAYS/ScanViewController.designer.cs" 
Compilation succeeded - 1 warning(s)

/Users/mannyvw/dev/tesco/SAYS/SAYS/MainViewController.cs(12,21): warning CS0414: The private field `SAYS.MainViewController.shopStarted' is assigned but its value is never used


Build complete -- 0 errors, 1 warning

Compiling to native code
/Developer/MonoTouch/usr/bin/mtouch -sdkroot "/Applications/Xcode.app/Contents/Developer" --cache "/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache" --nomanifest --nosign -dev "/Users/mannyvw/dev/tesco/SAYS/SAYS/bin/iPhone/Debug/SAYS.app" -r "/Users/mannyvw/dev/tesco/SAYS/Revision/bin/Debug/Revision.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll" -r "/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll" -r "/Users/mannyvw/dev/tesco/TescoApps-WIP/AppLibraries/iOS/External/References/IQEngine.dll" -debug -linksdkonly -sdk "7.0" -targetver "6.0" --abi=armv7 "-v" "-v" "-v" "-v" --gcc_flags "\"-dead_strip\"" "/Users/mannyvw/dev/tesco/SAYS/SAYS/bin/iPhone/Debug/SAYS.exe"
Xamarin.iOS 7.0.3.213 (cea17d0) Priority Edition using framework: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk
Prerequisite '/Developer/MonoTouch/usr/bin/mtouch' is older than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/arguments'.
Prerequisite '/Users/mannyvw/dev/tesco/SAYS/Revision/bin/Debug/Revision.dll' is older than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/libSelfscan.a'.
Target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/libSelfscan.a' is up-to-date.
Prerequisite '/Users/mannyvw/dev/tesco/TescoApps-WIP/AppLibraries/iOS/External/References/IQEngine.dll' is older than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/libIQEngine.a'.
Target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/libIQEngine.a' is up-to-date.
Prerequisite '/Users/mannyvw/dev/tesco/TescoApps-WIP/AppLibraries/iOS/External/References/IQEngine.dll' is older than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/libIQEnginesLocal.a'.
Target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/libIQEnginesLocal.a' is up-to-date.
Prerequisite '/Users/mannyvw/dev/tesco/SAYS/SAYS/bin/iPhone/Debug/SAYS.exe' is newer than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/SAYS.exe'.
Prerequisite '/Developer/MonoTouch/usr/lib/mono/2.1/monotouch.dll' is older than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/monotouch.dll'.
Prerequisite '/Developer/MonoTouch/usr/lib/mono/2.1/mscorlib.dll' is older than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/mscorlib.dll'.
Prerequisite '/Developer/MonoTouch/usr/lib/mono/2.1/System.dll' is older than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/System.dll'.
Prerequisite '/Developer/MonoTouch/usr/lib/mono/2.1/System.Core.dll' is older than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/System.Core.dll'.
Prerequisite '/Developer/MonoTouch/usr/lib/mono/2.1/System.Xml.dll' is older than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/System.Xml.dll'.
Prerequisite '/Users/mannyvw/dev/tesco/SAYS/Revision/bin/Debug/Revision.dll' is older than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/Revision.dll'.
Prerequisite '/Users/mannyvw/dev/tesco/TescoApps-WIP/AppLibraries/iOS/External/References/IQEngine.dll' is older than the target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/IQEngine.dll'.
Prerequisite '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/SAYS.exe' is newer than target '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/PreBuild/SAYS.exe' (25/10/2013 10:22:50 vs 25/10/2013 10:21:20).
Loaded '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/SAYS.exe'
Loaded '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/monotouch.dll'
Loaded '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/mscorlib.dll'
Loaded '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/System.dll'
Loaded '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/System.Core.dll'
Loaded '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/System.Xml.dll'
Loaded '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/Revision.dll'
Loaded '/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/IQEngine.dll'
Linking SDK only for assembly /Users/mannyvw/dev/tesco/SAYS/SAYS/bin/iPhone/Debug/SAYS.exe into /Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/PreBuild
error MT2001: Could not link assemblies. Reason: Access to the path "/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/IQEngine.dll" or "/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/PreBuild/IQEngine.dll" is denied.
--- inner exception
System.UnauthorizedAccessException: Access to the path "/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/Link/IQEngine.dll" or "/Users/mannyvw/dev/tesco/SAYS/SAYS/obj/iPhone/Debug/mtouch-cache/PreBuild/IQEngine.dll" is denied.
  at System.IO.File.Copy (System.String sourceFileName, System.String destFileName, Boolean overwrite) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.OutputStep.CopyAssembly (System.IO.FileInfo fi, System.String directory, Boolean symbols) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.OutputStep.OutputAssembly (Mono.Cecil.AssemblyDefinition assembly) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.OutputStep.ProcessAssembly (Mono.Cecil.AssemblyDefinition assembly) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Steps.BaseStep.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0 
  at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00000] in <filename unknown>:0 
  at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, Mono.Linker.LinkContext& context, System.Collections.Generic.List`1& assemblies) [0x00000] in <filename unknown>:0 
---
  at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, Mono.Linker.LinkContext& context, System.Collections.Generic.List`1& assemblies) [0x00000] in <filename unknown>:0 
  at MTouch.LinkAssemblies (System.String main, System.Collections.Generic.List`1& assemblies, System.String output_dir, Mono.Linker.LinkContext& link_context) [0x00000] in <filename unknown>:0 
  at MonoTouch.Application.ManagedLink () [0x00000] in <filename unknown>:0 
  at MonoTouch.Application.ProcessAssemblies () [0x00000] in <filename unknown>:0 
  at MonoTouch.Application.BuildApp () [0x00000] in <filename unknown>:0 
  at MonoTouch.Application.Build () [0x00000] in <filename unknown>:0 
  at MTouch.Main2 (System.String[] args) [0x00000] in <filename unknown>:0 
  at MTouch.Main (System.String[] args) [0x00000] in <filename unknown>:0 

---------------------- Done ----------------------

Build: 1 error, 1 warning
Comment 5 Rolf Bjarne Kvinge [MSFT] 2013-10-25 07:48:48 UTC
I think I know what's happening: can you turn off the managed linker (set Linker Behavior to 'Don't link' in the project's iOS Build options) and see if that makes the project build? This is just to confirm my theory, you can return the linker setting to its previous value afterwards.
Comment 6 Neil Pepper 2013-10-25 07:54:45 UTC
Just done that, yep seems to be complete now without any errors

Anything else you want me to try let me know, thanks. neil
Comment 7 Rolf Bjarne Kvinge [MSFT] 2013-10-25 08:15:10 UTC
Fixed.

monotouch/master: cb6a0a45acfd3a40488691512e284f9fbdd70527

I believe you can work around it in the meantime by adding a custom post-build command (in the project's Build/Custom Commands options) which adds the write-flag to all dlls in the mtouch-cache directory (untested, you might have to modify the path to the dlls).

  chmod u+x ${ProjectDir}/*/*/*/mtouch-cache/*/*.dll