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

Andras Lasso lasso at queensu.ca
Fri Aug 14 11:05:10 EDT 2015


Thanks for the explanation. I didn't know that -C is for initial configuration only.

Command line length is limited on all operating systems (although on Windows it's shorter than most *nix, so problems appear first there). A possible solution to keep the current SimpleITK configuration mechanism would be to use response files (pass command-line arguments through file) when running CMake. For this we would need to request this feature in CMake and then update ExternalProject_Add macro to use response file.

Andras
________________________________
From: Bradley Lowekamp<mailto:blowekamp at mail.nih.gov>
Sent: ‎2015-‎08-‎14 10:33
To: Andras Lasso<mailto:lasso at queensu.ca>; Jean-Christophe Fillion-Robin<mailto:jchris.fillionr at kitware.com>
Cc: Philip Semanchuk<mailto:ond at semanchuk.com>; community at itk.org<mailto:community at itk.org>
Subject: Re: [ITK] Win64 SimpleITK build error: NMAKE : fatal error U1095 (command line too long)

Hello Andas,

The comment out was a quick suggestion to get it working for his case.

Here is a commit in next to reduce the arguments passed [1].

The problem with the "Cache" file is that it's only used for the initial configuration of the sub-project (still correct? It's been a while since I tested). If there is a change to the top level configuration after the initial build then the sub-projects don't get the update values. And I don't like having to rebuild SimpleITK from scratch.

Currently we render the desired cmake variables to both the cache file and to the command line arguments [2].

SimpleITK's cache generator is better than the CMAKE_CACHE_ARGS because I only need to pass the CMake variable names, and then the function uses introspection to get the variable type AND the help string. With the number of language variables passed, it's critical to get the help information into the sub-project to give information on what the variable is suppose to be.

I would hate to give up the feature of being able to update the sub-projects' variable for a rebuild. But relaying sole on the Cache would do this. And the suggested patch just does that.

Thanks for the suggestions. If there is a better way to do this I certainly like to know.

Thanks,
Brad


[1] https://github.com/SimpleITK/SimpleITK/commit/dd3c4353773944194574473569da588d535d80f6
[2] https://github.com/SimpleITK/SimpleITK/blob/master/SuperBuild/SuperBuild.cmake#L333-L338


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20150814/6127daaa/attachment.html>


More information about the Community mailing list