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

Andras Lasso lasso at queensu.ca
Thu Aug 13 13:40:39 EDT 2015


CMake uses a response file to pass parameters to the compiler to avoid any issues with limited command line length.

Unfortunately, it seems that CMake does not use files for passing parameters to CMake.exe for configuring external projects. This should be probably fixed in CMake (add support for response files in CMake.exe and use that in ExternalProject).

Also, CMake cannot do anything about custom commands, so if you create a custom command that may construct a long command line then it'll eventually fail (see for example "random" Python wrapping issues here: https://github.com/commontk/CTK/issues/525#issuecomment-67269513).

You should be able to see in the build log or the generated .vcproj file if the long command line is generated by CMake's ExternalProject or by some other add_custom_command.

Andras

-----Original Message-----
From: Community [mailto:community-bounces at itk.org] On Behalf Of Bradley Lowekamp
Sent: Thursday, August 13, 2015 12:37 PM
To: Philip Semanchuk <ond at semanchuk.com>
Cc: community at itk.org
Subject: Re: [ITK] Win64 SimpleITK build error: NMAKE : fatal error U1095 (command line too long)

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

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