Bug 56501 - MSB6002 command-line for MTouch task is too long, > 32000 characters
Summary: MSB6002 command-line for MTouch task is too long, > 32000 characters
Status: RESOLVED FIXED
Alias: None
Product: iOS
Classification: Xamarin
Component: MSBuild ()
Version: XI 10.8 (d15-1)
Hardware: Macintosh Mac OS
: Normal enhancement
Target Milestone: 15.8
Assignee: Vincent Dondain [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2017-05-16 14:38 UTC by Frank
Modified: 2018-03-05 17:03 UTC (History)
15 users (show)

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


Attachments
Build log (668.82 KB, text/plain)
2017-05-16 14:38 UTC, Frank
Details


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 Frank 2017-05-16 14:38:03 UTC
When I'm trying to build an Ad-Hoc version of my app, this error occurs :

/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.


Visual Studio Community 2017 for Mac
Version 7.0 (build 3146)
Installation UUID: d614f455-2845-46f7-ab92-84e2ec5972e5
Runtime:
Mono 5.0.0.100 (2017-02/9667aa6) (64-bit)
GTK+ 2.24.23 (Raleigh theme)

Package version: 500000100

NuGet
Version: 4.0.0.2323

.NET Core
Runtime: /usr/local/share/dotnet/dotnet
SDK: /usr/local/share/dotnet/sdk/1.0.3/Sdks
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.0.0/lib/mono/msbuild/15.0/bin/Sdks

Xamarin.Profiler
Version: 1.5.4
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

Xamarin.Android
Version: 7.3.0.13 (Visual Studio Community)
Android SDK: /Users/etlinfo/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
6.0 (API level 23)

SDK Tools Version: 25.1.2
SDK Platform Tools Version: 24.0.0
SDK Build Tools Version: 23.0.2

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

Apple Developer Tools
Xcode 8.2.1 (11766.1)
Build 8C1002

Xamarin.Mac
Version: 3.4.0.33 (Visual Studio Community)

Xamarin Inspector
Version: 1.2.2
Hash: b71b035
Branch: d15-1
Build date: Fri, 21 Apr 2017 17:57:12 GMT

Xamarin.iOS
Version: 10.10.0.33 (Visual Studio Community)
Hash: 3e5ac5ff
Branch: d15-2
Build date: 2017-05-05 18:11:38-0400

Build Information
Release ID: 700003146
Git revision: 7553fda2e327d15807298d444007896e5b975dba
Build date: 2017-05-09 12:12:36-04
Xamarin addins: c3d580752be79fc902422f1d55d1cdc2d8b98799
Build lane: monodevelop-lion-d15-2

Operating System
Mac OS X 10.11.6
Darwin 15.6.0 Darwin Kernel Version 15.6.0
    Mon Jan  9 23:07:29 PST 2017
    root:xnu-3248.60.11.2.1~1/RELEASE_X86_64 x86_64
Comment 1 Frank 2017-05-16 14:38:47 UTC
Created attachment 22205 [details]
Build log
Comment 2 Vincent Dondain [MSFT] 2017-05-16 14:47:31 UTC
I can confirm this bug from the logs, seems legit.

I believe the msbuild tasks could be updated to break down the command as suggested when it becomes too long (cc @rolf in case he sees something else):

"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."
Comment 3 Sebastien Pouliot 2017-05-16 15:52:17 UTC
@Frank, the warning is not related to the following mtouch 2001 error. The latter is a XF/xamlc issue -> https://bugzilla.xamarin.com/show_bug.cgi?id=56296

It's also a generic warning (from msbuild). The mtouch tool cannot be called multiple times to achieve the same result.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2017-05-16 16:16:49 UTC
The command line limit on macOS is ~250k ("getconf ARG_MAX" => 262144 bytes), so this warning can safely be ignored for now.

The fix is to support response-files in mtouch:

echo "-r:abc.dll" > foo.rsp
mtouch @foo.rsp

and then have the msbuild tasks create that response file and pass it to mtouch instead of listing everything on the command line.
Comment 5 Sebastien Pouliot 2017-05-16 20:34:19 UTC
+1 a response file would be a great addition (and not just for the limit).

But it's content needs to be included part of the bug logs or we will lose important information to debug customers issues.
Comment 6 Cliff Cawley 2017-06-05 03:45:09 UTC
+1 for this, I'm getting it on my build system too
Comment 7 Dominik Weber 2017-07-13 18:09:19 UTC
+1 for response files, I'm seeing this warning on the VSTS build agent. Currently my command line is about 47k
Comment 8 Rolf Bjarne Kvinge [MSFT] 2017-09-28 16:44:01 UTC
Step 1, support for response files, is in progress: https://github.com/xamarin/xamarin-macios/pull/2808
Comment 9 Rolf Bjarne Kvinge [MSFT] 2017-11-16 15:11:12 UTC
Step 1, support for response files, is now complete: https://github.com/xamarin/xamarin-macios/commit/e8d16c925bb74636366b00b5c6603514c94af763
Comment 10 Vincent Dondain [MSFT] 2018-03-01 16:32:40 UTC
Step 2, use a response file for references passed to mtouch is in progress:
https://github.com/xamarin/xamarin-macios/pull/3635