[ITK] Win64 SimpleITK build error: NMAKE : fatal error U1095 (command line too long)

Philip Semanchuk ond at semanchuk.com
Fri Aug 14 10:30:48 EDT 2015


Thanks Andras for the tip about CMAKE_CACHE_ARGS and to Brad for the tip about Ninja. I doubt that this is the last time I’ll run into problems with overly-long command lines on Windows so it’s nice to have a variety of techniques to deal with the problem in the future.

Cheers
Philip

> On Aug 14, 2015, at 9:42 AM, Andras Lasso <lasso at queensu.ca> wrote:
> 
> Instead of commenting out the variable value passing, use CMAKE_CACHE_ARGS instead of CMAKE_ARGS.
> 
> CMAKE_ARGS can be used for passing any command-line arguments, but it uses the command line, so length limitations apply.
> 
> In contrast, CMAKE_CACHE_ARGS uses a file to pass variable values, so there is no limitation on the number or length of variables.
> 
> Andras
> 
> 
> -----Original Message-----
> From: Community [mailto:community-bounces at itk.org] On Behalf Of Philip Semanchuk
> Sent: August 14, 2015 8:03 AM
> To: Bradley Lowekamp <blowekamp at mail.nih.gov>
> Cc: community at itk.org
> Subject: Re: [ITK] Win64 SimpleITK build error: NMAKE : fatal error U1095 (command line too long)
> 
> 	
>> On Aug 13, 2015, at 12:36 PM, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
>> 
>> OK,
>> 
>> Your Visual Studio should be based on VS 2008 then.
>> 
>> You could try commenting out this line:
>> https://github.com/SimpleITK/SimpleITK/blob/1b1745da326bbb67e1752b3edbde344d15712032/SuperBuild/SuperBuild.cmake#L359
>> 
>> The will remove passing all the language variables on the command line to the SimpleITK sub-project. But they will still be in the initial CMakeCache. This will remove the ability to update the variables in the sub project from the super build. 
> 
> That worked! Thanks very much for your help.
> 
> Cheers
> Philip
> 
> 
> 
> 
>> 
>> I'll investigate further, to determine if there is a better long-term solution.
>> 
>> HTH,
>> Brad
>> 
>> On Aug 13, 2015, at 12:19 PM, Philip Semanchuk <ond at semanchuk.com> wrote:
>> 
>>> 
>>>> On Aug 13, 2015, at 11:53 AM, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
>>>> 
>>>> Hello,
>>>> 
>>>> What version of CMake and Visual Studio are you using?
>>> 
>>> CMake 3.3.0. I'm using Microsoft Visual C++ for Python 2.7. That's not Visual Studio - it's not an IDE. It's just a compiler, specifically a repackaged version of the compiler that came with Visual C++ 2008. 
>>> 
>>> 
>>>> What is your build and source path?
>>> 
>>> Build path is c:\Users\me\sitkb
>>> Source path is C:\Users\me\SimpleITK-0.9.0
>>> 
>>> 
>>>> Also know which Super build target that's causing the problem would be helpful too.
>>> 
>>> The U1095 error comes here:
>>> [ 84%] Performing configure step for 'SimpleITK'
>>> 
>>> 
>>>> 
>>>> Try have having your build and your source in a really short paths like "C:/b/SimpleITK" and "C:/b/bld".
>>> 
>>> Thanks for the suggestion. I'm aware that long paths can contribute to overly-long command lines (I've run into that problem earlier in this build process). I don't think they're the culprits here, though. 
>>> 
>>> The problem IMHO is that there are 105 variables being passed on the command line via -D (e.g. MAKE COMMAND, CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO, Java_JAVAC_EXECUTABLE, CSHARP_COMPILER, etc.), a lot of them containing paths that I don't control (e.g. lots of references to "C:/Program Files (x86)"). 
>>> 
>>> If I paste the offending command into a text editor and search/replace my build and source paths with the shortest possible versions I can use, the command is still 5179 characters long. I think whatever buffer is getting blown out by a 5400 character command is still going to get blown out by a 5179 character command. 
>>> 
>>> Thanks for your willingness to help. I appreciate it!
>>> 
>>> Philip
>>> 
>>> 
>>>> 
>>>> On Aug 13, 2015, at 11:22 AM, Philip Semanchuk <ond at semanchuk.com> wrote:
>>>> 
>>>>> Hi, 
>>>>> I'm new to CMake and SimpleITK, and I'm trying to use the former to build a 64-bit version of the latter on Windows 7 with Microsoft Visual C++ for Python 2.7. I'm using the "SuperBuild" instructions from here:
>>>>> http://www.itk.org/Wiki/SimpleITK/GettingStarted#Build_It_Yourself
>>>>> 
>>>>> I'm running into a problem where a build.make file creates a shell command that's almost 5400 characters long. This leads to:
>>>>> NMAKE : fatal error U1095: expanded command line [blah blah blah x 5400] too long
>>>>> 
>>>>> The root cause of the problem is that all of the CMake config variables are being passed on the command line (e.g,. -DCMAKE_BUILD_TYPE:STRING=RELEASE -DCMAKE_MAKE_PROGRAM:STRING=nmake etc.).
>>>>> 
>>>>> Since I'm new to CMake and SimpleITK, I'm a little lost as to where I should look to resolve this problem, but my hunch is that I should start with SimpleITK. If I'm in the wrong place, would someone be kind enough to guide me elsewhere?
>>>>> 
>>>>> I can post my build config and steps if that would help. 
>>>>> 
>>>>> Thanks
>>>>> Philip
>>>>> _______________________________________________
>>>>> Community mailing list
>>>>> Community at itk.org
>>>>> http://public.kitware.com/mailman/listinfo/community
>>>> 
>>> 
>> 
> 
> _______________________________________________
> Community mailing list
> Community at itk.org
> http://public.kitware.com/mailman/listinfo/community



More information about the Community mailing list