1、安装cygwin1.7.33-1
我花掉一个晚上和上午的时间用多个镜像站,下载了2015年1月22日的cygwin的完整安装包,总共24G。
然后采用本地安装。和推荐配置Curr。
如果以后需要什么,直接运行 setup进行安装就可以了。
运行cygwin的setup安装vim,gcc;
配置windows环境变量,
需要将F:\cgywin\bin加入系统path目录第一个。这样,就有神奇的事情发生:
(1) Cygwin端可以调用windows里的EXE
(2)Windows的cmd窗口也可调用cygwin的命令
不知是不是cygwin由win32 api写就的缘故?
2、编写hello程序
编写第一个hello程序
#cd 进入/home/administrator
#mkdir test 创建/home/administrator/test目录
#vim hello.c
int main(void){
printf(“Hello World”);
}
ESC,:wq保存退出。
#cat hello.c 查看hello.c文件
#gcc hello.c –o hello
#ls
#./hello
输出Hello World
3、安装mbsystem5.3.2207
(1)gmt4
mbsystem需要安装gmt4,如果安装gmt5,就会报错gmtdefs找不到的错误,也就是说mbsystem基于gm4
根据gmt网站说明,需要如下包:
cmake, fftw, fftw-devel, gcc, g++, ghostscript, gv, libnetcdf7, libnetcdf7-devel,
libnpcr0, libnpcr0-devel, make, openssh, subversion, xinit, zlib, zlib-devel
libnpcr0, libnpcr0-devel, make, openssh, subversion, xinit, zlib, zlib-devel
这些包通过cygwin setup来安装
没有gdal,下载gdal1.11.1,安装三部曲 (./configure,make,make install)。
(2)下载 pslib-0.4.5,并安装
(3)配置当前用户的文件.bash_profile
#all
export PATH="/bin:/usr/sbin:/usr/local/bin:/home/Administrator/GMT4.5.6/bin
export PATH="/bin:/usr/sbin:/usr/local/bin:/home/Administrator/GMT4.5.6/bin
:/home/Administrator/mbsystem-5.3.2017/bin:${PATH}"
#gdal
#gmt
export HDF5_DISABLE_VERSION_CHECK=2
export CMAKE_ROOT="/usr/share/cmake-2.8.9"
export HDF5_DISABLE_VERSION_CHECK=2
export CMAKE_ROOT="/usr/share/cmake-2.8.9"
#mbsystem
export CPPFLAGS="-I/usr/include/tirpc -I/usr/include -I/usr/local/include
export CPPFLAGS="-I/usr/include/tirpc -I/usr/include -I/usr/local/include
-I/home/Administrator/GMT4.5.6/include -I/usr/local/include/libps -I/usr/include/cloog-isl"
export LDFLAGS="-L/lib -L/usr/local/lib -L/home/Administrator/GMT4.5.6/lib"
export LIBS=-llibtirpc
export LDFLAGS="-L/lib -L/usr/local/lib -L/home/Administrator/GMT4.5.6/lib"
export LIBS=-llibtirpc
注意:在编译mbsystem出现找不到rpc,因为cygwin中用tirpc替换了
出现undefined type name “ choke”,需要包含cloog-isl
文件有时候不认,用命令dos2unix -n .bash_profile .bash_profile
source使文件生效
source使文件生效
(4)配置intall_makefiles
# Required parameters:
$MBSYSTEM_HOME = "/home/Administrator/mbsystem-5.3.2017";
$OS = "CYGWIN";
#$CFLAGS = "-Wall -g -I/usr/include/X11 -I/usr/include/tirpc";
#$LFLAGS = "-Wall -lm -bind_at_load -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
$MBSYSTEM_HOME = "/home/Administrator/mbsystem-5.3.2017";
$OS = "CYGWIN";
#$CFLAGS = "-Wall -g -I/usr/include/X11 -I/usr/include/tirpc";
#$LFLAGS = "-Wall -lm -bind_at_load -Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib
:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/LibGL.dylib";
$CFLAGS = "-g -fdata-sections -I/usr/include/X11 -I/usr/include/tirpc";
$LFLAGS = "-ltirpc -llibtirpc -lm -Wl,--enable-runtime-pseudo-reloc";
$NETCDFLIBDIR = "/lib";
$NETCDFINCDIR = "/usr/include";
$GMTLIBDIR = "/home/Administrator/GMT4.5.6/lib";
$GMTINCDIR = "/home/Administrator/GMT4.5.6/include";
$LEVITUS = "$MBSYSTEM_HOME/share/LevitusAnnual82.dat";
$PROJECTIONS = "$MBSYSTEM_HOME/share/Projections.dat";
#
# Required parameters for spectrogram program mbsegypsd
# - mbsegypsd will not be built if these are commented out
$FFTWLIBDIR = "/lib";
$FFTWINCDIR = "/usr/include";
#
# Required parameters for graphical tools
# - graphical tools will not be built if these
# are commented out
$MOTIFINCDIR = "/usr/include";
$MOTIFLIBS = "-L/lib -lXm -lXt -lX11";
#
# Required parameter for visualization tools
# - visualization tools will not be built if this
# is commented out
$OPENGLLIBS = "-lGLU -lGL";
#
# Required parameter for mblevitus program
$LEVITUS = "$MBSYSTEM_HOME/share/LevitusAnnual82.dat";
#
# Required parameter for mbotps program
$CFLAGS = "-g -fdata-sections -I/usr/include/X11 -I/usr/include/tirpc";
$LFLAGS = "-ltirpc -llibtirpc -lm -Wl,--enable-runtime-pseudo-reloc";
$NETCDFLIBDIR = "/lib";
$NETCDFINCDIR = "/usr/include";
$GMTLIBDIR = "/home/Administrator/GMT4.5.6/lib";
$GMTINCDIR = "/home/Administrator/GMT4.5.6/include";
$LEVITUS = "$MBSYSTEM_HOME/share/LevitusAnnual82.dat";
$PROJECTIONS = "$MBSYSTEM_HOME/share/Projections.dat";
#
# Required parameters for spectrogram program mbsegypsd
# - mbsegypsd will not be built if these are commented out
$FFTWLIBDIR = "/lib";
$FFTWINCDIR = "/usr/include";
#
# Required parameters for graphical tools
# - graphical tools will not be built if these
# are commented out
$MOTIFINCDIR = "/usr/include";
$MOTIFLIBS = "-L/lib -lXm -lXt -lX11";
#
# Required parameter for visualization tools
# - visualization tools will not be built if this
# is commented out
$OPENGLLIBS = "-lGLU -lGL";
#
# Required parameter for mblevitus program
$LEVITUS = "$MBSYSTEM_HOME/share/LevitusAnnual82.dat";
#
# Required parameter for mbotps program
#这个包我下载了,但是没有什么作用
$OTPSDIR = "/home/Administrator/OTPSnc";
#
# Optional parameter for use of non-default C compiler
#$CC = "gcc";
#
# Optional parameters for use of independent GSF library installation
# - GSF library included with MB-System will be used
# if these are commented out
#$GSFLIB = "/lib/libgsf-1.dll.a";
#$GSFINCDIR = "/usr/include/";
#
# Optional parameters for use of independent PROJ4 library installation
# - PROJ4 library included with MB-System will be used
# if these are commented out
#$PROJLIB = "/lib/libproj.a";
#$PROJINCDIR = "/usr/include/";
$OTPSDIR = "/home/Administrator/OTPSnc";
#
# Optional parameter for use of non-default C compiler
#$CC = "gcc";
#
# Optional parameters for use of independent GSF library installation
# - GSF library included with MB-System will be used
# if these are commented out
#$GSFLIB = "/lib/libgsf-1.dll.a";
#$GSFINCDIR = "/usr/include/";
#
# Optional parameters for use of independent PROJ4 library installation
# - PROJ4 library included with MB-System will be used
# if these are commented out
#$PROJLIB = "/lib/libproj.a";
#$PROJINCDIR = "/usr/include/";
(5)
运行./install_makefiles生成makefile
make
(6)运行mbsystem,查看数据
/mbexamples/cookbook_examples/other_data_sets/目录下
cd ew0203survey/
ls -1 | grep mb183$ > tmplist
ls -1 | grep mb183$ > tmplist
mbdatalist -F-1 -I tmplist > datalist-1
mbdatalist -F-1 -I filelist.124 -N //生成辅助文件
mbdatalist -F-1 -I filelist.124 -R170.133/170.35/42.2/42.4 > survey-filelist.124 //取范围
mbm_plot -F-1 -I survey_filelist.124 -G1 //显示
生成survey_filelist.124.cmd文件,这个文件需要修改。
这里有1个问题:ghostview的问题,ghostscrip官网到ghostview1.5就不再更新,关键不是很好用,被gsview替换了,下载一个gsview的windows版本,
然后在cygwin中调用。
发表评论: