Porting Math 6.1.8 to Redhat Linux 6.0 (Linux 2.2.5-15)

Article ID: 831
Last updated: 31 Jan, 2008
Article ID: 831
Last updated: 31 Jan, 2008
Revision: 1
Views: 9664
Posted: 15 Dec, 1999
by Dean J.
Updated: 31 Jan, 2008
by Dean J.
Problem


Math 6.1.8 is not supported on Linux and a port is needed.


Cause


Math 6.1.8 currently does not support the Linux operating system. This is because certain changes are needed to make the code function on Linux. The following changes should work for you. WARNING: These changes are not supported by RogueWave Software in any form.

 




Action


Porting Math 6.1.8 to Redhat 6.0 Linux (Kernel 2.2.5-15):

A few path definitions:

  • <SPMDIR> is the directory you directed SPM to install in. This directory will contain a bin directory, a scripts directory, a psinfo.in config file, among others.

     

  • <RWDIR>is the directory that you chose as your RW root (when SPM asks where you want to install the products). This directory contains a parts directory and a workspaces directory and is commonly is the same as <SPMDIR>.

     

  • <RWDIR>/parts/mth0618/source/mathcore/src will be considered the <SOURCEDIR> directory

     

  • <RWDIR>/parts/mth0618u/examples will be considered the <EXAMPLESDIR> directory

  1. Edit <SOURCEDIR>/rw/math/dcomplex.h

    • You will need to edit the definition of DComplex in this file for Linux. Linux does not have a Complex class. Also, the include file is in a different location.

       

    • Find the section for GNU/GPP. This should be delimited by comments. It will have the definition for DComplex typedef'd to Complex and an include statement for #include <complex.h>

       

    • You will need to change the typedef so that DComplex is typedef'd to double_complex

       

    • You will need to change the #include to #include <g++-2/complex.h> or <g++-3/complex.h>. The complex.h in /usr/include will not work! Check out your system to see which include directory the file complex.h is in, out of the two above.

     

  2. Edit <SOURCEDIR>/rw/math/mathvec.h

    • You will need to change some of the function definitions to tell GNU that they are functions that are templatized on a type. Otherwise, you will get warnings. This is a new standard, and most compilers don't force this, but GNU will complain.

       

    • Find the definition of toVec(). Change the definition from:

       

       friend RWMathVec<T> rwmathexport toVec( const RWMathArray<T, M>&);  
      to
       friend RWMathVec<T> rwmathexporttoVec<>( const RWMathArray<T, M>&); 

     

  3. Edit /rw/math/mathvec.cc

    • You will need to add an implementation for a function so that the scoping will work.

       

    • Add the implemenation for toVec() from the end of mtharray.cc to the end of mathvec.cc (before the last endif and includes)

       

    • Add a wrapper macro around this definition, otherwise you will get redefinition errors:

       

       #ifndef RW_TO_VEC #define RW_TO_VEC toVec() ... ... #endif 

       

    • Find all register keywords that don't have a type and add int for the type. This is because before int was assumed if no type was specified. In GNU it needs to be explicit:

       

       register n = ...  
      to
       register int n = ... 

     

  4. Edit <SOURCEDIR>/rw/math/mtharray.h

    • You will need to add <>'s in here as well to tell GNU about templatized functions.
    • Find the declaration for toGenMat, toScalar, and toVec and add <>'s after the function name and before the ( that begins the parameter list.

     

  5. Edit <SOURCEDIR>/rw/math/genmat.h

    • Like above, add <>'s to the toGenMat function to tell GNU that it is a template funciton

     

  6. Edit <SOURCEDIR>/rw/math/genmat.cc

    • Add the implementation for toGenMat() from the end of mtharray.cc to the end of genmat.cc, before the endif and last includes. Also add the wrappers to prevent redefinitions:

       

       #ifndef RW_TO_GENMAT #define RW_TO_GENMAT toGenMat()... #endif 

     

  7. Edit <SOURCEDIR>/rw/math/mthvecpk.cc

    • Add int after register keywords with no type, as above.

     

  8. Edit <EXAMPLESDIR>/etc/UNIX/makefile.in

    • You will need to make a few changes in this makefile template so that the targets build correctly.

       

    • Remove example9 and exampl10 targets from $(RWPROGRAMS) variable and add example9 and exampl10 targets to the all target.

     

  9. Edit <EXAMPLESDIR>/etc/modify

    • You will need to change this file so that the complex lib is not included (there is no complex lib for Linux).

       

    • Find the only occurence of complex. It should be in a line like this:

       

       @^RWOSLIBS=@& -lcomplex@ 
      Change it to:
       @^RWOSLIBS=@& @ 

     

  10. Edit <SPMDIR>/support/mth0618u.rw

    • You will need to change this so that you can direct the SPM to let you build Math for Linux.

       

    • Add to the bottom of this file:

       

       OS:LINUX,2.2 	CO:EGCS,1.1.2 

     

  11. Now you can either run: rwspm -t<BUILD num> -flinux_gnu.in -p<SPMDIR> -p<RWDIR>/parts/mth0618u from the scripts <SPMDIR>/directory for a command line build, or you can launch the SPM GUI and direct it to build Math for a Linux environment.

This procedure should work for most versions of Math close to 6.1.8, so just try substituting in the version number for the part.

DISCLAIMER: THIS PROCEDURE IS NOT SUPPORTED BY ROGUEWAVE SOFTWARE. IT IS INTENDED AS A STARTING POINT FOR YOUR OWN PORTING EFFORTS. THE MAXIMUM CARE HAS BEEN TAKEN TO ENSURE THAT THE ABOVE INFORMATION IS CORRECT AND WILL WORK ON YOUR PLATFORM, HOWEVER ROGUEWAVE TECHNICAL SUPPORT CANNOT BE EXPECTED TO SUPPORT THIS COMBINATION OF PRODUCT AND PLATFORM SHOULD THE ABOVE NOT WORK.

Good luck!

 

This article was:   Helpful | Not helpful
Report an issue
Article ID: 831
Last updated: 31 Jan, 2008
Revision: 1
Views: 9664
Posted: 15 Dec, 1999 by Dean J.
Updated: 31 Jan, 2008 by Dean J.

Others in this category