Cygwin Installation

The Cygwin toolkit provides Unix tools on the Windows platform. You need only install the Cygwin toolkit if you are rebuilding from source and intend to develop your own actors using Java.

Note that compile your own actors, you will also need the javac compiler. The javac compiler is part of the JDK, which is available at: http://www.oracle.com/technetwork/java/javase/downloads/index.html. The javac compiler is not present in the Java Runtime Environment (JRE)

The Cygwin home page is at http://sources.redhat.com/cygwin/

Complete installation instructions can be found at http://sources.redhat.com/cygwin/faq.

Installing Cygwin from the self-extracting executable

Compiling the Ptolemy II Matlab interface and Java Native Interface (JNI) actor requires that the a C compiler be installed. The Matlab interface requires that Matlab be installed on the local machine.

Under Windows, to build the Matlab interface, you must use Mingw from http://www.mingw.org.
The gcc compiler is fairly large, so we provide four separate self-extracting downloads of the Cygwin tools and MinGW for Windows.

  1. cygwin-basic-20100224.zip (23.8 Mb) - The tools necessary to compile and configure Ptolemy II except for the Matlab interface and C code generation.
  2. cygwin-devel-20100224.zip (97.4 Mb) - The tools necessary to compile and configure Ptolemy II including the Matlab interface and the JNI Actor. This download includes everything in cygwin-basic-20100224.zip above.
  3. The sources for the above downloadables can be found in cygwin-devel-src-20100224.zip (270 Mb) This download includes just the sources and should be downloaded in the same directory as one of the other zip files above.
  4. mingw20100511.zip (30.8 Mb) - Mingw necessary to compile the Ptolemy/Matlab interface

Cygwin Installation instructions

  1. Most Ptolemy II users will
    Download cygwin-basic-20100224.zip (23.8 Mb)
    If you are running under Windows and have Matlab installed on your local machine, then
    Download cygwin-devel-20100224.zip (97.4 Mb).
    The files will be extracted to an seemingly arbitrary directory. You may find it easier to change the directory to something short, like c:\temp\cygwin.
  2. Find the download and click on INSTALL.bat. This script will invoke setup.exe for you.
  3. After installation, you may remove the temporary directory in which the zip file was unzipped.
  4. c:/cygwin/etc/passwd is created during the Cygwin installation. If your Windows account is a domain account and not a local account, then you may need to add an entry to c:/cygwin/etc/passwd by hand.
    To do this, start up the Cygwin bash shell with Start ->?Cygwin
    Then use the mkpasswd command to append a line with your login information, for example, I used:
    mkpasswd -l > /etc/passwd
    mkpasswd -d -u cxh --path-to-home=/cygdrive/c/users >> /etc/passwd
    
    
    mkpasswd -h will print out help for the mkpasswd command
  5. Set bash to ignore carriage returns '\r' The problem is that shell scripts such as $PTII/bin/vergil will fail:
    $ export PTII=c:/user/ptII
    $ $PTII/bin/vergil
    c:/user/ptII/bin/vergil: line 30: $'\r': command not found
    c:/user/ptII/bin/vergil: line 40: $'\r': command not found
    c:/user/ptII/bin/vergil: line 43: $'\r': command not found
    c:/user/ptII/bin/vergil: line 48: $'\r': command not found
    c:/user/ptII/bin/vergil: line 67: syntax error near unexpected token `$'in\r''
    ':/user/ptII/bin/vergil: line 67: `    case "`uname -s`" in
      

    Another possible solution is to create a ~/.bash_profile that contains

    export SHELLOPTS
    set -o igncr
    
    To find your home directory, start up Cygwin bash and type cd;pwd. Then use an editor like Wordpad. See also:
  6. Another possibility is to use perl to convert the \r\n characters to \n:
    perl -i -pne "s/\r\n/\n/g" configure
    
  7. Follow the instructions in the Set the value of the PTII environment variable section

 Installing Mingw for Windows

The default gcc compiler shipped with Cygwin will produce .dll files that do not work properly.  The solution is to install Mingw.

You may either install from the Ptolemy Mingw zip file or install from the Mingw website.

Installing from the Ptolemy Mingw zip file

  1. Download the mingw20100511.zip file.
  2. Unzip it so that c:\mingw is created.
  3. Add c:\mingw\bin to your PATH, see below.

Installing from the Mingw website

  1. Install Cygwin either from http://www.cygwin.com or from the Ptolemy distribution.
  2. Start Cygwin bash, create c:\mingw
  3. mkdir c:/mingw
    cd c:/mingw
  4. Copy the mingwdl.sh script from http://www.mingw.org/wiki/HOWTO_Install_the_MinGW_GCC_Compiler_Suite and paste it into an editor and create c:/mingw/mingwdl.sh
  5. Execute mingwdl.sh, which will download the binaries into c:/mingwdl.
    bash mingwdl.sh
  6. Unzip the .tar.gz files
    gunzip *.gz
  7. Uncompress the .tar.lzma files:
    lzma -d *.lzma
  8. untar the .tar files.  Create a script called mingwuntar.sh:
    #!/bin/sh
    tars=`ls *.tar`
    for tar in $tars
    do
        echo $tar
        tar -xf $tar
    done
  9. Run mingwuntar.sh
    bash mingwuntar.sh
  10. Add c:\mingw\bin to your Windows path Based on the Mingw instructions:
    1. Right-click on "My Computer" and select "Properties".
    2. Click Advanced | Environment Variables.
    3. In the box entitled "System Variables" scroll down to the line that says "PATH" and double-click the entry.
    4. You will be presented with a dialog box with two text boxes, the bottom text box allows you to edit the PATH variable. It is very important that you do not delete the existing values in the PATH string, this will cause all sorts of problems for you!
    5. Scroll to the end of the string and at the end add ";C:\mingw\bin". Don't forget the semicolon; this separates the entries in the PATH.
    6. press OK | OK | OK and you are done.

Installing Cygwin from the Web

We provide prebuilt downloads of the subset of Cygwin tools needed to recompile Ptolemy II. The Cygwin tools are constantly being updated, for the latest versions, see the Cygwin website.

Instructions for installing Cygwin from the Cygwin website can be found on the for Ptolemy II Installation Page

Enabling Copy in Cygwin Bash under XP

You may need to enable copy and paste in the bash shell window.

If copy and paste are working properly, then you should be able to highlight text by left clicking and dragging the mouse over the text and then hitting the Enter key to copy the highlighted text.

The Cygwin faq at http://www.cygwin.com/faq/faq.html#SEC55 says:

How can I copy and paste into Cygwin console windows?

Under Windows NT, open the properties dialog of the console window. The options contain a toggle button, named "Quick edit mode". It must be ON. Save the properties.

Under Windows 9x, open the properties dialog of the console window. Select the Misc tab. Uncheck Fast Pasting. Check QuickEdit.

You can also bind the insert key to paste from the clipboard by adding the following line to your .inputrc file:

    "\e[2~": paste-from-clipboard 
More precisely:
  1. Start up bash by doing Start -> Programs -> Cygwin -> Cygwin Bash Shell.
  2. Right click on the icon in the upper left of the title bar and select properties
  3. Under Options, select 'QuickEdit Mode', hit ok
  4. Select 'Modify shortcut that started this window', hit ok

Cygwin download contents

The download of basic cygwin tools from February, 2010 includes:

_update-info-dir-00865-1
alternatives-1.3.30c-10
base-cygwin-2.1-1
base-files-3.9-3
base-passwd-3.1-1
bash-3.2.49-23
bison-2.4.1-1
bzip2-1.0.5-10
coreutils-7.0-2
crypt-1.1-1             required by cvs
csih-0.9.1-1
cvs-1.12.13-10
cygrunsrv-1.34-1
cygutils-1.4.2-1
cygwin-1.7.1-1
cygwin-doc-1.5-1
dash-0.5.5.1-2
diffutils-2.8.7-2
editrights-1.01-2
expat-2.0.1-1
findutils-4.5.5-1
gawk-3.1.7-1
gettext-0.17-11
grep-2.5.4-2
groff-1.19.2-2
gzip-1.3.12-2
ipc-utils-1.0-1
less-429-1
libapr1-1.3.8-2
libaprutil1-1.3.9-2
libbz2_1-1.0.5-10      required by tar
libdb4.2-4.2.52.5-2
libdb4.5-4.5.20.2-2
libexpat1-2.0.1-1
libexpat1-devel-2.0.1-1
libgcc1-4.3.4-3
libgdbm4-1.8.3-20     required by cvs
libgmp3-4.3.1-3
libiconv2-1.13.1-1     required by sed
libintl3-0.14.5-1
libintl8-0.17-11
liblzma1-4.999.9beta-10
libncurses8-5.5-10
libncurses9-5.7-16
libneon27-0.29.0-1
libopenldap2_3_0-2.3.43-1
libpcre0-8.00-1    Required by less (pcre = Perl Compatible regex)
libpopt0-1.6.4-4
libpq5-8.2.11-1
libreadline7-6.0.3-2
libsasl2-2.1.19-3
libserf0_0-0.3.0-2
libsigsegv0-2.6-1
libsqlite3_0-3.6.21-3
libssp0-4.3.4-3
libstdc++6-4.3.4-3
libwrap0-7.6-20
make-3.81-2-broken
make-3.81-2-from-cmake
man-1.6e-1
minires-1.02-1         required by openssh
openssh-5.3p1-1        required by cvs
openssl-0.9.8l-2       required by openssh
perl-5.10.1-2
rebase-3.0.1-1
run-1.1.12-11
sed-4.1.5-2
subversion-1.6.9-1
tar-1.22.90-1
terminfo-5.7_20091114-13
terminfo0-5.5_20061104-11
texinfo-4.13-3
tzcode-2009k-1
w32api-3.14-1
wget-1.11.4-4
which-2.20-2
xemacs-emacs-common-21.4.22-1
xz-4.999.9beta-10
zlib-1.2.3-10
zlib-devel-1.2.3-10
zlib0-1.2.3-10

The download of devel cygwin tools from February, 2010, includes all the tools from the basic cygwin download listed above and

autoconf-8-1
autoconf2.1-2.13-10
autoconf2.5-2.65-1
binutils-2.19.51-1
gcc-3.4.4-999
gcc-core-3.4.4-999
gcc-g++-3.4.4-999
gcc-mingw-core-20050522-1
gcc-mingw-g++-20050522-1
m4-1.4.13-2
mingw-runtime-3.17-1
perl-5.10.1-2      sadly, autoconf requires perl
w32api-3.14-1
In addition, we include select tools for Viptos, the Ptolemy/TinyOS interface.
automake1.10-1.10.3-1
bison-2.4.1-1
emacs-23.1-10
emacs-el-23.1-10
gperf-3.0.3-1
rpm-4.1-2