Difference between revisions of "Slicer3:Build Instructions Windows"

From Slicer Wiki
Jump to: navigation, search
(Added note about file not found problem due to too long Slicer directory path)
m (Changed formatting)
Line 111: Line 111:
 
===Troubleshooting===
 
===Troubleshooting===
  
'''Problems with Python compilation'''
+
====Problems with Python compilation====
  
 
Python can only be built on Visual Studio 9 (2008) for windows. Python compilation shall be disabled if Slicer is built with an earlier Visual Studio version (otherwise Python compilation fails and Slicer build is not completed).  The disabling is automatically done in Slicer 3.5 versions after January 20, 2010. To compile an earlier Slicer version with a compiler other than Visual Studio 9 the following shall be performed to disable Python usage:
 
Python can only be built on Visual Studio 9 (2008) for windows. Python compilation shall be disabled if Slicer is built with an earlier Visual Studio version (otherwise Python compilation fails and Slicer build is not completed).  The disabling is automatically done in Slicer 3.5 versions after January 20, 2010. To compile an earlier Slicer version with a compiler other than Visual Studio 9 the following shall be performed to disable Python usage:
Line 135: Line 135:
 
and set USE_PYTHON to "OFF".
 
and set USE_PYTHON to "OFF".
  
'''Problems with svn checkout during build'''
+
====Problems with svn checkout during build====
  
 
This hint was contributed by Wolfgang Schramm, [http://massmail.spl.harvard.edu/pipermail/slicer-devel/2009/003229.html see his original post on slicer-devel list]
 
This hint was contributed by Wolfgang Schramm, [http://massmail.spl.harvard.edu/pipermail/slicer-devel/2009/003229.html see his original post on slicer-devel list]
Line 157: Line 157:
 
</pre>
 
</pre>
  
'''No SLN files created for VTK, ITK, KWWidgets'''
+
====No SLN files created for VTK, ITK, KWWidgets====
  
 
'''cvs [checkout aborted]: cannot rename file CVS/Entries.Backup to CVS/Entries: permission denied'''
 
'''cvs [checkout aborted]: cannot rename file CVS/Entries.Backup to CVS/Entries: permission denied'''
Line 165: Line 165:
 
-Greg Sharp, Nov 24, 2009.
 
-Greg Sharp, Nov 24, 2009.
  
'''Existing files with long name cannot be found during compilation with Visual Studio 8'''
+
====Existing files with long name cannot be found during compilation with Visual Studio 8====
  
 
The maximum path length in Windows is limited (http://www.developmentnow.com/g/55_2006_10_0_0_833954/Length-of-the-full-path-exceeds-the-maximum-path-length-allowed-.htm). If Slicer is checked out into a directory with a long full path name, then the Visual Studio 8 compiler cannot find some files (typically longer file names in project with long names) and gives the ''fatal error C1083: Cannot open source file'' error. To avoid this error Slicer shall be installed in a directory with a short path. A full path of 45 characters was used successfully, a path longer than 50 is known to cause problems.
 
The maximum path length in Windows is limited (http://www.developmentnow.com/g/55_2006_10_0_0_833954/Length-of-the-full-path-exceeds-the-maximum-path-length-allowed-.htm). If Slicer is checked out into a directory with a long full path name, then the Visual Studio 8 compiler cannot find some files (typically longer file names in project with long names) and gives the ''fatal error C1083: Cannot open source file'' error. To avoid this error Slicer shall be installed in a directory with a short path. A full path of 45 characters was used successfully, a path longer than 50 is known to cause problems.

Revision as of 02:36, 21 January 2010

Home < Slicer3:Build Instructions Windows

Note: this process can take several hours to complete.

Prerequisites

  • Windows XP, Vista, 7
  • Fast network connection, no firewalls blocking cvs ports
  • About 10G free disk space
  • Fast CPU and Disk

Installing Cygwin

Go to the following web page

You will get a pop-up window asking if you want to run or save this file. Click 'Run'. If a security warning pops up asking if you are sure you want to run the software, click 'Run' again.

If you minimize your web browser window, you should now see a window titled 'Cygwin Net Release Setup Program'. Click 'Next.'

Select 'Install from Internet', and click 'Next.'

The defaults are fine for the Choose Installation Directory page, click 'Next'

The default for Select Local Package Directory is also fine, click 'Next'

For 'Select Your Internet Connection', choose 'Direct Connection' and click 'Next'

Any of the download sites are fine to use. Click 'Next'

You will now see a page titled 'Select Packages'. In the upper right hand corner, there is a button labeled 'View'. Click the 'View' button once to change the view to 'Full', and maximize the window so you can see all of the columns.

The package names are on the right. On the left, you'll see that each package is labeled 'Skip', 'Keep', or has a version number. We want to install these packages in addition to the defaults:

  • curl
  • cvs
  • subversion
  • tcltk
  • unzip
  • zip

For each of these packages, click on 'Skip' so that a version number appears. After you have clicked on all of the above packages, click 'Next'.

At this point, Cygwin will start the download and install.

After the installation, you will see a 'Create Icons' screen. The defaults are fine; click 'Finish'

You should now have an icon on your desktop that looks like a black C with a green arrow. Double click the icon to start Cygwin.

Installing Microsoft Visual Studio Express

Go to the following webpage.

A window may pop up saying that you need to install Microsoft Silverlight. Click 'Enable Silverlight'

Halfway down the page, there is a brown box labeled Microsoft Visual C++ 2008 Express Edition. Click the 'Download' link inside that box.

A pop up window will ask if you want to run or save this file. Click 'Run'

A setup window and progress bar will now appear. After that finishes, you will see a 'Welcome to Setup' page. Click 'Next'

Select 'I have read and accept the license terms' and click 'Next'

Don't select MSDN Express, SQL server, or Microsoft Silverlight Runtime. Click 'Next'

The default Destination Folder is fine. Click 'Next'

You will now see another progress bar, and the compiler will begin installing.

When the Setup Complete window appears, click 'Exit'. You will now have to restart your computer to finish the installation.

Building Slicer

After your computer reboots, double-click on the Cygwin icon on your desktop to open a Cygwin shell.


To avoid problems with permissions on Vista/7, it is best to run the build process in a cygwin shell that has Administrator rights. See this page for instructions: http://www.lamnk.com/blog/computer/run-cygwin-on-vista-as-administrator/


Type the following command at the Cygwin prompt:

svn co http://svn.slicer.org/Slicer3/trunk Slicer3

After the checkout completes, type:

./Slicer3/Scripts/getbuildtest.tcl


This will fail, but will set up a mostly correct directory structure. Type:

rm -rf Slicer3-lib/CMake-build

Further Notes on Vista build

Note: these instructions are probably not needed if you run cygwin as administrator using the instructions above

It may be necessary to add the option -t "" to the getbuildtest.tcl calls:

./Slicer3/Scripts/getbuildtest.tcl -t ""

This disables Dart submissions, which initially caused an error for me due to missing file "DartConfiguration.tcl" (though this was probably due to the permissions issue next).

Depending on account permissions, the final getbuildtest.tcl step may fail on Vista with the message 'Fatal error: lnk1104 cannot open file "TempFile"' when CMake attempts to build the compiler test "cmTryCompileExec". This seems to be due to Vista 'User Account Control' blocking access to temp directories.

If Administrator account is available, one option is to disable UAC. Go to Control Panel->User Accounts->"Turn User Account Control on or off" (see forum posting) This requires a computer restart.


This is how I was able to successfully build on Vista (inorton):

Another option is to run cygwin xterm as administrator. Go to *\Cygwin\bin (for new installs; old installs it will be in *\Cygwin\usr\X11R6\bin). Right-click on "xterm" and select "Run as administrator". A wrapper script may be needed to run xterm with correct DISPLAY, see Slicer3:xterm wrapper. Confirm Run-as. Once xterm is running as Administrator, follow the above steps to run getbuildtest.tcl. I had to run the final getbuildtest.tcl step twice to get a successful build. The first time, all of the libraries built correctly but GenerateLM ran all night at 80% CPU and seemed.. stuck in the morning. I killed the process (through Task Manager, the processes are detached from cygwin); then re-ran getbuildtest. The second time, all libraries were skipped (correctly) and GenerateLM finished in 15 minutes (this produced a functioning binary). I ran a third time without the -t "" option, in order to try the tests and Dashboard submission (which worked).

A third option would be to change CMake and/or getbuildtest to use a known-writable TMP and TEMP directory (within the Slicer build tree?). Not sure how to do this yet.

Troubleshooting

Problems with Python compilation

Python can only be built on Visual Studio 9 (2008) for windows. Python compilation shall be disabled if Slicer is built with an earlier Visual Studio version (otherwise Python compilation fails and Slicer build is not completed). The disabling is automatically done in Slicer 3.5 versions after January 20, 2010. To compile an earlier Slicer version with a compiler other than Visual Studio 9 the following shall be performed to disable Python usage:

Edit the file

./Slicer3/slicer_variables.tcl

# getbuildtest Option for build using system Python, should be "true" or "false"
set ::USE_SYSTEM_PYTHON "false"
# CMake option for Python, must be "OFF" on "ON", default is "ON"
set ::USE_PYTHON "ON"

# CMake option for numerical Python, only matters if Python is on
set ::USE_NUMPY "ON"
# getbuildtest option for SCIPY - also build support libraries (blas and lapack) needed for scipy
# - should be off except for experimentation (does not work on all plaftorms - requires fortran)
# - should be "true" or "false"
set ::USE_SCIPY "false"

and set USE_PYTHON to "OFF".

Problems with svn checkout during build

This hint was contributed by Wolfgang Schramm, see his original post on slicer-devel list

[A problem can be] caused by an incomplete checkout of the VTK (and
ITK, KWWIDGETS,...) libraries. This bug is not reproducible (at least I'm
the only one I knew who had this problem).
I have the following workaround: 

1) Install TortoiseCVS
2) Do a complete slicer build and let it fail.
3) Do a CVS update on EVERY library which is under CVS (SVN checkouts work
fine) - be careful with Batchmake since this is not only one cvs projects
but several.
4) Build as described by the wiki.

Also if you have VS2005 and VS 2008 installed on the same computer you may
comment out the lines for the VS you don't want to use in
slicer_variables. ''

No SLN files created for VTK, ITK, KWWidgets

cvs [checkout aborted]: cannot rename file CVS/Entries.Backup to CVS/Entries: permission denied

These are also problems with cvs checkout. Try disabling the on-demand scan of Windows Security Essentials (or other anti-virus). This solved the problem for me on Windows 7.

-Greg Sharp, Nov 24, 2009.

Existing files with long name cannot be found during compilation with Visual Studio 8

The maximum path length in Windows is limited (http://www.developmentnow.com/g/55_2006_10_0_0_833954/Length-of-the-full-path-exceeds-the-maximum-path-length-allowed-.htm). If Slicer is checked out into a directory with a long full path name, then the Visual Studio 8 compiler cannot find some files (typically longer file names in project with long names) and gives the fatal error C1083: Cannot open source file error. To avoid this error Slicer shall be installed in a directory with a short path. A full path of 45 characters was used successfully, a path longer than 50 is known to cause problems.