View Issue Details

IDProjectCategoryView StatusLast Update
0003157Slicer4Core: Building (CMake, Superbuild)public2018-03-02 11:01
Reporterlassoan Assigned Tojcfr  
PriorityhighSeveritymajorReproducibilityalways
Status closedResolutionwon't fix 
Product Version 
Target VersionSlicer 4.7.0Fixed in Version 
Summary0003157: SimpleITK build error on Windows for certain build path length
Description

When trying to build slicer in a build directory with 6 characters long (F:/S4R) then SimpleITK build fails with the error:

21>15>swig error : Unrecognized option -F:/S4R/ITKv4/Modules/IO/ImageBase/include
21>15>Use 'swig -help' for available options.
21>15>Project : error PRJ0019: A tool returned an error code from "Swig source to generate PYTHON wrapping"

21>Project : error PRJ0019: A tool returned an error code from "Performing build step for 'SimpleITK'"

Additional Information

The error is 100% reproducible, regardless of SimpleITK shared libraries enabled or not. The problem may be linked to the maximum command-line length.

The maximum command-line length is 8191 characters (http://support.microsoft.com/kb/830473) and the generated command (see below) is 9923 character long. Interestingly, the command is not truncated after 8191 characters, only one single character is deleted from the command line at the 8192nd position in the command parameters, which in my case is the ‘I’ character in -IF:/S4R/ITKv4... This character loss only results in a build error if it hits the '-' or the 'I' character, otherwise it’ll lead to just an incorrect additional include directory, which doesn’t cause a build error most of the time. So there is a 3-4% chance that a build error happens and the outcome only depends on the path names. The problem is the same with swigwin-2.0.10.

Note that the issue happens if you just run the command below from the command prompt, so it’s not related to Visual Studio or CMake, but probably caused by a bug in swig.


F:\S4R\swigwin-2.0.9\swig.exe -python -features autodoc=1 -keyword -outdir F:/S4R/SimpleITK-build/Wrapping -c++ -IF:/S4R/SimpleITK-build/Wrapping/ITKIOFactoryRegistration -IF:/S4R/ITKv4/Modules/Video/IO/include -IF:/S4R/ITKv4/Modules/Video/Filtering/include -IF:/S4R/ITKv4/Modules/Video/Core/include -IF:/S4R/ITKv4/Modules/Nonunit/Review/include -IF:/S4R/ITKv4/Modules/Registration/RegistrationMethodsv4/include -IF:/S4R/ITKv4/Modules/Registration/Metricsv4/include -IF:/S4R/ITKv4/Modules/Numerics/Optimizersv4/include -IF:/S4R/ITKv4/Modules/Segmentation/LevelSetsv4/include -IF:/S4R/ITKv4/Modules/Filtering/ImageFusion/include -IF:/S4R/ITKv4/Modules/IO/Mesh/include -IF:/S4R/ITKv4/Modules/IO/HDF5/include -IF:/S4R/ITKv4/Modules/IO/DCMTK/include -IF:/S4R/ITKv4/Modules/IO/CSV/include -IF:/S4R/ITKv4/Modules/Filtering/GPUThresholding/include -IF:/S4R/ITKv4/Modules/Filtering/GPUSmoothing/include -IF:/S4R/ITKv4/Modules/Registration/GPUPDEDeformable/include -IF:/S4R/ITKv4/Modules/Registration/GPUCommon/include -IF:/S4R/ITKv4/Modules/Filtering/GPUImageFilterBase/include -IF:/S4R/ITKv4/Modules/Filtering/GPUAnisotropicSmoothing/include -IF:/S4R/ITKv4/Modules/Core/GPUFiniteDifference/include -IF:/S4R/ITKv4/Modules/Core/GPUCommon/include -IF:/S4R/ITKv4/Modules/ThirdParty/GIFTI/src/gifticlib -IF:/S4R/ITKv4/Modules/Compatibility/Deprecated/include -IF:/S4R/ITKv4/Modules/Segmentation/Watersheds/include -IF:/S4R/ITKv4/Modules/Segmentation/Voronoi/include -IF:/S4R/ITKv4/Modules/Bridge/VTK/include -IF:/S4R/ITKv4/Modules/Compatibility/V3Compatibility/include -IF:/S4R/ITKv4/Modules/Core/TestKernel/include -IF:/S4R/ITKv4/Modules/IO/LSM/include -IF:/S4R/ITKv4/Modules/Filtering/SpatialFunction/include -IF:/S4R/ITKv4/Modules/Segmentation/RegionGrowing/include -IF:/S4R/ITKv4/Modules/Filtering/QuadEdgeMeshFiltering/include -IF:/S4R/ITKv4/Modules/Numerics/NeuralNetworks/include -IF:/S4R/ITKv4/Modules/Segmentation/MarkovRandomFieldsClassifiers/include -IF:/S4R/ITKv4/Modules/Segmentation/LabelVoting/include -IF:/S4R/ITKv4/Modules/Segmentation/KLMRegionGrowing/include -IF:/S4R/ITKv4/Modules/IO/VTK/include -IF:/S4R/ITKv4/Modules/IO/TransformMatlab/include -IF:/S4R/ITKv4/Modules/IO/TransformInsightLegacy/include -IF:/S4R/ITKv4/Modules/IO/TransformHDF5/include -IF:/S4R/ITKv4-build/Modules/ThirdParty/HDF5/src -IF:/S4R/ITKv4/Modules/ThirdParty/HDF5/src -IF:/S4R/ITKv4/Modules/IO/TransformBase/include -IF:/S4R/ITKv4/Modules/IO/TIFF/include -IF:/S4R/ITKv4/Modules/ThirdParty/TIFF/src -IF:/S4R/ITKv4-build/Modules/ThirdParty/TIFF/src/itktiff -IF:/S4R/ITKv4-build/Modules/ThirdParty/TIFF/src -IF:/S4R/ITKv4/Modules/IO/Stimulate/include -IF:/S4R/ITKv4/Modules/IO/Siemens/include -IF:/S4R/ITKv4/Modules/IO/RAW/include -IF:/S4R/ITKv4/Modules/IO/PNG/include -IF:/S4R/ITKv4/Modules/ThirdParty/PNG/src -IF:/S4R/ITKv4-build/Modules/ThirdParty/PNG/src -IF:/S4R/ITKv4/Modules/IO/NRRD/include -IF:/S4R/ITKv4/Modules/ThirdParty/NrrdIO/src/NrrdIO -IF:/S4R/ITKv4-build/Modules/ThirdParty/NrrdIO/src/NrrdIO -IF:/S4R/ITKv4/Modules/IO/NIFTI/include -IF:/S4R/ITKv4/Modules/ThirdParty/NIFTI/src/nifti/znzlib -IF:/S4R/ITKv4/Modules/ThirdParty/NIFTI/src/nifti/niftilib -IF:/S4R/ITKv4/Modules/IO/Meta/include -IF:/S4R/ITKv4/Modules/IO/JPEG/include -IF:/S4R/ITKv4/Modules/ThirdParty/JPEG/src -IF:/S4R/ITKv4-build/Modules/ThirdParty/JPEG/src -IF:/S4R/ITKv4/Modules/IO/GIPL/include -IF:/S4R/ITKv4/Modules/IO/GE/include -IF:/S4R/ITKv4/Modules/IO/IPL/include -IF:/S4R/ITKv4/Modules/IO/GDCM/include -IF:/S4R/ITKv4/Modules/ThirdParty/GDCM/src/gdcm/Utilities/C99 -IF:/S4R/ITKv4/Modules/ThirdParty/GDCM/src/gdcm/Source/DataStructureAndEncodingDefinition -IF:/S4R/ITKv4/Modules/ThirdParty/GDCM/src/gdcm/Source/MessageExchangeDefinition -IF:/S4R/ITKv4/Modules/ThirdParty/GDCM/src/gdcm/Source/InformationObjectDefinition -IF:/S4R/ITKv4/Modules/ThirdParty/GDCM/src/gdcm/Source/Common -IF:/S4R/ITKv4/Modules/ThirdParty/GDCM/src/gdcm/Source/DataDictionary -IF:/S4R/ITKv4/Modules/ThirdParty/GDCM/src/gdcm/Source/MediaStorageAndFileFormat -IF:/S4R/ITKv4-build/Modules/ThirdParty/GDCM/src/gdcm/Source/Common -IF:/S4R/ITKv4-build/Modules/ThirdParty/GDCM -IF:/S4R/ITKv4/Modules/ThirdParty/OpenJPEG/src/openjpeg -IF:/S4R/ITKv4-build/Modules/ThirdParty/OpenJPEG/src/openjpeg -IF:/S4R/ITKv4/Modules/IO/BioRad/include -IF:/S4R/ITKv4/Modules/IO/BMP/include -IF:/S4R/ITKv4/Modules/Registration/FEM/include -IF:/S4R/ITKv4/Modules/Registration/PDEDeformable/include -IF:/S4R/ITKv4/Modules/Numerics/FEM/include -IF:/S4R/ITKv4/Modules/Registration/Common/include -IF:/S4R/ITKv4/Modules/IO/SpatialObjects/include -IF:/S4R/ITKv4/Modules/IO/XML/include -IF:/S4R/ITKv4/Modules/ThirdParty/Expat/src/expat -IF:/S4R/ITKv4-build/Modules/ThirdParty/Expat/src/expat -IF:/S4R/ITKv4/Modules/Numerics/Eigen/include -IF:/S4R/ITKv4/Modules/Filtering/DisplacementField/include -IF:/S4R/ITKv4/Modules/Filtering/DiffusionTensorImage/include -IF:/S4R/ITKv4/Modules/Filtering/Denoising/include -IF:/S4R/ITKv4/Modules/Segmentation/DeformableMesh/include -IF:/S4R/ITKv4/Modules/Filtering/Deconvolution/include -IF:/S4R/ITKv4/Modules/ThirdParty/DICOMParser/src/DICOMParser -IF:/S4R/ITKv4-build/Modules/ThirdParty/DICOMParser/src/DICOMParser -IF:/S4R/DCMTK/dcmrt/include -IF:/S4R/DCMTK/dcmpstat/include -IF:/S4R/DCMTK/dcmqrdb/include -IF:/S4R/DCMTK/dcmwlm/include -IF:/S4R/DCMTK/dcmsign/include -IF:/S4R/DCMTK/dcmsr/include -IF:/S4R/DCMTK/dcmnet/include -IF:/S4R/DCMTK/dcmtls/include -IF:/S4R/DCMTK/dcmjpls/include -IF:/S4R/DCMTK/dcmjpeg/include -IF:/S4R/DCMTK/dcmimage/include -IF:/S4R/DCMTK/dcmimgle/include -IF:/S4R/DCMTK/dcmdata/include -IF:/S4R/DCMTK/oflog/include -IF:/S4R/DCMTK/ofstd/include -IF:/S4R/DCMTK-build/config/include -IF:/S4R/DCMTK/dcmrt/include/dcmtk/dcmrt -IF:/S4R/DCMTK/dcmpstat/include/dcmtk/dcmpstat -IF:/S4R/DCMTK/dcmqrdb/include/dcmtk/dcmqrdb -IF:/S4R/DCMTK/dcmwlm/include/dcmtk/dcmwlm -IF:/S4R/DCMTK/dcmsign/include/dcmtk/dcmsign -IF:/S4R/DCMTK/dcmsr/include/dcmtk/dcmsr -IF:/S4R/DCMTK/dcmnet/include/dcmtk/dcmnet -IF:/S4R/DCMTK/dcmtls/include/dcmtk/dcmtls -IF:/S4R/DCMTK/dcmjpls/include/dcmtk/dcmjpls -IF:/S4R/DCMTK/dcmjpeg/include/dcmtk/dcmjpeg -IF:/S4R/DCMTK/dcmimage/include/dcmtk/dcmimage -IF:/S4R/DCMTK/dcmimgle/include/dcmtk/dcmimgle -IF:/S4R/DCMTK/dcmdata/include/dcmtk/dcmdata -IF:/S4R/DCMTK/oflog/include/dcmtk/oflog -IF:/S4R/DCMTK/ofstd/include/dcmtk/ofstd -IF:/S4R/DCMTK-build/config/include/dcmtk/config -IF:/S4R/ITKv4/Modules/Filtering/Convolution/include -IF:/S4R/ITKv4/Modules/Filtering/FFT/include -IF:/S4R/ITKv4/Modules/Filtering/Colormap/include -IF:/S4R/ITKv4/Modules/Segmentation/Classifiers/include -IF:/S4R/ITKv4/Modules/Segmentation/BioCell/include -IF:/S4R/ITKv4/Modules/Filtering/BiasCorrection/include -IF:/S4R/ITKv4/Modules/Numerics/Polynomials/include -IF:/S4R/ITKv4/Modules/Filtering/AntiAlias/include -IF:/S4R/ITKv4/Modules/Segmentation/LevelSets/include -IF:/S4R/ITKv4/Modules/Segmentation/SignedDistanceFunction/include -IF:/S4R/ITKv4/Modules/Numerics/Optimizers/include -IF:/S4R/ITKv4/Modules/Filtering/ImageFeature/include -IF:/S4R/ITKv4/Modules/Filtering/ImageSources/include -IF:/S4R/ITKv4/Modules/Filtering/ImageGradient/include -IF:/S4R/ITKv4/Modules/Filtering/Smoothing/include -IF:/S4R/ITKv4/Modules/Filtering/ImageCompare/include -IF:/S4R/ITKv4/Modules/Filtering/FastMarching/include -IF:/S4R/ITKv4/Modules/Core/QuadEdgeMesh/include -IF:/S4R/ITKv4/Modules/Filtering/DistanceMap/include -IF:/S4R/ITKv4/Modules/Numerics/NarrowBand/include -IF:/S4R/ITKv4/Modules/Filtering/BinaryMathematicalMorphology/include -IF:/S4R/ITKv4/Modules/Filtering/LabelMap/include -IF:/S4R/ITKv4/Modules/Filtering/MathematicalMorphology/include -IF:/S4R/ITKv4/Modules/Segmentation/ConnectedComponents/include -IF:/S4R/ITKv4/Modules/Filtering/Thresholding/include -IF:/S4R/ITKv4/Modules/Filtering/ImageLabel/include -IF:/S4R/ITKv4/Modules/Filtering/ImageIntensity/include -IF:/S4R/ITKv4/Modules/Filtering/Path/include -IF:/S4R/ITKv4/Modules/Filtering/ImageStatistics/include -IF:/S4R/ITKv4/Modules/Core/SpatialObjects/include -IF:/S4R/ITKv4/Modules/ThirdParty/MetaIO/src/MetaIO -IF:/S4R/ITKv4-build/Modules/ThirdParty/MetaIO/src/MetaIO -IF:/S4R/zlib-install/include -IF:/S4R/ITKv4-build/Modules/ThirdParty/ZLIB/src -IF:/S4R/ITKv4/Modules/Core/Mesh/include -IF:/S4R/ITKv4/Modules/IO/ImageBase/include -IF:/S4R/ITKv4-build/Modules/IO/ImageBase -IF:/S4R/ITKv4/Modules/Filtering/ImageCompose/include -IF:/S4R/ITKv4/Modules/Filtering/AnisotropicSmoothing/include -IF:/S4R/ITKv4/Modules/Filtering/ImageGrid/include -IF:/S4R/ITKv4/Modules/Core/ImageFunction/include -IF:/S4R/ITKv4/Modules/Core/Transform/include -IF:/S4R/ITKv4/Modules/Numerics/Statistics/include -IF:/S4R/ITKv4-build/Modules/ThirdParty/Netlib -IF:/S4R/ITKv4/Modules/Core/ImageAdaptors/include -IF:/S4R/ITKv4/Modules/Filtering/CurvatureFlow/include -IF:/S4R/ITKv4/Modules/Filtering/ImageFilterBase/include -IF:/S4R/ITKv4/Modules/Core/FiniteDifference/include -IF:/S4R/ITKv4/Modules/Core/Common/include -IF:/S4R/ITKv4-build/Modules/Core/Common -IF:/S4R/ITKv4/Modules/ThirdParty/VNLInstantiation/include -IF:/S4R/ITKv4-build/Modules/ThirdParty/VNL/src/vxl/core -IF:/S4R/ITKv4-build/Modules/ThirdParty/VNL/src/vxl/vcl -IF:/S4R/ITKv4-build/Modules/ThirdParty/VNL/src/vxl/v3p/netlib -IF:/S4R/ITKv4/Modules/ThirdParty/VNL/src/vxl/core -IF:/S4R/ITKv4/Modules/ThirdParty/VNL/src/vxl/vcl -IF:/S4R/ITKv4/Modules/ThirdParty/VNL/src/vxl/v3p/netlib -IF:/S4R/ITKv4-build/Modules/ThirdParty/KWSys/src -IF:/S4R/ITKv4/Modules/ThirdParty/DoubleConversion/src/double-conversion -IF:/S4R/SimpleITK/Code/Common/include -IF:/S4R/SimpleITK/Code/Registration -IF:/S4R/SimpleITK/Code/BasicFilters/include -IF:/S4R/SimpleITK/Code/IO/include -IF:/S4R/SimpleITK-build/Code/BasicFilters/include -IF:/S4R/SimpleITK-build/Code/Common/include -IF:/S4R/SimpleITK/Utilities/C99 -IF:/S4R/python-install/include -IF:/S4R/SimpleITK/Wrapping -o F:/S4R/SimpleITK-build/Wrapping/SimpleITKPYTHON_wrap.cxx F:/S4R/SimpleITK/Wrapping/SimpleITK.i

TagsNo tags attached.

Activities

2013-06-11 13:42

 

test.bat (9,925 bytes)
lassoan

lassoan

2013-06-11 13:46

developer   ~0008748

To reproduce the problem there is no need to build Slicer or SimpleITK or anything, just edit the attached test.bat with the correct swig.exe path on your computer then run it. It will give the error:
swig error : Unrecognized option -F:/S4R/ITKv4/Modules/IO/ImageBase/include

lassoan

lassoan

2013-06-11 14:35

developer   ~0008749

The problem is reproducible without on VS2008 with a simple console application:

int main(int argc, char **argv)
{
for (int i=0; i<argc; i++)
{
std::puts(argv[i]);
}
return 0;
}

Run this app with the attached batch file. The output is:
...
-IF:/S4R/zlib-install/include
-IF:/S4R/ITKv4-build/Modules/ThirdParty/ZLIB/src
-IF:/S4R/ITKv4/Modules/Core/Mesh/include
-F:/S4R/ITKv4/Modules/IO/ImageBase/include
-IF:/S4R/ITKv4-build/Modules/IO/ImageBase
-IF:/S4R/ITKv4/Modules/Filtering/ImageCompose/include
-IF:/S4R/ITKv4/Modules/Filtering/AnisotropicSmoothing/include
...

Note the missing 'I' character in the ...IO/ImageBase/include line.

So, it seems to be a Windows issue. One solution is to shorten the command line path so that it doesn't reach the 8k limit.

lassoan

lassoan

2013-06-11 16:40

developer   ~0008751

From: Sharp, Gregory C. [mailto:GCSHARP@partners.org]
Sent: June 11, 2013 7:22 PM
To: 'Andras Lasso'; 'Bradley Lowekamp'
Cc: 'Slicer devel'
Subject: RE: [slicer-devel] SimpleITK compiling with shared libraries ( was: running on mac nightly with hack… and other )

We encountered this problem using ITK4 with nvcc.

There are several workarounds one can imagine

  • If application allows command line parameters as file, use it
  • Write small program to call CreateProcesss(), which allows 32k command line
  • Remove unnecessary ITK include paths

We chose the last option. As you know, cmake can't set
include directories on a target-specific basis. So we created
special subdirectories for spawning the nvcc process.
This allows include path to be customized.

jcfr

jcfr

2013-06-12 05:07

administrator   ~0008753

from: Jean-Christophe Fillion-Robin <jchris.fillionr@kitware.com>
to: Andras Lasso <lasso@cs.queensu.ca>
cc: "Sharp, Gregory C." <GCSHARP@partners.org>,
Bradley Lowekamp <blowekamp@mail.nih.gov>,
Slicer devel <slicer-devel@bwh.harvard.edu>
date: Wed, Jun 12, 2013 at 8:56 AM
subject: Re: [slicer-devel] SimpleITK compiling with shared libraries ( was: running on mac nightly with hack… and other )

Hi Folks,

The latest version of CMake now include a feature allowing to specify target usage requirements. It means it is now possible to associate a list of include directories for each targets. Moving forward, this is something I would like to setup within Slicer.

See http://www.kitware.com/blog/home/post/462 and http://community.kde.org/Frameworks/Epics/CMake_target_usage_requirements

blowekamp

blowekamp

2013-06-13 06:15

developer   ~0008759

This particular issue can be resolved in SimpleITK by the removal of "include(${ITK_USE_FILE})" in SimpleITK/Wrapping/CMakeLists.txt. Here is the issue in the SimpleITK bug tracker:

https://issues.itk.org/jira/browse/SIMPLEITK-408

As another possible long term solution to this problem. ITK's modular structure could be take advantage of , each library/module could find and include the ITK project, and specify the components needed. This would only added the required include paths to the compilation lines.

blowekamp

blowekamp

2013-06-13 07:57

developer   ~0008760

A topic has been merged into SimpleITK's next brach to address this issue:
https://github.com/SimpleITK/SimpleITK/commit/0ad83f82ce129d08f4271655120a9a251a82f2dc

it will be merged into the release and master branch after successful nightly testing.

lassoan

lassoan

2013-06-13 08:04

developer   ~0008761

thanks!

blowekamp

blowekamp

2013-07-05 05:59

developer   ~0008856

This patch should address this issue:
https://github.com/blowekamp/Slicer/tree/SimpleITKVersionUpdate

blowekamp

blowekamp

2013-07-16 12:12

developer   ~0009089

The version of SimpleITK in Slicer has been updated to address this bug. It'd be great if the original reporter could confirm.

jcfr

jcfr

2014-03-06 04:56

administrator   ~0010812

Closing resolved issues that have not been updated in more than 3 months

lassoan

lassoan

2014-05-19 04:18

developer   ~0011886

The changes might have reduced the probability of the issue occurring, but unfortunately, the problem still has not been resolved, see an error report below.

From: slicer-devel-bounces@bwh.harvard.edu [mailto:slicer-devel-bounces@bwh.harvard.edu] On Behalf Of yao2049@gmail.com
Sent: May 19, 2014 7:46 AM
To: slicer-devel@bwh.harvard.edu
Subject: [slicer-devel] Slicer Nightly Build Error while Build CTK with error

hello
i’m pretty new to here and has problems came up when building the slicer new nightly version… i think i was very regarding the build wiki page
the build error log lays below:

PythonQt Wrapping - Generating generated_cpp/org_commontk_CTKWidgets/org_commontk_CTKWidgets_init.cpp
Qt: Untested Windows version 6.2 detected!
Traceback (most recent call last):
File "E:/Kitware/3DSlicer/SlicerBuildDebug/CTK/CMake/ctkWrapPythonQt.py", line 225, in
ctk_wrap_pythonqt(options.target, options.namespace, options.output_dir, args, options.extra_verbose)
File "E:/Kitware/3DSlicer/SlicerBuildDebug/CTK/CMake/ctkWrapPythonQt.py", line 79, in ctk_wrap_pythonqt
with open(input_file) as f:
IOError: [Errno 2] No such file or directory: 'E:/Kitare/3DSlicer/SlicerBuildDebug/CTK/Libs/Widgets/ctkPopupWidgetEventTranslator.h'
Project : error PRJ0019: A tool returned an error code from "PythonQt Wrapping - Generating generated_cpp/org_commontk_CTKWidgets/org_commontk_CTKWidgets_init.cpp"
while the true directory was
'E:/Kitware/3DSlicer/SlicerBuildDebug……

i was wonder why it will be automatically cut a letter… and i never write it by hand the project is automatical constructed by cmake.

and how can i build successfully?

many thanks

YAO JIALIANG
CCI OF INFORMATION ENGINEERING
ZJUT

blowekamp

blowekamp

2014-05-19 05:15

developer   ~0011887

ITK continues to grow and add more modules. When build against ITK's build tree this adds more path to the include and linker paths. However when ITK is installed it's a flat tree with significantly fewer number of required paths.

lassoan

lassoan

2014-05-19 06:36

developer   ~0011888

Last edited: 2014-05-19 06:47

It seems that the issue is not specific to SWIG, for example:
http://typescript.codeplex.com/workitem/597
and
https://issues.apache.org/jira/browse/PROTON-249

lassoan

lassoan

2014-08-26 15:12

developer   ~0012423

I have good news! I had a look at this path length issue again, and it seems that there may be a clean and definitive solution.

=> Problem

Maximum command line length on Windows for cmd.exe is 8192 (32767 for CreateProcess). If you pass longer than 8192 then the behavior is undefined (actually, 8192th character is removed and the rest of the string is passed). CMake passes parameters to the compiler or linker using a parameter file (instead of command-line arguments) when it finds that the command-line would be too long.

However, CMake cannot implement this mechanism for custom commands, that's up to the developer who adds a custom command!

=> Example

The particular issue that caused build error for Jim is due to a custom command defined in ctkMacroWrapPythonQt.cmake:

add_custom_command(
OUTPUT
${wrapper_init_cpp_filename}
${wrapper_h_filename}
DEPENDS
${SOURCES_TO_WRAP}
${CTK_CMAKE_DIR}/ctkWrapPythonQt.py
COMMAND ${PYTHON_EXECUTABLE} ${CTK_CMAKE_DIR}/ctkWrapPythonQt.py
--target=${TARGET}
--namespace=${WRAPPING_NAMESPACE}
--output-dir=${CMAKE_CURRENT_BINARY_DIR}/${wrap_int_dir} ${extra_args}
${SOURCES_TO_WRAP}
COMMENT "PythonQt Wrapping - Generating ${wrapper_init_cpp_filename}"
VERBATIM
)

The ${SOURCES_TO_WRAP} variable can contain hundreds of full paths, which of course can easily grow over 8192. For example, a command like this can be generated (see in the generated CTKWidgetsPythonQt.vcxproj file):


&lt;CustomBuild Include=&quot;..\..\CMakeFiles\d4e9ed124a08aa4e815590aff2c25a3c\org_commontk_CTKWidgets_init.cpp.rule&quot;>
  &lt;Message Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|x64'&quot;>PythonQt Wrapping - Generating generated_cpp/org_commontk_CTKWidgets/org_commontk_CTKWidgets_init.cpp&lt;/Message>
  &lt;Command Condition=&quot;'$(Configuration)|$(Platform)'=='Debug|x64'&quot;>setlocal

C:\S4D\python-install\bin\SlicerPython.exe C:/S4D/CTK/CMake/ctkWrapPythonQt.py --target=CTKWidgets --namespace=org.commontk --output-dir=C:/S4D/CTK-build/CTK-build/Libs/Widgets/generated_cpp/org_commontk_CTKWidgets/ C:/S4D/CTK/Libs/Widgets/ctkActionsWidget.h C:/S4D/CTK/Libs/Widgets/ctkAddRemoveComboBox.h C:/S4D/CTK/Libs/Widgets/ctkAxesWidget.h C:/S4D/CTK/Libs/Widgets/ctkBasePopupWidget.h C:/S4D/CTK/Libs/Widgets/ctkButtonGroup.h C:/S4D/CTK/Libs/Widgets/ctkCheckableComboBox.h C:/S4D/CTK/Libs/Widgets/ctkCheckableHeaderView.h C:/S4D/CTK/Libs/Widgets/ctkCheckableModelHelper.h C:/S4D/CTK/Libs/Widgets/ctkCheckBox.h C:/S4D/CTK/Libs/Widgets/ctkCheckBoxPixmaps.h C:/S4D/CTK/Libs/Widgets/ctkCheckablePushButton.h C:/S4D/CTK/Libs/Widgets/ctkComboBox.h C:/S4D/CTK/Libs/Widgets/ctkCompleter.h C:/S4D/CTK/Libs/Widgets/ctkCollapsibleButton.h C:/S4D/CTK/Libs/Widgets/ctkCollapsibleGroupBox.h C:/S4D/CTK/Libs/Widgets/ctkColorDialog.h C:/S4D/CTK/Libs/Widgets/ctkColorPickerButton.h C:/S4D/CTK/Libs/Widgets/ctkConsole.h C:/S4D/CTK/Libs/Widgets/ctkCoordinatesWidget.h C:/S4D/CTK/Libs/Widgets/ctkCrosshairLabel.h C:/S4D/CTK/Libs/Widgets/ctkDateRangeWidget.h C:/S4D/CTK/Libs/Widgets/ctkDirectoryButton.h

many many more similar lines here

C:/S4D/CTK/Libs/Widgets/ctkMenuComboBoxEventTranslator.h C:/S4D/CTK/Libs/Widgets/ctkPathLineEditEventPlayer.h C:/S4D/CTK/Libs/Widgets/ctkPathLineEditEventTranslator.h C:/S4D/CTK/Libs/Widgets/ctkPopupWidgetEventPlayer.h C:/S4D/CTK/Libs/Widgets/ctkPopupWidgetEventTranslator.h C:/S4D/CTK/Libs/Widgets/ctkRangeSliderEventPlayer.h C:/S4D/CTK/Libs/Widgets/ctkRangeSliderEventTranslator.h C:/S4D/CTK/Libs/Widgets/ctkTreeComboBoxEventPlayer.h C:/S4D/CTK/Libs/Widgets/ctkTreeComboBoxEventTranslator.h
if %errorlevel% neq 0 goto :cmEnd
:cmEnd
endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
:cmErrorLevel
exit /b %1
:cmDone
if %errorlevel% neq 0 goto :VCEnd</Command>


=> Solution

Fortunately, there is a nice, clean solution to this issue: pass the ${SOURCES_TO_WRAP} list to the python script through a file, not through command-line.

There may be other instances where long lists are attempted to pass through command-line parameters, so fixing this issue may not allow us to use arbitrarily long paths yet, but if we fix these issues one by one as they pop up, finally we may end up fixing all of them.

blowekamp

blowekamp

2016-10-12 09:00

developer   ~0014169

This is no longer a SimpleITK issue. I believe the original issue was resolved and closed. The original title and description are not longer accurate. The latest report on an issue (2014-05-19 04:18) with CTK issues should be separate ticket.

lassoan

lassoan

2016-10-17 12:20

developer   ~0014199

I agree that the remaining is not specific to SimpleITK and there is already a ticket in CTK's bugtracker (https://github.com/commontk/CTK/issues/525), so this issue can be closed.

The current workaround is to reduce build path length to a few characters. At some point, as more and more code is added, it will not possible to have a build path short enough to be able to build Slicer. At that point, either it has to be made sure that no include directory list is attempted to passed through command line (modify ctkWrapPythonQt and similar CMake scripts) or VTK/ITK should be fixed to not require hundreds of include directories (this would be much nicer).

Issue History

Date Modified Username Field Change
2013-06-11 13:41 lassoan New Issue
2013-06-11 13:41 lassoan Status new => assigned
2013-06-11 13:41 lassoan Assigned To => jcfr
2013-06-11 13:42 lassoan File Added: test.bat
2013-06-11 13:46 lassoan Note Added: 0008748
2013-06-11 14:35 lassoan Note Added: 0008749
2013-06-11 16:40 lassoan Note Added: 0008751
2013-06-12 05:07 jcfr Note Added: 0008753
2013-06-13 06:15 blowekamp Note Added: 0008759
2013-06-13 07:57 blowekamp Note Added: 0008760
2013-06-13 08:04 lassoan Note Added: 0008761
2013-06-13 20:25 jcfr Priority normal => high
2013-06-13 20:25 jcfr Target Version => Slicer 4.3.0
2013-07-05 05:59 blowekamp Note Added: 0008856
2013-07-16 12:12 blowekamp Note Added: 0009089
2013-07-16 14:11 jcfr Status assigned => feedback
2013-07-22 08:09 jcfr Status feedback => resolved
2013-07-22 08:09 jcfr Fixed in Version => Slicer 4.3.0
2013-07-22 08:09 jcfr Resolution open => fixed
2014-03-06 04:56 jcfr Note Added: 0010812
2014-03-06 04:58 jcfr Status resolved => closed
2014-05-19 04:18 lassoan Note Added: 0011886
2014-05-19 05:09 jcfr Status closed => feedback
2014-05-19 05:09 jcfr Resolution fixed => reopened
2014-05-19 05:15 blowekamp Note Added: 0011887
2014-05-19 06:36 lassoan Note Added: 0011888
2014-05-19 06:47 lassoan Note Edited: 0011888
2014-08-26 15:12 lassoan Note Added: 0012423
2015-11-03 19:35 jcfr Fixed in Version Slicer 4.3.0 =>
2015-11-03 19:35 jcfr Target Version Slicer 4.3.0 => Slicer 4.6.0
2016-10-12 03:55 jcfr Target Version Slicer 4.6.0 => Slicer 4.7.0
2016-10-12 09:00 blowekamp Note Added: 0014169
2016-10-17 12:20 lassoan Note Added: 0014199
2016-10-17 12:20 lassoan Status feedback => assigned
2016-10-17 12:20 lassoan Status assigned => resolved
2016-10-17 12:20 lassoan Resolution reopened => won't fix
2018-03-02 11:01 jcfr Status resolved => closed