Installing Ptolemy 0.7.2 Under Linux

Below are notes about installing under Red Hat 8 in July, 2003 [and also Red Hat 9.0] from source files. You are probably better off using the cvs version and referring to the text below if you have problems.

Note that Ptolemy 0.7.2 requires gcc-2.95.3. You should download the pt0.7.2devel.gnu.tar.gz file and build gcc-2.95.3 from that tar file. Later versions of gcc will not work.

  1. Check out the sources
    cvs -d :pserver:anon@source.eecs.berkeley.edu:/home/cvs/cvsanon login
    # No password needed, hit enter
    cvs -d :pserver:anon@source.eecs.berkeley.edu:/home/cvs/cvsanon co ptclassic
    
    This will create a directory called ptclassic.
  2. Download http://ptolemy.eecs.berkeley.edu/~cxh/ptdevel/pt0.7.2devel.gnu.tar.gz and pt0.7.2devel.other.src.tar.gz
    user:   ptdevel
    password: ptrules
    
    For example, to get it, use wget:
    wget --http-user=ptdevel --http-password=ptrules http://ptolemy.eecs.berkeley.edu/~cxh/ptdevel/pt0.7.2devel.gnu.tar.gz
    wget --http-user=ptdevel --http-password=ptrules http://ptolemy.eecs.berkeley.edu/~cxh/ptdevel/pt0.7.2devel.other.src.tar.gz
    
  3. Then untar and move the gnu and tcltk sources into the ptclassic/ directory
    tar -zxf pt0.7.2devel.gnu.tar.gz 
    mv ptolemy/src/gnu/* ptclassic/src/gnu/
    tar -zxf pt0.7.2devel.other.src.tar.gz 
    mv ptolemy/src/tcltk/itcl3.0.1pt ptclassic/src/tcltk/itcl3.0.1
    mv ptolemy/src/tcltk/tcl8.0.5pt ptclassic/src/tcltk/tcl8.0.5
    mv ptolemy/src/tcltk/tk8.0.5pt ptclassic/src/tcltk/tk8.0.5
    
    • [Red Hat 9.0]: I am logged in as celaine. I have untarred the .tar.gz files in ~/ptclassic. Modify the instructions below accordingly.
  4. Edit $PTOLEMY/.bashrc and change the setting for PTOLEMY to point to your directory, which will be something like /root/ptclassic.
    [Debug version]: To compile the debug version, create $PTOLEMY/.bashrc and add the following instead:
    PTOLEMY=/root/ptolemy
    export PTOLEMY
    
    PTARCH=linux.debug
    export PTARCH
    
    PT_DEBUG=ptgdb
    export PT_DEBUG
    
    PATH=$PTOLEMY/bin:$PTOLEMY/bin.$PTARCH:$PTOLEMY/vendors/bin:$PATH
    
    # To use the X11 pxgraph, follow the instructions
    # in $PTOLEMY/src/pxgraph/README.txt and uncomment the next line.
    PT_USE_X11_PXGRAPH=yes
    export PT_USE_X11_PXGRAPH
    
  5. source /root/ptolemy/.bashrc
    
  6. Start the compile:
    cd $PTOLEMY
    make bootstrap >& boot.out &
    tail -f boot.out
    
  7. If you get messages like:
    mkdir /root/ptolemy/gnu/common/share/locale/de/LC_MESSAGES
     /usr/bin/install -c -m 644 de.mo /root/ptolemy/gnu/common/share/locale/de/LC_MESSAGES/make.mo
    /usr/bin/install: cannot stat `de.mo': No such file or directory
    
    
    Do
    cd $PTOLEMY/obj.linux/gnu/make/i18n
    ln -s  ../../../../src/gnu/src/make/i18n/* .
    
    and restart:
    cd $PTOLEMY
    make bootstrap >& boot2.out &
    
    [Debug version]: The directory name should be obj.linux.debug instead of gobj.linuxg.
  8. While installing tcltk, I got:
    /root/ptolemy/src/tcltk/tcl8.0.5pt/unix/../generic/tclPosixStr.c: In function `
    Tcl_ErrnoId':
    /root/ptolemy/src/tcltk/tcl8.0.5pt/unix/../generic/tclPosixStr.c:340: duplicate
     case value
    /root/ptolemy/src/tcltk/tcl8.0.5pt/unix/../generic/tclPosixStr.c:328: this is t
    he first entry for that value
    
    
    The fix is to edit ~/ptolemy/src/tcltk/tcl8.0.5pt/generic/tclPosixStr.c and comment out the EOPNOTSUPP in two locations This change is in the CVS tree, so it should not be necessary.
                   /*#ifdef EOPNOTSUPP
            case EOPNOTSUPP: return "EOPNOTSUPP";
    #endif
                    */
    
    
    and
                  /*#ifdef EOPNOTSUPP
            case EOPNOTSUPP: return "operation not supported on socket";
            #endif*/
    
    
    I then restarted with
    make install_tcltk
    
    • [Red Hat 9.0]: After making the above fix, I get:
      In file included from
      /home/celaine/ptclassic/ptolemy/src/tcltk/tk8.0.5pt/unix/tkAppInit.c:16:
      /home/celaine/ptclassic/ptolemy/src/tcltk/tk8.0.5pt/unix/../generic/tk.h:78:
      X11/Xlib.h: No such file or directory
      
      The fix is to install XFree86-devel-4.3.0-2.i386.rpm from redhat.com, which will give you the necessary header files. You may also need to install other rpms in the dependency list, including gfontconfig-devel-2.1-9.i386.rpmg and gfreetype-devel-2.1.3-6.i386.rpmg. To reconfigure the build to detect /usr/X11R6/lib/libX11.a, do:
      rm -rf obj.linux/tcltk/
      
      [Debug version]: The directory name should be obj.linux.debug instead of gobj.linuxg. Rerun:
      make install_tcltk
      
  9. Proceed with installing octtools:
    make install_octtools >& oct.out &
    
  10. Proceed with the build
    make install >& install.out &
    
  11. CGTarget fails to compile
    ../../../../src/domains/cg/kernel/CGTarget.cc:703: implicit declaration of func
    tion `int cuserid(...)'
    
    This change is in the CVS tree, so it should not be necessary.
    >The change is to comment
          //msg   << "User:      " << cuserid(NULL) << "\n"
    
    and use
          msg     << "User:      " << getlogin() << "\n"
    
  12. vhdl/targets/SynthTarget.cc needs a similar change
    This change is in the CVS tree, so it should not be necessary.
            //      comCode << "designer = \"" << cuserid(NULL) << "\"" << "\n";
    
            comCode << "designer = \"" << getlogin() << "\"" << "\n";
    
    
    As does SynthArchTarget.cc
    This change is in the CVS tree, so it should not be necessary.
  13. acs/targets/StringArray.cc fails with
    ../../../../src/domains/acs/targets/StringArray.cc:90: implicit declaration of function `int strcat(...)'
    
    The fix is to add
    #include <string.h>
    

    This change is in the CVS tree, so it should not be necessary.
  14. acs/stars fails to link with
    ACSRamDelayFixSim.o(.data+0x0): multiple definition of `star_nm_ACSRamDelayFixSim'
    ACSRamDelayFixSim.o(.data+0x0): first defined here
    
    The fix is to edit acs/stars/make.template and find the second instance of ACSRamDelayFixSim.pl and remove it and the remaining .pl files.
    This change is in the CVS tree, so it should not be necessary.
    [root@dhcp-43-60 stars]# diff -c make.template.old make.template 
    *** make.template.old   2003-07-15 18:05:10.000000000 -0700
    --- make.template       2003-07-15 18:01:06.000000000 -0700
    ***************
    *** 89,105 ****
        ACSUnPackBits.pl ACSUnPackBitsCGFPGA.pl ACSUnPackBitsFixSim.pl \
        ACSXMGraph.pl ACSXMGraphCGFPGA.pl ACSXMGraphFPCGC.pl ACSXMGraphFPSim.pl ACS\
    XMGraphFixSim.pl \
        ACSXYgraph.pl ACSXYgraphCGFPGA.pl ACSXYgraphFPCGC.pl ACSXYgraphFPSim.pl ACS\
    XYgraphFixSim.pl \
    -   ACSRamDelayFixSim.pl \
    -   ACSRamp.pl ACSRampCGFPGA.pl ACSRampFPCGC.pl ACSRampFPSim.pl ACSRampFixSim.p\
    l \
    -   ACSShift.pl ACSShiftCGFPGA.pl ACSShiftFPSim.pl ACSShiftFixSim.pl \
    -   ACSSin.pl ACSSinCGFPGA.pl ACSSinFPCGC.pl ACSSinFPSim.pl ACSSinFixSim.pl \
    -   ACSSink.pl ACSSinkCGFPGA.pl ACSSinkFPCGC.pl ACSSinkFPSim.pl ACSSinkFixSim.p\
    l \
    -   ACSSource.pl ACSSourceCGFPGA.pl ACSSourceFPCGC.pl ACSSourceFPSim.pl ACSSour\
    ceFixSim.pl \
    -   ACSSqrt.pl ACSSqrtCGFPGA.pl ACSSqrtFPCGC.pl ACSSqrtFPSim.pl ACSSqrtFixSim.p\
    l \
    -   ACSSub.pl ACSSubCGFPGA.pl ACSSubFPCGC.pl ACSSubFPSim.pl ACSSubFixSim.pl \
    -   ACSUniSeq.pl ACSUniSeqCGFPGA.pl \
    -   ACSXMGraph.pl ACSXMGraphCGFPGA.pl ACSXMGraphFPCGC.pl ACSXMGraphFPSim.pl ACS\
    XMGraphFixSim.pl \
    -   ACSXYgraph.pl ACSXYgraphCGFPGA.pl ACSXYgraphFPCGC.pl ACSXYgraphFPSim.pl ACS\
    XYgraphFixSim.pl
    
      # The .cc files
      SRCS=$(PL_SRCS:.pl=.cc)
    --- 89,94 ----
    
    
  15. pxgraph fails to compile
    ../../../src/pxgraph/pxgraph/xgraph.h:77:21: macro "strchr" requires 2 arguments, but only 1 given
    
    The fix is to edit ptolemy/src/pxgraph/pxgraph/xgraph.h and comment out the declaration of strchr
    This change is in the CVS tree, so it should not be necessary.

    Then run make install
  16. Run a sample demo by doing
    cd $PTOLEMY
    ptiny src/domains/sdf/demo/butterfly
    
    After the Ptolemy Welcome Window comes up, move the mouse over the model and type a capital R to run it.
  17. When running a model that uses the Java version of pxgraph, the output is screwy. For example, the butterfly model results in in the 10^38 range. The problem here is with the binary data format of the Java version of pxgraph. The solution is to use the X11 version of pxgraph by doing:
    PT_USE_X11_PXGRAPH=yes
    export PT_USE_X11_PXGRAPH
    
    (The sample .bashrc above has been adjusted accordingly)
    • [Red Hat 9.0]: If it complains that it cannot find ptiny, run make install in gobj.linux/pigiRpcg and then run
      cd $PTOLEMY
      make bin/pigi
      
      $PTOLEMY/bin/pigi is merely a symbolic link that from $PTOLEMY/bin/pigiEnv.sh.
    • [Red Hat 9.0]: I get the following message in the terminal window after clicking on "Go":
      /home/celaine/ptclassic/ptolemy/bin/pxgraph: Could not find /home/celaine/ptclassic/ptolemy/bin.linux/pxgraph.x11
          $PT_USE_X11_PXGRAPH was set, so Ptolemy is attempting to
          use the X11 pxgraph instead of the Java pxgraph.
          See /home/celaine/ptclassic/ptolemy/src/pxgraph/README.txt for more information
      
      cd to gobj.linux/pxgraphg and run gmake installg. I got the following errors:
      In file included from ../../../src/pxgraph/pxgraph/xgout.h:37,
                       from ../../../src/pxgraph/pxgraph/xgraph.c:47:
      ../../../src/pxgraph/pxgraph/xgraph.h:74: macro `strcpy' used without args
      
      and
      gcc -c -O3 -fomit-frame-pointer  -Wall -Wcast-align -Wsynth -Dlinux -D_REENTRANT -DI_UNISTD  -I../../../src/pxgraph/pxgraph -I/usr/X11R6/include -DNEED_STRICMP=1   ../../../src/pxgraph/pxgraph/xtb.c
      ../../../src/pxgraph/pxgraph/xtb.c:77: macro `strcpy' used without args
      
      Comment out the lines in src/pxgraph/pxgraph/xgraph.h and gsrc/pxgraph/pxgraph/xtb.cg that say:
      extern char *strcpy();
      
      Rerun make install
    [Debug version]: The directory name should be obj.linux.debug instead of gobj.linuxg.
  18. [Debug version]: Try to run pigi. If you get this error message, it is not running the correct binary:
    pigi: /home/celaine/ptclassic/ptolemy/bin.linux.debug/pigiRpc.debug does not exist or is not
           executable. Using /home/celaine/ptclassic/ptolemy/bin.linux.debug/pigiRpc instead.
    
  19. [Debug version]: In obj.linux.debug/pigiRpc:
    make pigiRpc.ptrim.debug
    
    Try to run ptrim -debug. The following error message is ok:
    ptrim: /home/celaine/ptclassic/ptolemy/bin.linux.debug/pigiRpc.ptrim.debug does not exist or is not
           executable. Using /home/celaine/ptclassic/ptolemy/obj.linux.debug/pigiRpc/pigiRpc.ptrim.debug instead.