Building Ad-Hoc for iOS: MSB6002 command-line for the MTouch task is too long

FrancoisCholette.3424FrancoisCholette.3424 USMember ✭✭
edited May 2017 in Xamarin.iOS

Hi,

I'm trying to build a version of my application and I've been having issues for 2 weeks now.
I've broken it down to this error :

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(747,3): warning MSB6002: The command-line for the "MTouch" task is too long.Command-lines longer than 32000 characters are likely to fail. Try reducing the length of the command-line by breaking down the call to "MTouch" into multiple calls with fewer parameters per call.
MTOUCH : error MT2001: Could not link assemblies.

The MTOUCH command is over 40000 characters long, a bunch of them points to package dll I have linked in various projects, 150 or so dll for Xamarin.iOS.

I tried moving my solution to a shorter path (instead of /Users/USERNAME/developments/PROJECTNAME/, I created /devios/PROJECTNAME/) which brought me down to about 35000 or so.

Is there a way to split this build step into multiple commands or I have reached the maximum of DLL i can use in my solution ?

Here is a part of the command that is being shown in the build log :

/Library/Frameworks/Xamarin.iOS.framework/Versions/Current/bin/mtouch
--cache /devios/SOLUTIONNAME/src/PROJECTNAME.iOS/obj/iPhone/Ad-Hoc/mtouch-cache
--dev /devios/SOLUTIONNAME/src/PROJECTNAME.iOS/bin/iPhone/Ad-Hoc/PROJECTNAME.app
--executable PROJECTNAMEiOS
--sgen-conc
--linksdkonly
--sdkroot /Applications/Xcode.app/Contents/Developer
--sdk 10.2 --targetver 9.2 --http-message-handler=NSUrlSessionHandler
--abi=armv7+llvm,armv7s+llvm,arm64+llvm
--symbollist /devios/SOLUTIONNAME/src/PROJECTNAME.iOS/obj/iPhone/Ad-Hoc/mtouch-symbols.list
--dsym=no
--target-framework Xamarin.iOS,v1.0 /devios/SOLUTIONNAME/src/PROJECTNAME.iOS/bin/iPhone/Ad-Hoc/PROJECTNAMEiOS.exe -v -v

Answers

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @FrancoisCholette.3424,

    Wow, I've not come across that error before! I'm not sure you can tweak this since the IDE is generating the command based on your projects. I've reached out to the Xamarin.iOS team to see if they have suggestions.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @FrancoisCholette.3424,

    The team has suggested that we file a bug with the diagnostic build log. Please add -v -v -v -v to your Additional mtouch arguments in the iOS Build menu of your Property Properties/Options. Then, do a build and gather the text from the Build Output area of the Errors list. Save that to a text file and please attach it to a new bug on Bugzilla.

    Thanks!

  • Thanks, will do in a few minutes!

  • ddotmunchddotmunch DEMember ✭✭

    @FrancoisCholette.3424 did you open a new bug on Bugzilla? I've just been running into the same issue.

  • Something came up yesterday, haven't had the time yet, will do today

  • JordanHaferJordanHafer USMember

    We have the same issue with VS for Mac on our build server. We are unable to produce release builds. Is there a workaround, or has a fix been found?

  • KimJensenKimJensen USMember ✭✭

    We have the same issue with VS for Mac. Any work around?

  • ChrisThorpChrisThorp GBUniversity

    We have the same issue with VS for Mac. Like everyone else, tried making the command line shorter, but in the end it is what it is. We are also unable to build a release android version on our CI machines. This must be fixed

  • RyanWatsonRyanWatson USMember ✭✭✭

    Any solutions? I was having an "Unexpected Error" failure on Visual Studio 2017 15.3 so I switched to VS for Mac and still having the same failure. On my mac it is showing the same error and others are getting. I'm unable to do a release build.

  • JohnMillerJohnMiller USForum Administrator, Xamarin Team Xamurai

    @ChrisThorp, @RyanWatson,

    Can you provide a diagnostic build output and confirm what error you are getting? The command line limit on macOS is 250K so that warning might be a red herring. The actual error preventing a build from succeeding should be capture in a diagnostic output.

    To enable diagnostic MSBuild output: https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output

    For iOS projects, add -v -v -v -v to the "Additional mtouch arguments" textbox in the iOS Build menu of the Project Properties menu before rebuilding.

  • RyanWatsonRyanWatson USMember ✭✭✭

    @JohnMiller said:
    @ChrisThorp, @RyanWatson,

    Can you provide a diagnostic build output and confirm what error you are getting? The command line limit on macOS is 250K so that warning might be a red herring. The actual error preventing a build from succeeding should be capture in a diagnostic output.

    To enable diagnostic MSBuild output: https://developer.xamarin.com/guides/android/troubleshooting/troubleshooting/#Diagnostic_MSBuild_Output

    For iOS projects, add -v -v -v -v to the "Additional mtouch arguments" textbox in the iOS Build menu of the Project Properties menu before rebuilding.

    I ended up shorting a lot of my paths to finally get that error to go away. (not ideal, but it got that error to go.) My actual error ended up being something with Linking. I made a post here with more information. I turned off linking and was able to build, but not sure if that was the correct solution:

    https://forums.xamarin.com/discussion/101666/unable-to-build-distribution-version-of-my-app-mt0000-unexpected-error#latest

  • mbalsam_nycmbalsam_nyc USMember ✭✭

    Any update on this???

  • mbalsam_nycmbalsam_nyc USMember ✭✭

    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(777,3): warning MSB6002: The command-line for the "MTouch" task is too long. Command-lines longer than 32000 characters are likely to fail. Try reducing the length of the command-line by breaking down the call to "MTouch" into multiple calls with fewer parameters per call.
    MTOUCH : error MT2001: Could not link assemblies. Reason: Object reference not set to an instance of an object

  • TheGreatOneTheGreatOne USMember ✭✭

    Same issue when trying to build for archive.

    Xamarin.iOS,v1.0 "/Users/my user/mobile projects app/my project app/MyAppProject Xamarin Forms/iOS/bin/iPhone/Release/MyAppProject.iOS.exe"
    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(777,3): warning MSB6002: The command-line for the "MTouch" task is too long. Command-lines longer than 32000 characters are likely to fail. Try reducing the length of the command-line by breaking down the call to "MTouch" into multiple calls with fewer parameters per call.
    Process exited with code 1, command:

  • MatthewWaring.4722MatthewWaring.4722 GBUniversity ✭✭

    Hi, getting this warning for IOS build, its not stopping me building, but thought would mention -

    /Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets(3,3): Warning MSB6002: The command-line for the "MTouch" task is too long. Command-lines longer than 32000 characters are likely to fail. Try reducing the length of the command-line by breaking down the call to "MTouch" into multiple calls with fewer parameters per call. (MSB6002) (biid.sdk.core.xamarin.xunit.ios)

    Will send diagnostics if that will help fix it.

    Thanks

  • stephenfosterstephenfoster USMember ✭✭

    Any word on this?

Sign In or Register to comment.