[ucar官方+最新版wrf安装说明](http://www2.mmm.ucar.edu/wrf/OnLineTutorial/compilation_tutorial.php)
gcc和g++到底啥关系?https://www.zhihu.com/question/20940822
https://zhuanlan.zhihu.com/p/37510795
Step 1
原文System Environment Tests 1
heqin@heqin-dell:~$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
heqin@heqin-dell:~$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
heqin@heqin-dell:~$ cpp --version
cpp (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
heqin@heqin-dell:~$ gfortran --version
The program 'gfortran' is currently not installed. You can install it by typing:
sudo apt install gfortran
heqin@heqin-dell:~$ sudo apt install gfortran
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
gfortran-5 libgfortran-5-dev libgfortran3
Suggested packages:
gfortran-multilib gfortran-doc gfortran-5-multilib gfortran-5-doc
libgfortran3-dbg
The following NEW packages will be installed:
gfortran gfortran-5 libgfortran-5-dev libgfortran3
0 upgraded, 4 newly installed, 0 to remove and 3 not upgraded.
Need to get 8,595 kB of archives.
After this operation, 27.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://mirrors.ustc.edu.cn/ubuntu xenial-security/main amd64 libgfortran3 amd64 5.4.0-6ubuntu1~16.04.10 [260 kB]
Get:2 https://mirrors.ustc.edu.cn/ubuntu xenial-security/main amd64 libgfortran-5-dev amd64 5.4.0-6ubuntu1~16.04.10 [291 kB]
Get:3 https://mirrors.ustc.edu.cn/ubuntu xenial-security/main amd64 gfortran-5 amd64 5.4.0-6ubuntu1~16.04.10 [8,043 kB]
Get:4 https://mirrors.ustc.edu.cn/ubuntu xenial/main amd64 gfortran amd64 4:5.3.1-1ubuntu1 [1,288 B]
Fetched 8,595 kB in 2s (3,779 kB/s)
Selecting previously unselected package libgfortran3:amd64.
(Reading database ... 213609 files and directories currently installed.)
Preparing to unpack .../libgfortran3_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libgfortran3:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package libgfortran-5-dev:amd64.
Preparing to unpack .../libgfortran-5-dev_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking libgfortran-5-dev:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package gfortran-5.
Preparing to unpack .../gfortran-5_5.4.0-6ubuntu1~16.04.10_amd64.deb ...
Unpacking gfortran-5 (5.4.0-6ubuntu1~16.04.10) ...
Selecting previously unselected package gfortran.
Preparing to unpack .../gfortran_4%3a5.3.1-1ubuntu1_amd64.deb ...
Unpacking gfortran (4:5.3.1-1ubuntu1) ...
Processing triggers for libc-bin (2.23-0ubuntu10) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libgfortran3:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up libgfortran-5-dev:amd64 (5.4.0-6ubuntu1~16.04.10) ...
Setting up gfortran-5 (5.4.0-6ubuntu1~16.04.10) ...
Setting up gfortran (4:5.3.1-1ubuntu1) ...
update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode
update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode
Processing triggers for libc-bin (2.23-0ubuntu10) …
Step 2
原文System Environment Tests 4
heqin@heqin-dell:~$ cat /etc/shells
/etc/shells: valid login shells
/bin/sh
/bin/dash
/bin/bash
/bin/rbash
heqin@heqin-dell:~$ sudo apt install tcsh
[sudo] password for heqin:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
tcsh
0 upgraded, 1 newly installed, 0 to remove and 3 not upgraded.
Need to get 410 kB of archives.
After this operation, 1,310 kB of additional disk space will be used.
Get:1 https://mirrors.ustc.edu.cn/ubuntu xenial/universe amd64 tcsh amd64 6.18.01-5 [410 kB]
Fetched 410 kB in 2s (196 kB/s)
Selecting previously unselected package tcsh.
(Reading database ... 213500 files and directories currently installed.)
Preparing to unpack .../tcsh_6.18.01-5_amd64.deb ...
Unpacking tcsh (6.18.01-5) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up tcsh (6.18.01-5) ...
update-alternatives: using /bin/tcsh to provide /bin/csh (csh) in auto mode
heqin@heqin-dell:~$ perl -v
This is perl 5, version 22, subversion 1 (v5.22.1) built for x86_64-linux-gnu-thread-multi
(with 69 registered patches, see perl -V for more detail)
Copyright 1987-2015, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
Step 3
原文System Environment Tests 5
heqin@heqin-dell:~$ make -v
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
heqin@heqin-dell:~ sudo apt install m4
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libsigsegv2
The following NEW packages will be installed:
libsigsegv2 m4
0 upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 209 kB of archives.
After this operation, 409 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 https://mirrors.ustc.edu.cn/ubuntu xenial/main amd64 libsigsegv2 amd64 2.10-4 [14.1 kB]
Get:2 https://mirrors.ustc.edu.cn/ubuntu xenial/main amd64 m4 amd64 1.4.17-5 [195 kB]
Fetched 209 kB in 0s (942 kB/s)
Selecting previously unselected package libsigsegv2:amd64.
(Reading database ... 213541 files and directories currently installed.)
Preparing to unpack .../libsigsegv2_2.10-4_amd64.deb ...
Unpacking libsigsegv2:amd64 (2.10-4) ...
Selecting previously unselected package m4.
Preparing to unpack .../archives/m4_1.4.17-5_amd64.deb ...
Unpacking m4 (1.4.17-5) ...
Processing triggers for install-info (6.1.0.dfsg.1-5) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up libsigsegv2:amd64 (2.10-4) ...
Setting up m4 (1.4.17-5) ...
Processing triggers for libc-bin (2.23-0ubuntu10) …
heqin@heqin-dell:~$ sed --v
sed (GNU sed) 4.2.2
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Jay Fenlason, Tom Lord, Ken Pizzini,
and Paolo Bonzini.
GNU sed home page: http://www.gnu.org/software/sed/.
General help using GNU software: http://www.gnu.org/gethelp/.
E-mail bug reports to: bug-sed@gnu.org.
Be sure to include the word sed'' somewhere in the
Subject:'' field.
heqin@heqin-dell:~$ which awk
/usr/bin/awk
Step 4
下载网址Free Tools for Students
https://software.intel.com/en-us/qualify-for-free-software/student
安装说明
https://software.intel.com/sites/default/files/managed/12/b4/parallel-studio-xe-install-guide-linux.pdf或者解压后的文件夹中自带
heqin@heqin-dell:~ ls
compilervars.csh compilervars.sh ia32 intel64
heqin@heqin-dell:/opt/intel/compilers_and_libraries/linux/bin which ifort
/opt/intel/compilers_and_libraries_2017.7.259/linux/bin/intel64/ifort
heqin@heqin-dell:~$ gedit ~/.bashrc
added by HeQin for Intel Compiler
source /opt/intel/compilers_and_libraries_2017/linux/bin/compilervars.sh intel64
heqin@heqin-dell:~$ icc
Centos6.7下安装Intel 的icc / ifort 编译器(非商业版)
http://blog.51cto.com/doublelinux/1956452
https://software.intel.com/en-us/articles/using-intel-compilers-for-linux-with-ubuntu/
https://blog.teststation.org/ubuntu/2016/05/12/installing-32-bit-software-on-ubuntu-16.04/
Step 5 of 7 | Prerequisites > Missing Optional Prerequisite(s)
There are one or more optional unresolved issues. It is highly recommended to
resolve them all before you continue. You can fix them without exiting the setup
program and re-check. Or you can exit the setup program, fix them and run the
setup program again.
Missing optional prerequisites
-- 32-bit libraries not found
- Skip missing optional prerequisites [default]
- Show the detailed info about issue(s)
- Re-check the prerequisites
h. Help
b. Back to the previous menu
q. Quit
Please type a selection or press "Enter" to accept default choice [1]: 2
Step 5 of 7 | Prerequisites > Missing Optional Prerequisite
32-bit libraries not found on this system.
This product release requires the presence of 32-bit compatibility libraries
when running on Intel(R) 64 architecture systems. One or more of these libraries
could not be found:
libstdc++ (including libstdc++6)
glibc
libgcc
Without these libraries, the compiler will not function properly. Please refer
to Release Notes for more information.
- Finish with prerequisites and continue [default]
- Back to Prerequisite summary dialog
h. Help
b. Back to the previous menu
q. Quit
Please type a selection or press "Enter" to accept default choice [1]: 2
Step 5
原文Building Libraries 1
heqin@heqin-dell:~$ tcsh
heqin-dell:~> gedit ~/.cshrc
added by HeQin for base environment
setenv DIR /home/heqin/models/libraries
setenv CC icc
setenv CXX icpc
setenv FC ifort
setenv FCFLAGS -m64
setenv F77 ifort
setenv FFLAGS -m64
heqin-dell:~> source ~/.cshrc
heqin-dell:~> cd ~/Downloads/
heqin-dell:~/Downloads> tar xzvf netcdf-4.1.3.tar.gz
显示解压出的内容
heqin-dell:~/Downloads> cd netcdf-4.1.3
heqin-dell:~/Downloads/netcdf-4.1.3> ./configure --prefix=$DIR/netcdf-4.1.3 --disable-dap --disable-netcdf-4 --disable-shared
heqin-dell:~/Downloads/netcdf-4.1.3> make
heqin-dell:~/Downloads/netcdf-4.1.3> make install
heqin-dell:~> gedit ~/.cshrc
added by HeQin for netcdf
setenv PATH PATH
setenv NETCDF $DIR/netcdf-4.1.3
heqin-dell:~> source ~/.cshrc
原文Building Libraries 2
heqin-dell:~/Downloads/netcdf-4.1.3> cd ~/Downloads/
heqin-dell:~/Downloads> tar xzvf mpich-3.0.4.tar.gz
显示解压出的内容
heqin-dell:~/Downloads> cd mpich-3.0.4
heqin-dell:~/Downloads/mpich-3.0.4> ./configure --prefix=$DIR/mpich-3.0.4
heqin-dell:~/Downloads/mpich-3.0.4> make
heqin-dell:~/Downloads/mpich-3.0.4> make install
heqin-dell:~> gedit ~/.cshrc
added by HeQin for mpich
setenv PATH PATH
heqin-dell:~> source ~/.cshrc
原文Building Libraries 3
heqin-dell:~> gedit ~/.cshrc
added by HeQin for grib2
setenv LDFLAGS -LDIR/grib2/include
heqin-dell:~> source ~/.cshrc
heqin-dell:~/Downloads/mpich-3.0.4> cd ~/Downloads/
heqin-dell:~/Downloads/mpich-3.0.4> tar xzvf zlib-1.2.7.tar.gz
显示解压出的内容
heqin-dell:~/Downloads> cd zlib-1.2.7
heqin-dell:~/Downloads/zlib-1.2.7> ./configure --prefix=$DIR/grib2
heqin-dell:~/Downloads/zlib-1.2.7> make
heqin-dell:~/Downloads/zlib-1.2.7> make install
原文Building Libraries 4
heqin-dell:~/Downloads/zlib-1.2.7> cd ~/Downloads/
heqin-dell:~/Downloads> tar xzvf libpng-1.2.50.tar.gz
显示解压出的内容
heqin-dell:~/Downloads> cd libpng-1.2.50
heqin-dell:~/Downloads/libpng-1.2.50> ./configure --prefix=DIR/grib2
heqin-dell:~/Downloads/jasper-1.900.1> make
heqin-dell:~/Downloads/jasper-1.900.1> make install
Step 6
新建/home/heqin/models/wrf3.8.1后将3个安装包放在此处
heqin-dell:~/Downloads/jasper-1.900.1> cd ~/models/wrf3.8.1/
heqin-dell:~/models/wrf3.8.1> tar xzvf WRFV3.8.1.TAR.gz
heqin-dell:~/models/wrf3.8.1> tar xzvf WRFV3-Chem-3.8.1.TAR.gz
heqin-dell:~/models/wrf3.8.1> tar xzvf WPSV3.8.1.TAR.gz
heqin-dell:~/models/wrf3.8.1> mv chem/ WRFV3
heqin-dell:~/models/wrf3.8.1> cd WRFV3
heqin-dell:~/models/wrf3.8.1/WRFV3> ./configure
checking for perl5... no
checking for perl... found /usr/bin/perl (perl)
Will use NETCDF in dir: /home/heqin/models/libraries/netcdf-4.1.3
HDF5 not set in environment. Will configure WRF for use without.
PHDF5 not set in environment. Will configure WRF for use without.
Will use 'time' to report timing information
JASPERINC not found in environment, configuring to build without grib2 I/O...
Please select from among the following Linux x86_64 options:
- (serial) 2. (smpar) 3. (dmpar) 4. (dm+sm) PGI (pgf90/gcc)
- (serial) 6. (smpar) 7. (dmpar) 8. (dm+sm) PGI (pgf90/pgcc): SGI MPT
- (serial) 10. (smpar) 11. (dmpar) 12. (dm+sm) PGI (pgf90/gcc): PGI accelerator
- (serial) 14. (smpar) 15. (dmpar) 16. (dm+sm) INTEL (ifort/icc)
17. (dm+sm) INTEL (ifort/icc): Xeon Phi (MIC architecture) - (serial) 19. (smpar) 20. (dmpar) 21. (dm+sm) INTEL (ifort/icc): Xeon (SNB with AVX mods)
- (serial) 23. (smpar) 24. (dmpar) 25. (dm+sm) INTEL (ifort/icc): SGI MPT
- (serial) 27. (smpar) 28. (dmpar) 29. (dm+sm) INTEL (ifort/icc): IBM POE
- (serial) 31. (dmpar) PATHSCALE (pathf90/pathcc)
- (serial) 33. (smpar) 34. (dmpar) 35. (dm+sm) GNU (gfortran/gcc)
- (serial) 37. (smpar) 38. (dmpar) 39. (dm+sm) IBM (xlf90_r/cc_r)
- (serial) 41. (smpar) 42. (dmpar) 43. (dm+sm) PGI (ftn/gcc): Cray XC CLE
- (serial) 45. (smpar) 46. (dmpar) 47. (dm+sm) CRAY CCE (ftn/cc): Cray XE and XC
- (serial) 49. (smpar) 50. (dmpar) 51. (dm+sm) INTEL (ftn/icc): Cray XC
- (serial) 53. (smpar) 54. (dmpar) 55. (dm+sm) PGI (pgf90/pgcc)
- (serial) 57. (smpar) 58. (dmpar) 59. (dm+sm) PGI (pgf90/gcc): -f90=pgf90
- (serial) 61. (smpar) 62. (dmpar) 63. (dm+sm) PGI (pgf90/pgcc): -f90=pgf90
- (serial) 65. (smpar) 66. (dmpar) 67. (dm+sm) INTEL (ifort/icc): HSW/BDW
- (serial) 69. (smpar) 70. (dmpar) 71. (dm+sm) INTEL (ifort/icc): KNL MIC
Enter selection [1-71] : 15
Compile for nesting? (1=basic, 2=preset moves, 3=vortex following) [default 1]: 1
######################
Settings listed above are written to configure.wrf.
If you wish to change settings, please edit that file.
If you wish to change the default options, edit the file:
arch/configure_new.defaults
NetCDF users note:
This installation of NetCDF supports large file support. To enable large file
support in NetCDF, set the environment variable WRFIO_NCD_LARGE_FILE_SUPPORT
to 1 and run configure again. Set to any other value to avoid this message.
Testing for NetCDF, C and Fortran compiler
This installation of NetCDF is 64-bit
C compiler is 64-bit
Fortran compiler is 64-bit
It will build in 64-bit
heqin-dell:~/models/wrf3.8.1/WRFV3> ./compile em_real >& compile20180807.log
heqin-dell:~/models/wrf3.8.1/WRFV3> cd ~/models/wrf3.8.1/WPS
heqin-dell:~> gedit ~/.cshrc
added by HeQin for wps use grib2
setenv JASPERLIB DIR/grib2/include
heqin-dell:~> source ~/.cshrc
heqin-dell:~/models/wrf3.8.1/WPS> ./configure
Will use NETCDF in dir: /home/heqin/models/libraries/netcdf-4.1.3
Found Jasper environment variables for GRIB2 support...
JASPERINC = /home/heqin/models/libraries/grib2/include
Please select from among the following supported platforms.
- Linux x86_64, gfortran (serial)
- Linux x86_64, gfortran (serial_NO_GRIB2)
- Linux x86_64, gfortran (dmpar)
- Linux x86_64, gfortran (dmpar_NO_GRIB2)
- Linux x86_64, PGI compiler (serial)
- Linux x86_64, PGI compiler (serial_NO_GRIB2)
- Linux x86_64, PGI compiler (dmpar)
- Linux x86_64, PGI compiler (dmpar_NO_GRIB2)
- Linux x86_64, PGI compiler, SGI MPT (serial)
- Linux x86_64, PGI compiler, SGI MPT (serial_NO_GRIB2)
- Linux x86_64, PGI compiler, SGI MPT (dmpar)
- Linux x86_64, PGI compiler, SGI MPT (dmpar_NO_GRIB2)
- Linux x86_64, IA64 and Opteron (serial)
- Linux x86_64, IA64 and Opteron (serial_NO_GRIB2)
- Linux x86_64, IA64 and Opteron (dmpar)
- Linux x86_64, IA64 and Opteron (dmpar_NO_GRIB2)
- Linux x86_64, Intel compiler (serial)
- Linux x86_64, Intel compiler (serial_NO_GRIB2)
- Linux x86_64, Intel compiler (dmpar)
- Linux x86_64, Intel compiler (dmpar_NO_GRIB2)
- Linux x86_64, Intel compiler, SGI MPT (serial)
- Linux x86_64, Intel compiler, SGI MPT (serial_NO_GRIB2)
- Linux x86_64, Intel compiler, SGI MPT (dmpar)
- Linux x86_64, Intel compiler, SGI MPT (dmpar_NO_GRIB2)
- Linux x86_64, Intel compiler, IBM POE (serial)
- Linux x86_64, Intel compiler, IBM POE (serial_NO_GRIB2)
- Linux x86_64, Intel compiler, IBM POE (dmpar)
- Linux x86_64, Intel compiler, IBM POE (dmpar_NO_GRIB2)
- Linux x86_64 g95 compiler (serial)
- Linux x86_64 g95 compiler (serial_NO_GRIB2)
- Linux x86_64 g95 compiler (dmpar)
- Linux x86_64 g95 compiler (dmpar_NO_GRIB2)
- Cray XE/XC CLE/Linux x86_64, Cray compiler (serial)
- Cray XE/XC CLE/Linux x86_64, Cray compiler (serial_NO_GRIB2)
- Cray XE/XC CLE/Linux x86_64, Cray compiler (dmpar)
- Cray XE/XC CLE/Linux x86_64, Cray compiler (dmpar_NO_GRIB2)
- Cray XC CLE/Linux x86_64, Intel compiler (serial)
- Cray XC CLE/Linux x86_64, Intel compiler (serial_NO_GRIB2)
- Cray XC CLE/Linux x86_64, Intel compiler (dmpar)
- Cray XC CLE/Linux x86_64, Intel compiler (dmpar_NO_GRIB2)
Enter selection [1-40] : 17
Configuration successful. To build the WPS, type: compile
Testing for NetCDF, C and Fortran compiler
This installation NetCDF is 64-bit
C compiler is 64-bit
Fortran compiler is 64-bit
heqin-dell:~/models/wrf3.8.1/WPS> ./compile >& compile20180807.log
added by HeQin for base environment
export DIR="/home/heqin/models/libraries"
export CC=icc
export CXX=icpc
export FC=ifort
export FCFLAGS='-m64'
export F77=ifort
export FFLAGS='-m64'
added by HeQin for netcdf
export PATH="{PATH}"
export NETCDF="$DIR/netcdf-4.1.3"
added by HeQin for mpich
export PATH="{PATH}"
added by HeQin for grib2
export LDFLAGS=-L{DIR}/grib2/include
added by HeQin for wps use grib2
export JASPERLIB="{DIR}/grib2/include"
网友评论