|
发表于 2006-10-26 16:08:55
|
显示全部楼层
同问。以前找一些资料,看了还是装不上……
以下是一篇Linux软件安装教程,我以前装StarDict时复制下来的资料。但我试了几次,还是装不了……(原网址、WEB页找不到了,凑合着看吧)
一般來說原始碼都會被綁成tar.bz2或tar.gz的格式
所以叫作tarball
可以用
tar -zxvf xxx.tar.gz
tar -jxvf yyy.tar.bz2
來解開(其實在圖形介面下按右鍵也會有解壓縮的選項)
$tar -jxvf stardict-2.4.7.tar.bz2
$cd stardict-2.4.7/
別急著安裝,先看看README,INSTALL,Changelog...之類的文件
有些網站也會有些安裝的訊息
我覺得這是一個該養成的習慣
果然我們在INSTALL中看到了作者給我們的安裝建議
To Install StarDict:
type:
=============
export PKG_CONFIG=`which pkg-config`
./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man
make
make install
=============
You can use:
=============
export PKG_CONFIG=`which pkg-config`
./configure --disable-gnome-support --prefix=/usr
=============
to build the "gtk library only" version of StarDict.
You can use "./configure --enable-gpe-support --prefix=/usr" to build the GPE version of StarDict. For GPE, see http://gpe.handhelds.org
Notice: you can download dictionaries from the StarDict website:
http://stardict.sourceforge.net
我決定要照著第一種的方法來作
第一行用了which pkg-config來設定PKG_CONFIG這個變數
您可以先開啟終端機試一下
$which pkg-config
/usr/bin/pkg-config
表示您的pkg-config是裝在/usr/bin/
若有錯誤訊息,請先安裝pkgconfig這個套件
第二行是執行該目錄下的configure並加上參數
或許您在執行前該先知道configure是幹什麼的
因為每一台機器的(軟體、硬體)系統不一樣
configure會測試相關的項目,並將結果給make來使用
例如:您使用的編譯器是哪一牌的?(我們是用gcc),
該裝的編譯所需套件裝了沒?
您也可以在這裡加入您需要的設定(參數)
例如您想安裝在什麼地方,就是用--prefix=您要的路徑來定
您可以先執行
./configure --help
來看看您可以用哪些參數
在這裡我並不想指定--prefix=/usr,
會和我的rpm安裝的版本衝突
通常自己安裝的會放在/usr/local來和一般rpm安裝的套件作一個區隔
(如果不指定--prefix,通常預設是--prefix=/usr/local)
不管如何,我想先試試直接./configure不加任何參數
$./configure
果然不出所料,停在這裡
checking for STARDICT... configure: error: The pkg-config script could not be found or is too old. Make sure it
is in your PATH or set the PKG_CONFIG environment variable to the full
path to pkg-config.
Alternatively, you may set the environment variables STARDICT_CFLAGS
and STARDICT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
To get pkg-config, see <http://www.freedesktop.org/software/pkgconfig>.
See `config.log' for more details.
因為我忘了先export PKG_CONFIG=`which pkg-config`
可是我覺得很奇怪:
pkg-config在/usr/bin裏面,/usr/bin在我的$PATH裡為什麼找不到?
可能要看看configure裡寫些什麼了(想看的自己看)
不管了,重來
$export PKG_CONFIG=`which pkg-config`
$./configure
結果換卡在這裡
checking for DSL2DICT... configure: error: Package requirements (libpcre) were not met:
Package libpcre was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpcre.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpcre' found
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
Alternatively, you may set the environment variables DSL2DICT_CFLAGS
and DSL2DICT_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.
檢查DSL2DICT時出現錯誤,缺了libpcre
丟到google上用libpcre suse查詢,
查到在suse中套件名稱是pcre(這應該可以想到,lib是libarary的意思)
用yast安裝,發現已經有安裝了pcre,那就是缺了pcre-devel了
把他裝起來吧!
裝好後再來一次./configure(方向鍵向上,如果您的終端機沒關起來,不用再export ...)
如果沒有錯誤訊息,恭喜您成功一半了!
第三行make
真正在編譯程式是這個步驟
make會去找Makefile這個檔案,依照裏面的設定來跑
有時我們會先跑個make clean來清除之前編譯的結果再來跑make
好啦!不清楚的就不多說了
$make
要跑一陣子,去喝杯茶吧!(電腦越爛可以喝越多杯茶)
有問題還是要找出Error的地方解決(把錯誤訊息po到google,再準備多一點茶)
有時會有很多的Warning,通常我都不管他
呵,運氣好,沒錯誤就完成了!
第四行make install
別忘記你是預設安裝在哪裡
像我要安裝在/usr/local,沒權限可裝不進去啊!
$su
#make install
結果
mkdir -p -- /usr/local/share/gnome/help/stardict/C/figures
make install-data-hook
make[4]: Entering directory `/home/chen/stardict-2.4.7/help/C'
/bin/sh ../../mkinstalldirs /usr/local/share/omf/stardict
mkdir -p -- /usr/local/share/omf/stardict
for file in stardict-C.omf; do
/usr/bin/install -c -m 644 $file.out /usr/local/share/omf/stardict/$file;
done
/usr/bin/install: cannot stat ‘stardict-C.omf.out’: 沒有此一檔案或目錄
make[4]: *** [install-data-hook-omf] Error 1
make[4]: Leaving directory `/home/chen/stardict-2.4.7/help/C'
make[3]: *** [install-data-am] Error 2
make[3]: Leaving directory `/home/chen/stardict-2.4.7/help/C'
make[2]: *** [install-am] Error 2
make[2]: Leaving directory `/home/chen/stardict-2.4.7/help/C'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/chen/stardict-2.4.7/help'
make: *** [install-recursive] Error 1
其實雖然有錯誤,但是這時執行stardict可以運作,
除了沒字典外(因為還沒裝字典嘛!)
如果很介意這個錯誤,
把終端機的螢幕往上拉,在make裡就出錯誤了
如果已經找不到了,現學現用
#exit
$make clean
$make
完成後往上拉
您會找到
make[3]: Entering directory `/home/chen/stardict-2.4.7/help/C'
for file in stardict-C.omf; do
scrollkeeper-preinstall /usr/local/share/gnome/help/stardict/C/stardict.xml ./$file $file.out;
done
/bin/sh: scrollkeeper-preinstall: command not found
make[3]: [omf_timestamp] Error 127 (ignored)
touch omf_timestamp
make[3]: Leaving directory `/home/chen/stardict-2.4.7/help/C'
Making all in zh_CN
make[3]: Entering directory `/home/chen/stardict-2.4.7/help/zh_CN'
for file in stardict-zh_CN.omf; do
scrollkeeper-preinstall /usr/local/share/gnome/help/stardict/zh_CN/stardict.xml ./$file $file.out;
done
/bin/sh: scrollkeeper-preinstall: command not found
make[3]: [omf_timestamp] Error 127 (ignored)
...
還很多
重點就在/bin/sh: scrollkeeper-preinstall: command not found
翻譯成中文scrollkeeper-preinstall這個命令找不到
孤一下,你會知道要裝scrollkeeper這個套件
而這個套件和手冊文件之類的有關
用yast將scrollkeeper及相依套件裝起來
重新make一次
錯誤訊息就不見了,恭喜你
再make install一次吧!
上面的問題解決了,但是又出現
scrollkeeper-update -p /usr/local/var/scrollkeeper -o /usr/local/share/omf/stardict
make[4]: *** [install-data-hook-omf] 程式記憶體區段錯誤
好可怕啊!不知道如何解決...無言(那...這篇文章要不要貼啊?)
不過是可以運作啦!
在這裡可看到近似的案例
好像沒有解決
檢討與改進
您可以看一下stardict裝在哪裡
在/usr/local/下一堆,還包含了etc/,share/man/這些好像不該出現在這裡的(但是man stardict還是可以用喔)
看來
./configure --prefix=/usr --sysconfdir=/etc --mandir=/usr/share/man
這樣應該會讓您的manpage和/etc/會在正確的位置
但這些就會和用rpm安裝的檔案位置重複了
所以您如果確定不(會)要裝rpm的版本(通常不建議混合使用)
就依照這個參數來設定
既然scrollkeeper有問題,那試試看 --disable-gnome-support好了
重來一次
首先移除剛才安裝的stardict
在stardict-2.4.7目錄下執行
#make uninstall
(這個命令不見得會有,要看Makefile裡是否寫了相關的script)
(如果沒辦法make uninstall就麻煩了,要自己看Makefile到底作了什麼事,自己反安裝)
退出root重新開始
#exit
$make clean
$export PKG_CONFIG=`which pkg-config`
$./configure --disable-gnome-support --sysconfdir=/etc --mandir=/usr/share/man
(喂!你怎麼都不按照人家的建議啊!)
$make
$su
#make install
一路下來都沒有錯誤
開另一個終端機打上
$stardict
可以順利使用,不過看起來音效有點問題,也還沒下載字典
在stardict官方網站可以下載到很多字典
根據說明只要將字典的壓縮檔解開後
放到/usr/share/stardict/dic/底下即可
不過因為我是裝在/usr/local/所以路徑應改為
/usr/local/share/stardict/dic/
例如:下載了21世紀雙語科技辭典
解壓縮
$tar -jxvf stardict-21shijishuangyukejicidian-big5-2.4.2.tar.bz2
$su
#mkdir /usr/local/share/stardict/dic/
#mv stardict-21shijishuangyukejicidian-big5-2.4.2/ /usr/local/share/stardict/dic/
重新啟動stardict就會有字典了
我電腦音效幾乎都沒開,所以音效的問題我就不管他了
有興趣的可以參考SuSE安裝日誌:Stardict字典發音
小結:
其實我會建議能找到適合的rpm就儘量使用rpm
當然您可能有自己的需求,所以需要自己編譯
基本流程通常是
1.下載,解壓縮,看文件
2.切換到該目錄執行./configure,make
3.執行make install
就這樣啦! |
|