2021-05-12 14:32:11
Ubuntu下安裝GAMIT 10.40
從安裝的過程來看,Ubuntu在桌上型電腦上會安裝gcc,但是筆電上則不會,所以在第一次裝的時候並沒有成功,雖然從頭到尾都安裝了,沒有中斷,但最後採用doy驗證的時候沒有通過。
下文是根據原文加自己的安裝過程,總結出的內容,紅色是需要注意的地方,內容可能上下有出入,但不影響安裝。
出入的部分主要是軟體的版本顯示問題(原文是GAMIT 10.34,我安裝的是GAMIT 10.40)和安裝路徑。
首先,安裝GCC,因為在root模式下,命令列沒有sudo
(首次安裝系統,需為ROOT 設定密碼才能進入,在終端輸入:sudo passwd 輸入完後,重新啟動電腦,更改登入,以root賬戶登入)
apt-get build-dep gcc
(若出現未發現CSH軟體包,輸入sudo apt-get update,更新源,要求電腦必須聯網,以下的軟體安裝的前提都是電腦連著網際網路)
連結1採用兩種方法,比較了大小後決定採用第一條,就是上面的命令。
通過gcc --version確認版本為 GCC 4.4.5
Gamit安裝需要csh(tcsh)環境、 GNU gfortran 4.2編譯器和libx11-dev庫支援。gfortran是軟體推薦使用的編譯器。libx11-dev是X11的程式開發庫,它提供的lib.h和 libx11.a(libx11.so)是Gamit安裝必須用到的兩個庫檔案,主要是為Globk的提供圖形庫支援。以上三個條件卻一不可。
ubuntu系統沒有csh,預設為bash。因此要先安裝csh。
ubuntu系統自帶了gcc4.2,但是卻沒有安裝gfortran編譯器。而你安裝時安裝程式會呼叫預設的gfortran編譯器,除非你指定gcc為你的編譯器。
首先,以root身份登入,開啟終端,輸入
apt-get install csh
系統自動下載並安裝csh,安裝完成後在終端輸入
chsh
提示
正在更改 root 的 SHELL
請輸入新值,或直接敲確認鍵以使用預設值
登入 Shell [/bin/bash]:
輸入
/bin/csh
修改bash為csh。重新起動ubuntu,並以root身份登入,開啟終端,輸入
# echo $SHELL
(“#”是終端自帶的符號,輸入echo $SHELL即可)
返回s“/bin/csh”,說明SHELL修改成功。
接著輸入
apt-get install gfortran
系統自動下載並安裝gfortran。
在輸入
apt-get install libx11-dev
系統自動下載並安裝libx11-dev庫支援。
安裝gamit 10.4
定位到gamit的安裝路徑
(我的安裝路徑是opt/gamit_globk,此路徑與後文的.cshrc保持一致,將gamit目錄下updatessource下的檔案全部拷貝至安裝路徑)
準備工作:
chmod +x install_software
(增加install_software指令碼的執行許可權)
(單擊指令碼,點顯示)修改install_software檔案內容
“usr -name libX11.a”為"usr -name libX11.so",一個是靜態共用庫,一個是動態共用庫。
makefile.config,修改:
(makefile.config 檔案在opt/gamit_globk/libraries壓縮包裡)
# X11 library location - uncomment the appropriate one for your system
# Generic (will work on any system if links in place)
X11LIBPATH /usr/lib/X11
X11INCPATH /usr/include/X11
# Specific for Sun with OpenWindows
#X11LIBPATH /usr/openwin/lib
#X11INCPATH /usr/openwin/share/include/X11
# Specific for PC Solaris 10
#X11LIBPATH /usr/openwin/lib/
#X11INCPATH /usr/openwin/share/include/X11
# Specific to Linux RedHat 7,8 and 9, RH-FC1 -> 3
#X11LIBPATH /usr/X11R6/lib
#X11INCPATH /usr/X11R6/include/X11
# Specific to FC5
#X11LIBPATH /usr/lib
#X11INCPATH /usr/include/X11
# Specific for MIT HP and Sun for Release 5
#X11LIBPATH /usr/lib/X11R5
#X11INCPATH /usr/include/X11R5
# Specific for IBM AIX4.2
#X11LIBPATH /usr/lpp/X11/lib
#X11INCPATH /usr/lpp/X11/include
# Specific for MacOSX
#X11LIBPATH /usr/X11R6/lib
#X11INCPATH /usr/include/X11
為:
# X11 library location - uncomment the appropriate one for your system
# Generic (will work on any system if links in place)
#X11LIBPATH /usr/lib/X11
#X11INCPATH /usr/include/X11
# Specific for Sun with OpenWindows
#X11LIBPATH /usr/openwin/lib
#X11INCPATH /usr/openwin/share/include/X11
# Specific for PC Solaris 10
#X11LIBPATH /usr/openwin/lib/
#X11INCPATH /usr/openwin/share/include/X11
# Specific to Linux RedHat 7,8 and 9, RH-FC1 -> 3
#X11LIBPATH /usr/X11R6/lib
#X11INCPATH /usr/X11R6/include/X11
# Specific to FC5(F6,F7,F8 )
X11LIBPATH /usr/lib
X11INCPATH /usr/include/X11
# Specific for MIT HP and Sun for Release 5
#X11LIBPATH /usr/lib/X11R5
#X11INCPATH /usr/include/X11R5
# Specific for IBM AIX4.2
#X11LIBPATH /usr/lpp/X11/lib
#X11INCPATH /usr/lpp/X11/include
# Specific for MacOSX
#X11LIBPATH /usr/X11R6/lib
#X11INCPATH /usr/include/X11
gamit<路徑>/libraries壓縮包裡,修改Makefile.config/Makefile.config.bak中的一組引數
(要修改Makefile.config.bak,開啟方式gedit)
MAXSIT 55
MAXSAT 32
MAXATM 13
MAXEPC 2880
將MAXATM改為25。
安裝軟體,執行 ./install_software
安裝程式install_software啟動,搜尋安裝目錄/opt/gamit10.34下的全部壓縮檔案,提示
GAMIT and GLOBK to be installed into /opt/gamit10.34
If you need help with command line options type CTL_C now and type
install_software -help on the command line
The compressed tarfiles will be removed after extraction of the
directories, but except for that, the script may be stopped and
rerun safely from any point. Tarfiles to be uncompressed:
com.10.34.tar.Z etopo5.grd.10.0.tar example.10.34.tar.Z gamit.10.34.tar.Z help.10.34.tar.Z kf.10.34.tar.Z libraries.10.34.tar.Z maps.10.1.tar.Z tables.10.34.tar.Z
Continue ? (y/n)
輸入字母“y”,開始解壓縮安裝檔案,
.. uncompressing and extracting the directories:
Do you want to apply incremental updates: incremental_updates.080812.tar.Z incremental_updates.080919.tar.Z incremental_updates.081022.tar.Z
Continue ? (y/n)
輸入字母“y”,開始解壓縮安裝檔案,
.. applying incremental updates:
.. adding /opt/gamit10.34/com to your search path to continue installation
To execute GAMIT and GLOBK you will need to set your login path to
include /opt/gamit10.34/com /opt/gamit10.34/gamit/bin /opt/gamit10.34/kf/bin
You will also need the alias or link gg --> /opt/gamit10.34
Your Operating System type is: Linux
Your default awk version is: /usr/bin/awk
These are the default paths to X11 found in Makefile.config
X11LIBPATH: /usr/lib/X11
X11INCPATH: /usr/include/X11
Searching your system for X11 installation
Found these paths to X11 libs and includes on your system
X11LIBPATH: /usr/lib
X11INCPATH: /usr/include/X11
Are these correct for your system?
Continue? (y/n)
輸入字母“y”,提示
GAMIT dimensions in /libraries/Makefile.config are set to
maxsit = 55
maxepc = 2880
maxatm = 25
maxsat = 32
Are these defaults found in Makefile.config correct?
If NOT edit the Makefile.config now before choosing to contine
Continue ? (y/n)
輸入字母“y”,開始安裝。安裝最後會???示
++++++++++++++++++
GLOBK installed
++++++++++++++++++
Create the gg link in your home directory to the version of
gamit/globk you just installed ? (y/n)
輸入字母“y”,回車,顯示
Making required ~/gg link to newly installed software
ln -s -f /opt/gamit10.34 ~/gg
Don't forget to set your : path to include /opt/gamit10.34/gamit/bin and /opt/gamit10.34/kf/bin
: HELP_DIR environment variable in you shell profile
(in .cshrc/.tcshrc add: setenv HELP_DIR /opt/gamit10.34/help/)
: INSTITUTE evnironment variable in your shell profile
(in your .cshrc/.tcshrc add: setenv INSTITUTE where_i_work)
where_i_work is a 3 character identifier for your solutions
至此,軟體已經安裝成功。但要始軟體能夠正常使用,還要修改“主資料夾”下的“.cshrc”檔案.該檔案是使用者的C SHELL組態檔,預設為隱藏檔案。必須將Gamit的安裝目錄新增在裡面,否則將無法在終端使用Gamit命令進行資料解算。
由於ubuntu預設使用bash,所以,使用者主目錄下並沒有csh的組態檔,你需要在自己的主資料夾下建立一個“.cshrc”檔案,並輸入內容如下
#
# This file is applicable to all C-shell users.
# set prompt
set prompt = "[`echo $cwd`]% "
set history = 50
set gamitpath = /opt/gamit10.34
# (我的安裝路徑是opt/gamit_globk,所以這裡應該是set gamitpath = /opt/gamit_globk)
set path = (. /bin /sbin /ect /usr/bin /usr/sbin /usr/ucb /usr/bin/X11 /usr/X11R6/bin $path)
set path = (. /usr/local/gmt/bin /usr/local/bin /usr/local/sbin /usr/local/lib /usr/lib $path)
#set path = (. /usr/local/gmt/bin /usr/local/bin /usr/local/lib /usr/ucb/ nfs r0 soft0 0 $path)
set path = (. $gamitpath/gamit/bin $gamitpath/kf/bin $gamitpath/com $path)
setenv HELP_DIR $gamitpath/help/
setenv PATH "/usr/sbin:/sbin:${PATH}"
setenv MANPATH /usr/local/gmt/man:/usr/local/man:/usr/X11R6/man
setenv LIBPATH /usr/local/gmt/lib:/usr/lib:/usr/local/lib:/usr/i386-glibc21-linux/lib
#set gcclib direction
setenv LD_LIBRARY_PATH /usr/local/gcc-3.4.1/lib/
# set alias
alias cd 'cd !*; set prompt = "[`echo $cwd`]% "'
alias pwd 'echo $cwd'
alias ls 'ls --classify'
alias ll 'ls -l'
alias la 'ls -a'
alias rm 'rm -i'
alias mv 'mv -i'
儲存,OK,全部安裝完成。在終端輸入
doy
返回
DOY: Converts various date formats
DOY: Converts various date formats.
Runstring:
% doy <jd/year> <doy/month> <day> <hr> <min>
or
% doy <gps_week>W <gps_sow/gps_dow>
or
% doy <DecYear>Y
where jd is Julian date (assumed if only one argument)
year is calender year
doy is day of year (assumed if two arguments)
month is month
day is day of month.
hr min is hrs and minutes of day (Only if ymd form used).
In the second form (i.e. W appended to the first value),
the entries are assumed to gps week no and the second entry
(optional) is either gps day of week (0-6) or seconds of
gps week.
NOTE: GPS Day of Week runs from 0-6 (Changed May 20, 1997).
In the third form with Y appended, the argument is taken as
deciminal year. (Versions after 2004/12/21 correctly account
for leap years in converting deciminal years back to Julian dates)
The conversions made are based on the number of arguments
passed.
NDOY: Version of doy of year which takes keyboard input in the
forms above. (^D ends program input).
Example: doy 92 200
Date 1992/07/18 0:00 hrs, DOY 200 JD 2448821.5000 MJD 48821.0000
GPS Week 653 Day of week 6, GPS Seconds 518400 Day of Week Sat
Decimal Year 1992.54372
Example: doy 654W 345600
Date 1992/07/23 0:00 hrs, DOY 205 JD 2448826.5000 MJD 48826.0000
GPS Week 654 Day of week 4, GPS Seconds 345600 Day of Week Thu
Decimal Year 1992.55738
***TODAY*** IS:
Date 2008/10/30 15:19 hrs, DOY 304 JD 2454770.1387 MJD 54769.6387
GPS Week 1503 Day of week 4, GPS Seconds 400786 Day of Week Thu
Decimal Year 2008.829614
安裝成功!!!!
相關文章