[Insight-users] SimpleITK Build Issues VS 2008 (x64)

Scott Johnson Scott.Johnson at neuwave.com
Mon Apr 2 09:29:04 EDT 2012


Hi Dan,

Thanks for all your work.  If you would put up your version of the libraries on dropbox it would be appreciated.  That will get me moving while I start looking at what it would take to move to VS 2010 for all of our projects.

		-- Scott

-----Original Message-----
From: Dan Mueller [mailto:dan.muel at gmail.com] 
Sent: Sunday, April 01, 2012 2:41 AM
To: Scott Johnson
Cc: itk (Insight-users at itk.org); Bradley Lowekamp
Subject: Re: [Insight-users] SimpleITK Build Issues VS 2008 (x64)

Hi Scott,

I have worked out how to build SimpleITK C# binaries with VS10 which target the .NET 2.0 runtime i.e. can be used with VS9.

The procedure is as follows:

1. Setup the SimpleITK build as normal with VS10.
2. During the SimpleITK CMake configure stage, select the advanced mode.
3. After the first round of configuration, find the CSHARP_DOTNET_VERSION variable.
4. Set CSHARP_DOTNET_VERSION = v2.0.50727 5. Re-configure and generate.
6. Build the generated solution.

During the configuration stage you should see the following output (notice the framework version number):

Found the following C# .NET versions: v4.0.30319, v3.5, v2.0.50727, v1.1.4322 Using .NET compiler version v2.0.50727 Adding C# library SimpleITKCSharpManaged:
'C:/Windows/Microsoft.NET/Framework/v2.0.50727/csc.exe /t:library /out:SimpleITKCSharpManaged.dll /platform:anycpu /reference:System.dll C:\ITK\SimpleITK-0.4.0\Build\Wrapping\CSharpSources\*.cs'

I have built .NET 2.0 binaries on my machine using VS10 and have verified they work in a VS9 C# solution. If you want I can forward these (via dropbox) but be warned: I didn't use the same compiler settings as the build server so the binaries are quite large (release
x64 anycpu = 50 MB). I will try to make a patch sometime so that the next release of SimpleITK C# wrappers target .NET 2.0.

In short: if you can get your hands on VS10 (perhaps using the Express
version?) you can use the above procedure to build your own assemblies targeting .NET 2.0.

HTH

Cheers, Dan

On 1 April 2012 03:36, Bradley Lowekamp <blowekamp at mail.nih.gov> wrote:
> Hello Scott,
>
> Getting stdint.h and TR1 should be the easy part. I unfortunately 
> don't have access to VS 2009 until Monday, so I can't double check 
> these things for you. I have installed and configured virtual machines 
> many times with VS 2008. I never had trouble installing the TR1 
> feature pack. The only time I had trouble with stdint, was when the 
> web browser added an extensions. So please right-click on the file and 
> look at the properties to verify it has the correct name. The 
> check_include_file_cxx cmake function performs a try_compile on a cxx 
> file to check if the header is found. The compiler should not be 
> invoked with additional include paths at this point, so it's just going to looking in the standard system locations.
>
> The hard part... As Dan pointed to in the fact, we are having problems 
> compiling with VS9 handling the size of the intermediate static libraries.
> There are some heroic efforts people have gone to get it work with 
> this compiler[1]. Additionally in the experimental developmental 
> branch we are trying different ways to break up the libraries to over 
> come this limitation. On the other hand, I believe that it should be 
> possible to build ITK with shared libraries and SimpelITK with share 
> libraries to over come this limit  as well. However, afterward you'll 
> have to manage of ITK shared libraries along with the SimpleITK 
> libraries and the C Sharp managed library. I have not verified this 
> shared library approach, but will do so on Monday. However, I don't 
> really recommend any of these approach to those who are not extremely motivated.
>
> So the recommendations I have are:
>
> 1) Switch so VS10, The freely available express edition should be 
> compatible with precompiled C#. This should be the easiest.
> 2) Wait a couple weeks to see if the libraries can be refactored, to 
> over come the limitations of this compiler.
> 3) Figure out how to use VS10 to compile SimpleITK c# for .Net 2.0
> 4) Delve into getting it to work on VS9 wither with magic flags, the 
> experimental branch, or with build ITK and SimpleITK with shared libraries.
>
> [1] https://itk.icts.uiowa.edu/jira/browse/SIMPLEITK-216
>
>
> Please let up know if you have further problems or success, and good 
> luck, Bradley Lowekamp
>
> ========================================================
>
> Bradley Lowekamp
>
> Medical Science and Computing for
>
> Office of High Performance Computing and Communications
>
> National Library of Medicine
>
> blowekamp at mail.nih.gov
>
>
> On Mar 31, 2012, at 11:05 AM, Scott Johnson wrote:
>
> Thanks Dan.
>
> Where is cmake looking to find stdint.h?
>
> -- Scott
>
> -----Original Message-----
> From: Dan Mueller [mailto:dan.muel at gmail.com]
> Sent: Friday, March 30, 2012 6:43 PM
> To: Scott Johnson
> Cc: itk (Insight-users at itk.org)
> Subject: Re: [Insight-users] SimpleITK Build Issues VS 2008 (x64)
>
> Hi Scott,
>
> Yes, I also had discovered this. Sorry for not making this clear in my 
> email.
>
> Just to be clear, the options are:
> 1. Change SimpleITK so that VS10 builds do no use .NET 4.0 (meaning 
> pre-built SimpleITKCSharpManaged.dll will be usable with VS9). I'm not 
> going to be able to address this any time soon.
> 2. Get your VS9 environment to support TR1/C99, then build SimpleITK 
> yourself.
> (3. Switch to VS10.)
>
> If I can past the CMake issues I'll feel more confident that I can get 
> it to build.
>
> BTW: The issue you report is not an issue with the CMake build per se, 
> but an issue with your compiler -- the CMake build is simply doing 
> some checks and has determined that your build environment does not 
> meet the requirements for SimpleITK.
>
> Good luck.
>
> Cheers, Dan
>
> On 31 March 2012 09:40, Scott Johnson <Scott.Johnson at neuwave.com> wrote:
>
> Hi Again,
>
>
> With a little research I have found that Visual Studio 2008 is not 
> compatible with .Net Framework 4.0.  Therefore the pre-built dlls 
> cannot be used under VS 2008.
>
>
> Back to trying to build it.
>
>
> Thanks
>
>
>                -- Scott
>
>
> -----Original Message-----
>
> From: insight-users-bounces at itk.org
>
> [mailto:insight-users-bounces at itk.org] On Behalf Of Scott Johnson
>
> Sent: Friday, March 30, 2012 6:00 PM
>
> To: Dan Mueller
>
> Cc: itk (Insight-users at itk.org)
>
> Subject: Re: [Insight-users] SimpleITK Build Issues VS 2008 (x64)
>
>
> Thanks for the response Dan.
>
>
> I'll try to target .NET 4.0 to see if I can use the prebuilt dlls.
>
>
> If I can past the CMake issues I'll feel more confident that I can get 
> it to build.
>
>
>                -- Scott
>
>
> -----Original Message-----
>
> From: Dan Mueller [mailto:dan.muel at gmail.com]
>
> Sent: Friday, March 30, 2012 4:44 PM
>
> To: Scott Johnson
>
> Cc: itk (Insight-users at itk.org); Bradley Lowekamp
>
> Subject: Re: [Insight-users] SimpleITK Build Issues VS 2008 (x64)
>
>
> Hi Scott,
>
>
> Sorry to hear you are experiencing issues with building the SimpleITK 
> C# wrappers.
>
>
> I tried to use SimpleITKCSharpManaged.dll from 
> SimpleITK-0.4.0-CSharp-Win64-anycpu.zip in a Visual Studio 2008 
> project and experienced the same issue you described:
>
> Could not load file or assembly 'SimpleITKCSharpManaged.dll' or one of 
> its dependencies. This assembly is built by a runtime newer than the 
> currently loaded runtime and cannot be loaded.
>
>
> The issue is not that the assembly was built by Visual Study 2010 
> (which it
> was) but rather it was built to target the .NET 4.0 runtime.
>
> AFAIK it should be possible to build with Visual Studio 2010 but to 
> target the .NET 2.0 runtime for example. That said, I am totally flat 
> out at the moment and don't know when I will get a chance to do 
> this... So you will probably get faster results if you build yourself.
>
>
> The SimpleITK FAQ does say that Visual Studio 9 is currently
>
> problematic
>
>
>
> http://www.itk.org/Wiki/ITK_Release_4/SimpleITK/FAQ#Currently_Problema
>
> tic but looking at the SimpleITK dashboard
>
>    http://open.cdash.org/index.php?project=simpleITK
>
> I notice there is one Visual Studio 2008 (aka Visual Studio 9) build 
> (an x86 build), so it does seem possible to build SimpleITK with VS9.
>
>
> Brad owns this build machine, so I've cc'd him. Hopefully he can 
> provide some advice on how to setup VS9 to support TR1/C99.
>
>
> Cheers, Dan
>
>
> On 31 March 2012 05:34, Scott Johnson <Scott.Johnson at neuwave.com> wrote:
>
> Hello,
>
>
>
>
> I've been attempting to use SimpleITK under Windows 7 (x64) and
>
> Visual Studio 2008 and CMake 2.8.5.  The goal is to use the C# wrappers.
>
>
>
>
> First, I downloaded SimpleITK-0.4.0-CSharp-Win64-anycpu.zip and
>
> attempted to add a reference to SimpleITKCSharpManaged.dll to my
>
> solution.  VS didn't recognize the dll as being valid.  (Now I'm
>
> assuming that the dll was built against VS 2010 and isn't backward
>
> compatible.)
>
>
>
>
> I then downloaded the source tree with the intent to build it myself.
>
> (I've tried with both the source package from sourceforge and
>
> checking out the most recent code from GIT.)  I have been attempting
>
> to follow the directions at
> http://www.itk.org/Wiki/ITK_Release_4/SimpleITK/FAQ.
>
>
>
>
> When I first ran CMake I was given an error reading:
>
>
>
>
> CMake Error at CMakeLists.txt:117 (message):
>
>
> SimpleITK requires usage of C99 stdint.
>
>
> It may be available as an optional download for your compiler.
>
>
> Please see the FAQ for details and to see if your compiler is supported.
>
>
> http://www.itk.org/Wiki/ITK_Release_4/SimpleITK/FAQ#Do_I_need_to_down
>
> l
>
> oad_an_optional_package_for_C99.3F
>
>
>
>
> I downloaded the Visual C++ 2008 Feature Pack Release via the link on
>
> the web site and attempted to install it.  It failed because the
>
> installer said that I didn't have the proper features installed for
>
> the update.  I also grabbed the stdint.h file and copied it to the
>
> location called out in the directions.  I've searched for a 64 bit
>
> version of this feature pack with no luck.  I did find Microsoft
>
> Visual C++ 2008 Feature Pack Redistributable Package (x64) but that 
> didn't help.
>
>
>
>
> CMake continues to give me errors and I've tracked the initial error
>
> to a line in the CMakeLists.txt file which reads:
>
>
> check_include_file_cxx( stdint.h SITK_HAS_STDINT_H )
>
>
> I've been looking around to find out what paths are searched by
>
> check_include_file_cxx to no avail.  But evidently C:\Program
>
> Files\Microsoft Visual Studio 9/0\VC\include isn't one of them.
>
>
>
>
> If possible I'd like to get this to work under VS 2008 and I'd
>
> appreciate any help I can get.  Right now I'm out of ideas as to what 
> is going wrong.
>
>
>
>
> Thanks
>
>
>
>
>                                 -- Scott
>
>
>


More information about the Insight-users mailing list