作者:Sinsonglew 出处:http://www.cnblogs.com/sinsonglew 欢迎转载,也请保留这段声明。thanks :)

注记:NCL官方依赖安装包全集列表、官方源码编译指导链接:http://www.ncl.ucar.edu/Download/build_from_src.shtml,以下安装步骤如有不明,请参见官网链接对应条目。

1. NCL安装文件目录说明

ncl6.0.0 安装目录:/usr/ncar/ncl_ncarg-6.0.0

ncl编译依赖库压缩文件目录:/usr/ncar/NCL Dependent Libs_tar.gz

ncl编译依赖库已build的文件目录:/usr/ncar/NCL Dependent Libs_builded

ncl源代码已build的文件目录(含源代码压缩包):/usr/ncar/ncl

2 NCL安装步骤

2.1  配置环境变量

  配置环境变量之前:

  uname -m        //查看操作系统

  gcc --version      //查看编译器版本

  开始配置环境变量 , vi ~/.bashrc 在.bashrc文件中添加如下内容:

          export LDFLAGS='-m64'

          export CC=gcc

          export CFLAGS='-m64 -O2 -g  -mcpu=powerpc64 -fPIC'

          export CXXFLAGS='-m64 -O2 -g  -mcpu=powerpc64 -fPIC'

  配置完之后执行:source ~/.bashrc 刷新环境变量

2.2 JPEG version-6b

     ./configure --prefix=/usr/ncar/ncl_ncarg-6.0.

     make all install

     make install-lib

     make install-headers

2.3 zlib version-1.2.6

./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0

make all install

2.4 szip version-2.1

./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0 --disable-shared

make all install >& make-output

2.5 hdf5 version-1.8.8

./configure --with-zlib=/usr/ncar/ncl_ncarg-6.0.0 --with-szlib=/usr/ncar/ncl_ncarg-6.0.0 --prefix=/usr/ncar/ncl_ncarg-6.0.0 --disable-shared

make check install

2.6 netcdf version-4.2

CPPFLAGS=-I/usr/ncar/ncl_ncarg-6.0.0/include LDFLAGS=-L/usr/ncar/ncl_ncarg-6.0.0/lib

    ./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0 --enable-netcdf-4 --disable-dap

make check install

     注:man帮助文档 make时会报错, 可继续make install

2.7 HDF-4 version-4.2.6

./configure  --prefix=/usr/ncar/ncl_ncarg-6.0.0 --with-zlib=/usr/ncar/ncl_ncarg-6.0.0 --with-jpeg=/usr/ncar/ncl_ncarg-6.0.0                   --includedir=/usr/ncar/ncl_ncarg-6.0.0/include/hdf-4 --disable-netcdf --disable-fortran

make check install

2.8 Jasper version-1.900.1

./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0

make check install

2.9 GRIB2 version-1.2.1

  编辑makefile

  1)更改CC及CFLAGS,参见2.2.1节。

  2)DEFS行必须包含:"-DUSE_JPEG2000" and "-DUSE_PNG"

  3)64位操作系统,DEFS行必须包含"-D__64BIT__"

  4)把Jasper include 文件的路径加到"INC"行

  make all

  mv  libgrib2c.a  /usr/ncar/ncl_ncarg-6.0.0/lib

  cp  grib2.h  /usr/ncar/ncl_ncarg-6.0.0/include

2.10 PROJ.4 version-4.7.0 (4.8.0 make报错)

./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0 --enable-static=yes --enable-shared=no

make check install

2.11 libpng version-1.2.49

  ./configure  --with-pic --disable-shared --prefix=/usr/ncar/ncl_ncarg-6.0.0

  make check install

2.12 GDAL version-1.9.0

./configure  --with-static-proj4=/usr/ncar/ncl_ncarg-6.0.0

   --prefix=/usr/ncar/ncl_ncarg-6.0.0 --without-pam \

--with-png=/usr/ncar/ncl_ncarg-6.0.0

   --with-gif=internal - -with-libtiff=internal

   --with-geotiff=internal  --with-jpeg=/usr/ncar/ncl_ncarg-6.0.0

     --with-libz=/usr/ncar/ncl_ncarg-6.0.0 \

--with-sqlite3=no --with-expat=no --with-curl=no --without-ld-shared \

--with-hdf4=no --with-hdf5=no --with-pg=no --without-grib --disable-shared \

--with-freexl=no --with-geos=no --with-odbc=no

  make all install

2.13 HDF-EOS 2 version-2.18v1.00

  编辑INSTALL-HDFEOS内容

  1) 429行 430分别改为

   echo 'LNX_COMP_FLAG="-m64"' >> hdfeos_env.ksh

echo "LINUX_BRAND=linux64 # set LINUX for -64 mode" >> hdfeos_env.ksh

  2) 524行 535行分别改为

echo 'setenv LNX_COMP_FLAG "-m64"'         >> hdfeos_env.csh

echo "set LINUX_BRAND=linux64            # set LINUX for -32 mode" >> hdfeos_env.csh

  3) 1037行编译器设置,把原来的内容注释掉。

  CC="gcc -m64 "

  CFLAGS=" -O2 -g  -mcpu=powerpc64 -fPIC"

  LDFLAGS=" -m64 "

    Hdfeos的安装源代码目录假设为/usr/ncar/hdfeos/

    cd 到/usr/ncar/hdfeos/下,执行如下命令:

    bin/INSTALL-HDFEOS -i /usr/ncar/ncl_ncarg-6.0.0/include/hdf-4

    -l /usr/ncar/ncl_ncarg-6.0.0/lib

    -szi /usr/ncar/ncl_ncarg-6.0.0/include

    -szl /usr/ncar/ncl_ncarg-6.0.0/lib

    注:编译libhdfeos.a,再单独编译libGctp.a,一起复制到/usr/ncar/ncl_ncarg-6.0.0/lib下

   cp /usr/ncar/hdfeos/lib/linux/*.a  /usr/ncar/ncl_ncarg-6.0.0/lib

   cp /usr/ncar/hdfeos/include/*.h  /usr/ncar/ncl_ncarg-6.0.0/include/

2.14 HDF-EOS 5 version-5.1.14

./configure  CC=/usr/ncar/ncl_ncarg-6.0.0/bin/h5cc

    --with-hdf5=/usr/ncar/ncl_ncarg-6.0.0  --with-zlib=/usr/ncar/ncl_ncarg-6.0.0

    --with-szlib=/usr/ncar/ncl_ncarg-6.0.0 --prefix=/usr/ncar/ncl_ncarg-6.0.0

make check install

cp  /usr/ncar/hdfeos5/include/HE5_GctpFunc.h /usr/ncar/hdfeos5/include/HE5_HdfEosDef.h /usr/ncar/ncl_ncarg-6.0.0/include/

2.15 pkg-config version-0.25

./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0

make

make check

make install

  安装pkg-config成功后,编辑 .bashrc文件,加入以下内容:

export PKG_CONFIG_PATH=/usr/ncar/ncl_ncarg-6.0.0/lib/pkgconfig

export LD_LIBRARY_PATH=/usr/ncar/ncl_ncarg-6.0.0/cairo/lib

export PATH=/usr/ncar/ncl_ncarg-6.0.0/bin:$PATH

  执行 source ~/.bashrc

2.16 freetype version-2.4.9

  ./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0

  make

  make install

2.17 fontconfig version-2.9.0

  ./configure --sysconfdir=/usr/ncar/ncl_ncarg-6.0.0 --prefix=/usr/ncar/ncl_ncarg-6.0.0

  make

make check

make install

2.18 pixman version-0.24.4

  ./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0

 make

make check

make install

2.19 expat version-2.1.0

  ./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0

make

make check

make install

2.20 cario version-1.10.2

./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0

make

make check

make install

2.21 Triangle software

只把文件"triangle.c"、"triangle.h"复制到 $NCL/ni/src/lib/hlu目录下即可

   $NCL为下载的NCL源码存放路径,如/usr/ncar/NCL6.0.0

2.22 udunits version-2.1.24

  export PERL=""

  ./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0

  make check install

2.23 vis5d+ version-1.3.0-beta

  注:需要更新配置文件config.guess config.sub,登陆ftp://ftp.gnu.org/pub/gnu/config/; 将文本内容复制更新下载vis5d+目录下地对应文件。

    ./configure  --prefix=/usr/ncar/ncl_ncarg-6.0.0

--with-netcdf=/usr/ncar/ncl_ncarg-6.0.0/lib/libnetcdf.a CPPFLAGS=-I/usr/ncar/ncl_ncarg-6.0.0/include

    --disable-fortran --disable-shared

make check install

2.24 Flex version-2.5.33

  注:/usr/lib/libfl.a是32位的会报错,而程序链接是64位的,所以自己编译64位的,该库可选编译。

  ./configure --prefix=/usr/ncar/ncl_ncarg-6.0.0

make

make check

make install

2.25 NCL6.0.0

  1) 执行配置,配置NCL的安装依赖库、include目录等

    cd到/usr/ncar/ncl/ncl_ncarg目录

    ./Configure  -v

  2) 把 "triangle.c"、"triangle.h"复制到 /usr/ncar/ncl/ncl_ncarg/ni/src/lib/hlu目录下即可,参见序号20,安装Triangle software

  3) 修改/usr/cipasWeb/ncl/ncl_ncarg/config目录下Template文件,替换LD、LD_REL两行内容为如下:

  /*LD            = LdCommand*/

  /*LD_REL   = LdRelCommand*/

  LD              =  ld -m elf64ppc

  LD_REL       =  ld -m elf64ppc

  4) 更改目录/usr/ncar/ncl/ncl_ncarg/ncarview/src/lib/libncarg_ras下

  hdf.c文件的头文件 hdf/hdf.h 为 hdf-4/hdf.h

  hdf.c文件的头文件 hdf/df.h 为 hdf-4/hdf.h

  hdf.c文件的头文件 hdf/dfgr.h 为 hdf-4/dfgr.h

  5) 更改目录/usr/ncar/ncl/ncl_ncarg/ni/src/ncl下

  NclHDF.c文件的头文件 hdf/mfhdf.h 为 hdf-4/mfhdf.h

  NclHDFEOS.c文件的头文件 hdf/mfhdf.h 为 hdf-4/mfhdf.h

  NclHDFEOS5.c文件的头文件 hdf/mfhdf.h 为 hdf-4/mfhdf.h

  6) 库配置文件:/usr/ncar/ncl/ncl_ncarg/config/Site.local下内容

  #define LibSearch -L/usr/lib64 -L/usr/ncar/ncl_ncarg-6.0.0

  #define IncSearch -I/usr/include/X11

     -I/usr/ncar/ncl_ncarg-6.0.0/include

  -I/usr/ncar/ncl_ncarg-6.0.0/include/freetype2

  7) 编辑/usr/cipasWeb/ncl/ncl_ncarg/config/LINUX下内容

   注释掉define ByteSwapped --->/*#define ByteSwapped*/

  删除#define StdDefines  -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DByteSwapped中此项-DByteSwapped

  在#StdDefines行中添加-DNGLONG2XINT选项

  #define StdDefines  -DSYSV -D_POSIX_SOURCE -D_XOPEN_SOURCE -DNGLONG2XINT

  8)进行安装

cd到/usr/ncar/ncl/ncl_ncarg目录

按下面英文说明进行安装

  /**********************************************************************/

  You have completed the configuration process. Once you exit this

        program you may initiate the installation procedure by typing:

                make Everything >& make-output &

        You can watch the output with:

                tail -f make-output

        If this is not your first installation attempt, and you simply

        made some changes in the configuration, restart the process using:

                make All >>& make-output &

        This command does not erase object code that has already

        been compiled.

        Both of these commands run the installation procedure

        in the background, and you can track its progress

        by periodically examining the file "make-output" while

        the installation proceeds.

  9) 检查make是否出错

打开make-output文件,搜索"Error",看是否有make error. 如有error,检查以上 1-7 项是否配置正确。

2.26 NCL安装后配置环境变量

  vi ~/.bashrc  在bashrc文件中添加如下环境变量

     export NCARG_ROOT=/usr/cipasWeb/ncl_ncarg-6.0.0

   export PATH=$NCARG_ROOT/bin:$PATH

     export NCARG_FONTCAPS=$NCARG_ROOT/lib/ncarg/fontcaps

     export NCARG_GRAPHCAPS=$NCARG_ROOT/lib/ncarg/graphcaps

   export NCARG_LIB=$NCARG_ROOT/lib

   添加完毕后执行命令 source ~/.bashrc

2.27 NCL 绘图环境初始化配置

  在用户目录下创建 .hluresfile文件,将如下内容粘贴到.hluresfile文件中,具体该文件的说明参见:http://www.ncl.ucar.edu/Document/Graphics/hlures.shtml

  

         !=========================================

         ! This is a sample .hluresfile. It should

         ! go in your home directory.

         !

         ! Comments for ".res" files are preceded by a "!".

         ! Remember quotations are not used in .res files.

         ! White background/black foreground, these are the default in V6.1.0

         *wkForegroundColor  : (/0.,0.,0./)

         *wkBackgroundColor  : (/1.,1.,1./)

         ! Have a favorite colormap that you use for everything? You can

         ! make it your default here (note the name is NOT in quotes).

         !

         ! In Version 6.1.0, the default is "ncl_default":

         ! http://www.ncl.ucar.edu/Document/Graphics/ColorTables/ncl_default.shtml

         !

         ! For all available color maps, see

         ! http://www.ncl.ucar.edu/Document/Graphics/color_table_gallery.shtml

         *wkColorMap         : BlueWhiteOrangeRed

         ! Font - this is the default in V6.1.0.

         ! Use times-roman to get the pre-V6.1.0 default.

         *Font           : helvetica

         ! Function Codes [Default is a colon]

         *TextFuncCode               : ~    

         ! Make default X11 window larger (adjust as necessary)

         *wkWidth                     : 800

         *wkHeight                    : 800

         ! Increase the default (16mb) contour memory

         ! For example, if you have gridded data that

         ! is larger than 500 x 500, you may need this.

         *wsMaximumSize: 32556688

         !==========================================

2.27 NCL 安装后测试

  测试的时候注意启动XSERVER

  export DISPLAY=localhost:10.0

  测试XSERVER命令: xclock

  测试NCL

ng4ex gsun01n

ncl gsun01n.ncl

  测试NCARG

ncargex cpex08

ctrans -d X11 cpex08.ncgm

=================THE END, GOOD LUCK===================

How to compile and install NCAR Command Language on IBM PowerPC 64 --- NCL编译安装步骤的更多相关文章

  1. How to compile and install Snort from source code on Ubuntu

    http://www.tuicool.com/articles/v6j2Ab Snort is by far the most popular open-source network intrusio ...

  2. Windows 10上源码编译Poco并编写httpserver和tcpserver | compile and install poco cpp library on windows

    本文首发于个人博客https://kezunlin.me/post/9587bb47/,欢迎阅读! compile and install poco cpp library on windows Se ...

  3. How to compile and install Linux Kernel 5.1.2 from source code

    How to compile and install Linux Kernel 5.1.2 from source code Compiling a custom kernel has its adv ...

  4. Maven学习笔记1(clean compile package install)

    Maven是一个项目构建管理工具,使用相应的命令 就可以快速完成项目的编译 打包. 1.下载maven,直接解压目录就可以了,配置maven的环境变量就可以在window下的任何文件夹下以命令的方式执 ...

  5. mvn clean compile package install deploy

    (1) package 目的是打包,在pom中,如果是jar就会打包成jar,如果是war就会打包成war 在pom.xml中: <modelVersion></modelVersi ...

  6. Ubuntu 16.04上源码编译Poco并编写cmake文件 | guide to compile and install poco cpp library on ubuntu 16.04

    本文首发于个人博客https://kezunlin.me/post/281dd8cd/,欢迎阅读! guide to compile and install poco cpp library on u ...

  7. ubuntu 16.04上源码编译和安装cgal并编写CMakeLists.txt | compile and install cgal on ubuntu 16.04

    本文首发于个人博客https://kezunlin.me/post/39ab7ed9/,欢迎阅读最新内容! compile and install cgal on ubuntu 16.04 Guide ...

  8. ubuntu 16.04 上编译和安装C++机器学习工具包mlpack并编写mlpack-config.cmake | tutorial to compile and install mplack on ubuntu 16.04

    本文首发于个人博客https://kezunlin.me/post/1cd6a04d/,欢迎阅读最新内容! tutorial to compile and install mplack on ubun ...

  9. Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file.

    w https://linux.die.net/man/1/bash bash - GNU Bourne-Again SHell Description Bash is an sh-compatibl ...

随机推荐

  1. JS常用的设计模式(13)——组合模式

    组合模式又叫部分-整体模式,它将所有对象组合成树形结构.使得用户只需要操作最上层的接口,就可以对所有成员做相同的操作. 一个再好不过的例子就是jquery对象,大家都知道1个jquery对象其实是一组 ...

  2. Android IOS WebRTC 音视频开发总结(十四)-- sip和xmpp异同

    这篇文章主要介绍XMPP与SIP,很多人容易混淆这两个概念,转载请说明出处(博客园RTC.Blacker). 简介:XMPP和SIP都是应用层协议,主要用于互联网上发送语音和即时通讯. SIP在RFC ...

  3. 使用select io复用实现超时设置

    在linux的socket编程中,经常会遇到超时设置的问题,例如请求方如果在Ks内不发送数据则服务器要断开连接停止服务.这里我使用select的io复用实现超时5s设置,具体代码片段如下: fd_se ...

  4. [leetcode]_Valid Sudoku

    中间被启程日本的面试弄的没有静下心来复习算法.这样不好,基本功是硬道理.逐步恢复刷题. 题目:给一个数独(九宫格)中的一些数字,判断该数独是否有效. 即按照数独的规则,判断其行.列.小九格中是否有重复 ...

  5. js获取和设置DOM样式函数cssStyle(类似于jquery的$(elem).css())

    如题,相信这个函数百度一搜一大推,但令人匪夷所思的是这些函数都写的“奇形怪状的”,例如http://www.cnblogs.com/windows7/archive/2010/03/30/170064 ...

  6. 关于MongoDb Replica Set的故障转移集群——理论篇

    自从10 gen用Replica Set取代Master/Slave方案后生活其实已经容易多了,但是真正实施起来还是会发现各种各样的小问题,如果不小心一样会栽跟头. 在跟Replica Set血拼几天 ...

  7. 《Google 代码风格指南》

    <Google 代码风格指南> https://github.com/google/styleguide

  8. Cassandra 有限分页策略

    瀑布式分页 如果你的应用只需要瀑布式的分页,那么,Cassandra可以很好的支持,不过记得要指定好排序顺序. CLUSTERING ORDER BY (add_time DESC); 常见的分页,跳 ...

  9. 模拟新浪微博textarea,刷新页面输入信息保留

    今天我们的产品经理提出一个新需求,模拟新浪微博textarea框,输入内容刷新页面保留信息. 我是用的方法是Html5 LocalStorage存储的,开始计划用cookie.或mysql存储,尝试了 ...

  10. 【PHP】文件上传限制

    上传文件,只判断后缀,貌似还不是很严谨; /** * 判断文件是否合法 * @param $files * @param $arrCode * @return number|boolean */ fu ...