Cd Chen's Services

ba ba ba la~~

KDE@Mac 上的編譯問題之解決方法

先前我在我的小銀上,安裝了 Fink,然後透過 Fink 安裝了 KDE 3.4.X 在 Tiger 上。安裝 KDE 的目的,是為了能夠在 MacOS 上開發軟體。但,這過程中遇到許多的問題。

首先,是 configure 無法偵測到 QT,其錯誤訊息為:

checking for Qt... configure: error: Qt (>= Qt 3.2) (headers and libraries) not found. Please check your installation!
For more details about this problem, look at the end of config.log.

這問題的解決方法比較簡單,只要照下列方法就可以了:

./configure --with-qt-dir=$QTDIR --with-qt-includes=$QTDIR/include/qt --with-qt-libraries=$QTDIR/lib

後來又遇到預設的 g++ (g++-4.x) 會無法順利編譯 QT 的程式碼,這造成 configure 時會發生同樣錯誤而失敗。所以,後來就改這樣:

CXX=g++-3.3 ./configure --with-qt-dir=$QTDIR --with-qt-includes=$QTDIR/include/qt --with-qt-libraries=$QTDIR/lib

本以為這樣就沒問題了,但這樣卻還是有類似下列的錯誤訊息:


[cdchen@cdchen-pbg4 debug]$ make
make all-recursive
Making all in src
/bin/sh: line 0: cd: src: No such file or directory
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
[cdchen@cdchen-pbg4 debug]$

後來查過 Makefile 之後才知道,原因是 automake 產生的 Makefile 中,預設使用 /bin/sh,但我的 Fink 環境中,使用的是 /sw/bin/bash。而 /sw/bin/bash 會去讀取 /sw/etc/profile.d/*.sh,以便初始化應用軟體的環境,但 /bin/sh 卻不會。這會造成 /bin/sh 無法順利切換到相關的目錄。後來查 configure 後,發現只需要這樣作就好了:

CONFIG_SHELL=/sw/bin/bash CXX=g++-3.3 ./configure --with-qt-dir=$QTDIR --with-qt-includes=$QTDIR/include/qt --with-qt-libraries=$QTDIR/lib

這樣就沒問題了。總算可以在小銀上開發東西了!! :)

這篇內容的 Trackback 網址:

http://cdchen.idv.tw/trackback/285