[Insight-users] itk python wrapping failing on Win

Bradley Lowekamp blowekamp at mail.nih.gov
Thu Jun 14 16:49:56 EDT 2012


I have a patch which may fix the issue you are experiencing. It would be great if you could test it on you platform.

http://review.source.kitware.com/#/c/6205/1

Thanks,
Brad

On Jun 14, 2012, at 7:32 AM, Prevrhal, Sven wrote:

> Success!
> I wrote a little Python script that removes the duplicate entries from the gcc_xml.inc files (find it attached to this email), then ran it from a Cygwin bash cmd line with
> 
> find ./ -name gcc_xml.inc -execdir python /cygdrive/d/bin/uniqus.py {} {} \;
> 
> That did it, I now have the itk nightly sources built with Python Wrapper support. NB, run duplicate line removal *after* the last CMake generation, which would otherwise replace the gcc_xml.inc files with faulty ones again.
> 
> Greetings
> -- Sven
> 
> -----Original Message-----
> From: Prevrhal, Sven
> Sent: Mittwoch, 13. Juni 2012 17:01
> To: 'Alexandre GOUAILLARD'; insight-users at itk.org
> Cc: 'Patrick Arbez'
> Subject: RE: [Insight-users] itk python wrapping failing on Win
> 
> I have come a bit farther with identifying the problem. It's not related to Visual Studio since it also fails with mingw.
> 
> The first make step to fail is in Wrapping\Modules\ITKCommon\CMakeFiles\ITKCommonGccXML.dir. The following is directly copied out of the build.make file there:
> 
> cd /d D:\packages\builds\itk-nightly-x86\mingw\Wrapping\Modules\ITKCommon && D:\packages\gccxml\mingw\bin\gccxml.exe -fxml-start=_cable_ -fxml=D:/packages/builds/itk-nightly-x86/mingw/Wrapping/Modules/ITKCommon/vcl_complex.xml --gccxml-gcc-options D:/packages/builds/itk-nightly-x86/mingw/Wrapping/Modules/ITKCommon/gcc_xml.inc -DCSWIG -DCABLE_CONFIGURATION -DITK_MANUAL_INSTANTIATION D:/packages/builds/itk-nightly-x86/mingw/Wrapping/Modules/ITKCommon/vcl_complex.cxx
> 
> This indeed fails when executed from the cmd line. I deleted all the paths and it still failed. I narrowed it down to the --gccxml-gcc-options gcc_xml.inc being the offending part. This is a gccxml option that allow passing a long list of includes to the patched gcc in a single file. Then I looked at gcc_xml.inc and saw that it contained 18 copies of the same includes, and this is what gccxml balks at: After removing the duplicates, it compiles without a hitch and produces a correct-looking vcl_complex.xml file.
> 
> The gcc_xml.inc's are produced by a macro in Wrapping/Generators/GccXML/CMakeList.txt
> 
> macro(itk_wrap_module_gccxml library_name)
>  # create the files used to pass the file to include to gccxml
>  set(gccxml_inc_file "${WRAPPER_LIBRARY_OUTPUT_DIR}/gcc_xml.inc")
>  set(CONFIG_GCCXML_INC_CONTENTS)
>  get_directory_property(include_dir_list INCLUDE_DIRECTORIES)
> 
>  if(ITK_USE_CCACHE)
>    # it is used on the command line
>    foreach(dir ${include_dir_list})
>      set(CONFIG_GCCXML_INC_CONTENTS ${CONFIG_GCCXML_INC_CONTENTS} -I${dir})
>    endforeach(dir)
>  else(ITK_USE_CCACHE)
>    # really create the content of the file
>    foreach(dir ${include_dir_list})
>      set(CONFIG_GCCXML_INC_CONTENTS "${CONFIG_GCCXML_INC_CONTENTS}-I${dir}\n")
>    endforeach(dir)
>    # and the file.
>    configure_file("${ITK_WRAP_GCCXML_SOURCE_DIR}/gcc_xml.inc.in" "${gccxml_inc_file}"
>      @ONLY IMMEDIATE)
>  endif(ITK_USE_CCACHE)
>  set(GCC_XML_OUTPUT_FILES )
> endmacro(itk_wrap_module_gccxml)
> 
> The macro looks alright to me, although I am not a CMake expert - it seems to build the list CONFIG_GCCXML_INC_CONTENTS  from a variable include_dir_list which in turns comes from this line:
> 
> get_directory_property(include_dir_list INCLUDE_DIRECTORIES)
> 
> I used message to print out the contents of ${include_dir_list}, and indeed, it already contains the duplicates. So The CMake INCLUDE_DIRECTORIES command doesn't care about duplicates, and when it's called from each module's CMakeList.txt, obviously there will be lots of them. The quick dirty fix for me would be to run a script that cleans them up (I hope this doesn't trigger a rerun of cmake configuration and generation when I call make!), or better, we find the bug that's either in CMake or in the itk CMakeLists.txt files. I saw that David Cole was involved with fixed in CMake 2.8.8 related to INCLUDE_DIRECTORIES but I don't have his email.
> 
> 
> BTW: I tried using  variable_watch(include_dir_list) before the get_directory_property command but CMake reproducibly crashes with that.
> 
> Gruesse - Greetings,
> -- Sven
> 
> 
> -----Original Message-----
> From: Alexandre GOUAILLARD [mailto:agouaillard at gmail.com]
> Sent: Sonntag, 27. Mai 2012 12:41
> To: Prevrhal, Sven
> Cc: insight-users at itk.org
> Subject: Re: [Insight-users] itk python wrapping failing on Win
> 
> dear sven,
> 
> you re getting different errors messages, that s progress :-)
> 
> On Sun, May 27, 2012 at 4:26 AM, Prevrhal, Sven <Sven.Prevrhal at philips.com> wrote:
>> Thanks -
>> I tried D:/ for itk build, same error. Then I followed your advice and tried installing gccxml and ITK_USE_SYSTEM_GCCXML.
>> 
>> Now I get errors like
>> 
>> 867>D:\packages\src\ITK-nightly\Modules\Filtering\ImageIntensity\inclu
>> 867>de\itkConstrainedValueDifferenceImageFilter.h(97) : error C2487:
>> 867>'itk::ProcessObject::MakeOutput' : member of dll interface class
>> 867>may not be declared with dll interface
>> 
>> And literally 100s of 1000s of lines like
> 
> I never met that specific error before but, it's likely to be related to the window specific all import/export feature. If this is the case, this is supposed to be made transparent through the definition of ITK_EXPORT at configuration time. each itk class declaration should use it ( class ITK_EXPORT itkMyClassName ...). Can you check if in the declaration of itkProcessObject the keyword is there and as the right value (in MSVC you can move your mouse over the symbol to see it's definition, if it s empty, you have a problem).
> 
> this is a windows issues and, from what I see, not necessarily related to wrapping.
> 
>> 
>> 867>D:\packages\builds\itk-nightly-x86\Wrapping\Typedefs\ITKImageInten
>> 867>sityExplicit.h(628) : warning C4231: nonstandard extension used :
>> 867>'extern' before template explicit instantiation
> 
> I wouldn't use EXPLICIT. Just use normal wrapping (there is an extra advanced flag for EXPLICIT instanciation, that is supposed to fasten the compilation of the wrapping if you use several language by first explicitly instantiating some of the template, and then wrapping those, switch it off).
> 
>> 
>> I am sure I missing something obvious - there must be more folks out there wanting to compile itk with python wrapping on a windows box.
> 
> I guess it works for them :-)
> 
> More seriously, I just checked the dashboard sand indeed, there is not a lot of windows machine (ihpc @ NLM, redwall @ kitware, factory @ kitware which has a different purpose, ...). Maybe it s time to call for contribution. I will see if I can resurrect one of the machine that gaetan was using for the wrapping.
> 
> Maybe you would also like to contribute, even only on-time experimental build so we can see more in details your errors? within MSVC just build the Experimental project (which is skipped by default when you BUILD_ALL), from the command line you can run:
> ctest -D Experimental.
> 
> regards,
> 
> alex.
>> 
>> sven
>> 
>> -----Original Message-----
>> From: Alexandre GOUAILLARD [mailto:agouaillard at gmail.com]
>> Sent: Samstag, 26. Mai 2012 10:22
>> To: Prevrhal, Sven
>> Cc: insight-users at itk.org
>> Subject: Re: [Insight-users] itk python wrapping failing on Win
>> 
>> hi,
>> 
>> my guts feeling is that the path to the executable is too long.
>> try to either relocate ITK closer to the D:/ root, or to install gccXML first, and use the installed version within ITK.
>> 
>> regards,
>> 
>> alex.
>> 
>> 
>> On Sat, May 26, 2012 at 6:13 AM, Prevrhal, Sven <Sven.Prevrhal at philips.com> wrote:
>>> Gccxml is making trouble. Non-wrapping projects all compile just
>>> fine, using
>>> VS2008 32-bit debug. Python wrappers don't compile at all. Here is a
>>> snippet of the build log - any ideas? I did set GCCXML_COMPILER to
>>> msvc9 but it apparently got ignored, and probably wouldn't solve the problem anyway.
>>> 
>>> 
>>> 
>>> 290>Generating itkAntiAliasBinaryImageFilter.xml
>>> 
>>> 289>Microsoft (R) 32-bit C/C++ Optimizing Compiler Version
>>> 289>15.00.21022.08
>>> for 80x86
>>> 
>>> 289>Copyright (C) Microsoft Corporation.  All rights reserved.
>>> 
>>> 289>usage: cl [ option... ] filename... [ /link linkoption... ]
>>> 
>>> 289>Warning:
>>> 
>>> 289>Compiler "cl" specified, but more than one of MSVC 6, 7, 7.1, 8,
>>> 289>9, and
>>> 10 are installed.
>>> 
>>> 289>Please specify "msvc6", "msvc7", "msvc71", "msvc8", "msvc8ex",
>>> 289>"msvc9",
>>> or "msvc10" for the GCCXML_COMPILER setting.
>>> 
>>> 289>Using MSVC 9 because it was used to build GCC-XML.
>>> 
>>> 289>Error: Could not run
>>> D:/packages/builds/itk-nightly-x86/Wrapping/Generators/GccXML/gccxml/bin/gccxml_cc1plus.exe:
>>> 
>>> 289>The filename or extension is too long
>>> 
>>> 289>Project : error PRJ0019: A tool returned an error code from
>>> 289>"Generating
>>> itkErodeObjectMorphologyImageFilter.xml"
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>>> ________________________________
>>> The information contained in this message may be confidential and
>>> legally protected under applicable law. The message is intended
>>> solely for the addressee(s). If you are not the intended recipient,
>>> you are hereby notified that any use, forwarding, dissemination, or
>>> reproduction of this message is strictly prohibited and may be
>>> unlawful. If you are not the intended recipient, please contact the
>>> sender by return e-mail and destroy all copies of the original message.
>>> 
>>> _____________________________________
>>> Powered by www.kitware.com
>>> 
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>> 
>>> Kitware offers ITK Training Courses, for more information visit:
>>> http://www.kitware.com/products/protraining.php
>>> 
>>> Please keep messages on-topic and check the ITK FAQ at:
>>> http://www.itk.org/Wiki/ITK_FAQ
>>> 
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.itk.org/mailman/listinfo/insight-users
>>> 
>> 
>> ________________________________
>> The information contained in this message may be confidential and legally protected under applicable law. The message is intended solely for the addressee(s). If you are not the intended recipient, you are hereby notified that any use, forwarding, dissemination, or reproduction of this message is strictly prohibited and may be unlawful. If you are not the intended recipient, please contact the sender by return e-mail and destroy all copies of the original message.
>> 
> <uniqus.py>_____________________________________
> Powered by www.kitware.com
> 
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
> 
> Kitware offers ITK Training Courses, for more information visit:
> http://www.kitware.com/products/protraining.php
> 
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
> 
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users

========================================================
Bradley Lowekamp  
Medical Science and Computing for
Office of High Performance Computing and Communications
National Library of Medicine 
blowekamp at mail.nih.gov



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20120614/ab332f6d/attachment.htm>


More information about the Insight-users mailing list