Cygwin Build Instructions
The most current information about compiling AFNI is in HOWTO #00.
How to Run AFNI on Microsoft Windows Using Cygwin
The Cygwin system is a Unix emulation environment that runs on Microsoft Windows (supposedly on 95/98/NT/ME/2000/XP, but I've only tried it on Microsoft Windows 2000 and 98). AFNI has been modified to work under this environment.
- This does not mean that AFNI is now a native Microsoft Windows applications.
- This does not mean that you don't have to learn about Unix. You will be running AFNI under a Unix emulator, which looks a lot like Linux. For example, to edit files in Cygwin, you use a Unix editor (e.g., vi).
- A possibly-nicer alternative is to install the (non-free) software VMware, which will actually let you run Microsoft Windows inside of Linux, or run Linux inside of Microsoft Windows (whichever you choose).
- Make a folder on your Microsoft Windows system named "cygwin"; I suggest putting this at the top level of your C: drive, but anywhere will work.
- Download the "Install Cygwin now" program (setup.exe) from http://www.cygwin.com and put in into the "cygwin" folder you just created.
- Open that folder, and run the setup.exe program. It will
present a sequence of choices about how and what to
download/install. My choices were:
- Install from Internet (vs. downloading files and installing them later)
- Install root directory = C:/cgywin (the same place I put the
setup.exe program)
- At this screen, I also chose "Unix file type" and "Install for All" as the defaults.
- Do not install Cygwin into the Microsoft Windows desktop directory! You will not be happy with the results.
- Local package directory = C:/cygwin
- I used "Direct Connection" to the Internet
- Cygwin is very big - don't try to download over a modem!
- Up to this point, my choices were all the defaults. Now, you have to choose an FTP site from which actually to install; the setup.exe program puts up a list. From the USA, I used ftp://ftp.sunsite.utk.edu (U Kentucky), which worked well for me. There are mirrors in a number of countries around the world. Clearly, you should choose one near to you.
- If the mirror you select works correctly, you now get a screen
from which you can choose components to install. The default setup
in the "Base" directory is enough if you just want to run
pre-compiled AFNI binaries, but if you want to be able to
compile things yourself, you will also have to get at least the
binutils, gcc, and make packages from the
"Devel" directory. Other things I found useful include:
- "Doc" directory: various man pages
- "Editors" directory: vim
- "Interpreters" directory: m4 -- this is needed by the AFNI build process
- "Net" directory: openssh
- "Shells" directory: bash and tcsh
- "Text" directory: less
- "Utils" directory: bzip2 and cygutils
- "Web" directory: wget
[16 May 2002]: Cygwin now includes XFree86 in its easy-install system. You need to select the following packages from the "XFree86" directory when you run the Cygwin setup.exe program:- XFree86-base (will auto-select most of what you need)
- XFree86-prog (needed to compile AFNI)
- lesstif (needed to compile AFNI)
- fvwm or WindowMaker or some other window manager
- After you have made your Cygwin package choices, you then click "Next" to actually download/install the selected packages. If everything goes well in this somewhat time-consuming process, you will be asked if you want to install a Cygwin icon on the desktop. I did this; it provides a quick way to start up a Unix (bash) shell in a text window.
- At this point, you now need to install the XFree86 package,
which is done in a somewhat different (and harder) fashion. The
official download site with instructions can be found here.
- If you want to be able to compile AFNI yourself (which is what I recommend), you also have to download the LessTif library, which is a freeware clone of Motif. This can be found at http://www.lesstif.org. Binaries for Cygwin are at their SourceForge site, which you can find by poking around at the LessTif site. (This link may also work.)
- For convenience, I have also assembled the necessary files (including LessTif) in local directory cygwin/. Download all the files there to the /tmp directory on your Cygwin, and follow the instructions in the README file.
- If you create a .xinitrc file in your Cygwin home directory
(which will be done if you follow the direction in
"this directory" above), then you can now start the X11 server
by typing "startx &" at the Cygwin command prompt. For
other ways to start the X11 server, read the documentation at the
Cygwin site.
- You'll need to put /usr/X11R6/bin in your PATH. For the bash
shell, you do this by the command
export PATH=/usr/X11R6/bin:$PATH
which you can put in your ~/.bashrc file in order to have it executed whenever you start a new shell.
- The end of file ~/.xinitrc is simply a list of X11 programs to
run after the X11 server starts.
- In the version distributed at this server, it runs 2 xterms and then at the end starts the "twm" window manager. You can edit this part of the file and change these startup applications (including the window manager) to anything you like, of course.
- The xterm layout is setup for my laptop (1400x1050), and so the placement and sizes of the windows may not be good for your system.
- You'll need to put /usr/X11R6/bin in your PATH. For the bash
shell, you do this by the command
- The X11 server creates a super-window on the desktop, inside
which all the X11 windows reside. That is, you can't mingle X11
applications on the desktop with Microsoft Windows applications.
(That capability is apparently in-progress. Hold your breath.)
- The X11 server takes a few seconds to start.
- Its default size is supposed to be the same as your entire display. If you want to change this size, you have to do something like "startx -- -screen 0 800 600 &", which will set the size of the X11 root window to 800x600.
- You can set a bash shell alias (in ~/.bashrc) to make this easy
to do:
alias xx="startx -- -screen 0 800 600"
and then all you have to do to start the X11 server is type "xx &" at a Cygwin prompt.
- At this point, you can now install AFNI.
- If you want to compile AFNI yourself (recommended), then
download the afni_src.tgz file as usual, unpack it, and use
Makefile.cygwin as the Makefile. Be sure to edit the INSTALLDIR
macro in there before typing "make totality_exe" (do
not "make totality"!) at a Cygwin command prompt
(either in the X11 server or in a regular text mode window).
- There are special make rules for compiling the afni.exe program with fixed (compiled-in) plugins. These rules are invoked only with totality_exe, not with totality.
- If you want to use the pre-compiled binaries (compiled on a
Microsoft Windows 2000 machine), then download cygwin.tgz (from the
usual binaries place), and unpack it (into directory cygwin/).
Either put that directory into your PATH, or mv the files therein
to someplace useful (I use /usr/local/abin).
- cygwin.tgz was compiled on a Microsoft Windows 2000 machine (my laptop, to be precise). I don't know if it will work under other Microsoft Windows systems. You may have to recompile the AFNI package yourself to get it to work for you.
- Downloading the source is much smaller than the binaries (4 Mbytes vs. 27 Mbytes).
- Most AFNI command line programs (e.g., 3dinfo) can be run from a Cygwin prompt with or without the X11 server running. This does not apply to those that produce graphics (e.g., 1dplot; to3d with the GUI).
- If you want to compile AFNI yourself (recommended), then
download the afni_src.tgz file as usual, unpack it, and use
Makefile.cygwin as the Makefile. Be sure to edit the INSTALLDIR
macro in there before typing "make totality_exe" (do
not "make totality"!) at a Cygwin command prompt
(either in the X11 server or in a regular text mode window).
Problems
- Details about problems with AFNI on cygwin and cygwin itself are here.
Finally
- Some thoughts on AFNI Cygwin by Bob Cox.