Rate This Document
Findability
Accuracy
Completeness
Readability

Compilation and Installation

Procedure

  1. Use PuTTY to log in to the server as the root user.
  2. Install the dependencies.
    yum install flex-devel
  3. Obtain the source package.
    wget https://download-ib01.fedoraproject.org/pub/epel/7/SRPMS/Packages/n/ncl-6.3.0-6.el7.src.rpm
  4. Install the source package.
    rpm -ivh ncl-6.3.0-6.el7.src.rpm
  5. Go to the SOURCES directory, modify the NCL source package, and repackage the file.
    cd ~/rpmbuild/SOURCES
    tar -zxvf ncl_ncarg-6.3.0.tar.gz
  6. Edit the ncl_ncarg-6.3.0/common/src/libncarg_c/yMakefile file.
    1. Open the ncl_ncarg-6.3.0/common/src/libncarg_c/yMakefile file.
      vi ncl_ncarg-6.3.0/common/src/libncarg_c/yMakefile
    2. Press i to enter the insert mode and modify the content in line 35.
      #elif (defined(ia64) || defined(x86_64) || defined(amd64) || defined(aarch64))

      After performing 6.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  7. Edit the ncl_ncarg-6.3.0/ni/src/lib/nio/yMakefile file.
    1. Open the ncl_ncarg-6.3.0/ni/src/lib/nio/yMakefile file.
      vi ncl_ncarg-6.3.0/ni/src/lib/nio/yMakefile
    2. Press i to enter the insert mode and modify the content in line 85.
      #if defined(IRIX64) || defined(x86_64) || defined(__LP64__) || defined(aarch64)

      After performing 7.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  8. Edit the ncl_ncarg-6.3.0/ni/src/ncl/yMakefile file.
    1. Open the ncl_ncarg-6.3.0/ni/src/ncl/yMakefile file.
      vi ncl_ncarg-6.3.0/ni/src/ncl/yMakefile
    2. Press i to enter the insert mode.

      Modify line 46:

      EXTRA_CCOPTIONS = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -fsigned-char

      Modify line 113:

      #if defined(IRIX64) || defined(x86_64) || defined(ia64) || defined(__LP64__) || defined(aarch64)

      Modify lines 168 and 170.

      After performing 8.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  9. Edit the ncl_ncarg-6.3.0/ncarview/src/lib/libncarg_ras/misc.c file.
    1. Open the ncl_ncarg-6.3.0/ncarview/src/lib/libncarg_ras/misc.c file.
      vi ncl_ncarg-6.3.0/ncarview/src/lib/libncarg_ras/misc.c
    2. Press i to enter the insert mode.

      Add the following function declaration statements to lines 41 and 42, that is, add the statements before the int keyword of the first function.

      void _swapshort (register char *bp, register unsigned n);
      void _swaplong (register char *bp, register unsigned n);

      After performing 9.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  10. Edit the ncl_ncarg-6.3.0/config/LINUX file.
    1. Open the ncl_ncarg-6.3.0/config/LINUX file.
      vi ncl_ncarg-6.3.0/config/LINUX
    2. Press i to enter the insert mode and replace clang with gcc for compilation. The modification result is as follows:

      After performing 10.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  11. Compress the NCL source package again.
    cd /root/rpmbuild/SOURCES/
    rm -rf ncl_ncarg-6.3.0.tar.gz
    tar -zcvf ncl_ncarg-6.3.0.tar.gz ncl_ncarg-6.3.0
    rm -rf ncl_ncarg-6.3.0
  12. Go to the SOURCES directory and modify the Site.local.ncl file.
    1. Open the Site.local.ncl file.
      vi Site.local.ncl
    2. Press i to enter the insert mode and modify the file as follows:
      #define YmakeRoot $(DESTDIR)@prefix@
      #define ManRoot $(DESTDIR)@mandir@
      #define LibRoot $(DESTDIR)@libdir@/ncarg
      #define SharePath $(DESTDIR)@datadir@
      #define BuildWithF90 TRUE
      #define IncSearch -I/usr/include/hdf -I/path/to/netcdf/include/ -I/path/to/udunits2/include/ -I/usr/include/freetype2 -I/path/to/gdal/include/ -I/path/to/hdf5/include/
      #define LibSearch -L@libdir@/hdf -L/path/to/jasper/lib -ljasper  -L/opt/compiler/bisheng-compiler-1.3.1-aarch64-linux/lib -lflang -lpgmath -lflangrti
      #define BuildNetCDF4 1
      #define NetCDF4lib -L/path/to/netcdf/lib -lnetcdf
      #define BuildCAIRO 1
      #define CAIROlib -lcairo -lfreetype
      #define BuildGDAL 1
      #define GDALlib -L/path/to/gdal/lib -lgdal -lproj
      #define BuildHDFEOS 0
      #define BuildHDFEOS5 0
      #define BuildTRIANGLE 0
      #define HDFlib -lmfhdf -ldf -ljpeg -lz
      #define HDF5lib -L/path/to/hdf5/lib -lhdf5_hl -lhdf5
      #define BuildUdunits 1
      #define UdUnitslib -L/path/to/udunits2/lib -ludunits2

      If the actual paths for installing NetCDF, Udunits2, GDAL, HDF5, Jasper, and BiSheng Compiler from their source code are different from the paths in the preceding file, change the installation paths in the preceding file to the actual ones.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  13. Go to the SPECS directory.
    cd /root/rpmbuild/SPECS
  14. Modify the ncl.spec file.
    1. Open the ncl.spec file.
      vi ncl.spec
    2. Press i to enter the insert mode.
      1. Add the following content at the beginning of the file and move the original first line to the next line.
        %define debug_package %{nil}
      2. Delete the BuildRequires command line corresponding to the dependency package for the source code installation.

        Before the modification:

        Delete lines 48, 49, 50, 51, 52, 56, 57, and 66.

      3. Modify the definitions of the macros related to Atlas.

        Before the modification:

        Delete lines 126, 129, 130, 131, and 132.

      4. Change the values of variables F77, F77_LD, and CTOFLIBS, as shown in the following figure. Modify the installation path of the BiSheng Compiler as required.

      5. Add the following parameters so that the default dependency relationship is ignored during the package installation.

        Modify line 60 and comment out this line.

        #Requires:       udunits2

        Add a new line of AutoReqProv: no above each of the four lines: %description, %description common, %description devel, and %description examples.

        AutoReqProv: no

        After performing 14.a, press Esc, type :set nu, and press Enter to display the line number.

    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  15. Compile and package the file.
    rpmbuild -ba ncl.spec

    If an error is reported in this step, the dependency RPM package is missing when building the NCL package. If the required RPM package has been installed, this error does not occur and please ignore 12. If the RPM package has not been installed, install it by performing 12.

  16. Install the dependencies.
    yum install /bin/csh atlas-devel cairo-devel imake libXaw-devel libXext-devel libXpm-devel libXt-devel proj-devel

  17. Package the file.
    rpmbuild -ba ncl.spec
  18. Go to the RPMS directory and compile and install NCL.
    cd /root/rpmbuild/RPMS/aarch64
    yum install ncl*
  19. Set the environment variables.
    export NCARG_FONTCAPS=/usr/lib64/ncarg/fontcaps
    export NCARG_GRAPHCAPS=/usr/lib64/ncarg/graphcaps
    export NCARG_ROOT=/usr
    export NCARG_DATABASE=/usr/lib64/ncarg/database
    export NCARG_LIB=/usr/lib64/ncarg
    export NCARG_NCARG=/usr/share/ncarg
    export EXTRA_CCOPTIONS=" -fsigned-char "$EXTRA_CCOPTIONS