Compilation and Installation
Procedure
- Use PuTTY to log in to the server as the root user.
- Install the dependencies.
yum install flex-devel
- Obtain the source package.
wget https://download-ib01.fedoraproject.org/pub/epel/7/SRPMS/Packages/n/ncl-6.3.0-6.el7.src.rpm
- Install the source package.
rpm -ivh ncl-6.3.0-6.el7.src.rpm
- 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
- Edit the ncl_ncarg-6.3.0/common/src/libncarg_c/yMakefile file.
- Open the ncl_ncarg-6.3.0/common/src/libncarg_c/yMakefile file.
vi ncl_ncarg-6.3.0/common/src/libncarg_c/yMakefile
- Press i to enter the insert mode and modify the content in line 35.
#elif (defined(ia64) || defined(x86_64) || defined(amd64) || defined(aarch64))
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the ncl_ncarg-6.3.0/common/src/libncarg_c/yMakefile file.
- Edit the ncl_ncarg-6.3.0/ni/src/lib/nio/yMakefile file.
- Open the ncl_ncarg-6.3.0/ni/src/lib/nio/yMakefile file.
vi ncl_ncarg-6.3.0/ni/src/lib/nio/yMakefile
- Press i to enter the insert mode and modify the content in line 85.
#if defined(IRIX64) || defined(x86_64) || defined(__LP64__) || defined(aarch64)
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the ncl_ncarg-6.3.0/ni/src/lib/nio/yMakefile file.
- Edit the ncl_ncarg-6.3.0/ni/src/ncl/yMakefile file.
- Open the ncl_ncarg-6.3.0/ni/src/ncl/yMakefile file.
vi ncl_ncarg-6.3.0/ni/src/ncl/yMakefile
- 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.

- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the ncl_ncarg-6.3.0/ni/src/ncl/yMakefile file.
- Edit the ncl_ncarg-6.3.0/ncarview/src/lib/libncarg_ras/misc.c file.
- 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
- 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);
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the ncl_ncarg-6.3.0/ncarview/src/lib/libncarg_ras/misc.c file.
- Edit the ncl_ncarg-6.3.0/config/LINUX file.
- 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
- Go to the SOURCES directory and modify the Site.local.ncl file.
- Open the Site.local.ncl file.
vi Site.local.ncl
- 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.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the Site.local.ncl file.
- Go to the SPECS directory.
cd /root/rpmbuild/SPECS
- Modify the ncl.spec file.
- Open the ncl.spec file.
vi ncl.spec
- Press i to enter the insert mode.
- Add the following content at the beginning of the file and move the original first line to the next line.
%define debug_package %{nil} - 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.

- Modify the definitions of the macros related to Atlas.

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

- 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.

- 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
- Add the following content at the beginning of the file and move the original first line to the next line.
- Press Esc, type :wq!, and press Enter to save the file and exit.
- Open the ncl.spec file.
- Compile and package the file.
rpmbuild -ba ncl.spec

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

- Package the file.
rpmbuild -ba ncl.spec
- Go to the RPMS directory and compile and install NCL.
cd /root/rpmbuild/RPMS/aarch64 yum install ncl*
- 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
Parent topic: ncl 6.3.0 Porting Guide (openEuler 20.03)
