通常從源碼包安裝軟體的步驟是: tar jxvf gtk+-2.4.13.tar.bz2 解開源碼包 cd gtk+-2.4.13/ 進入源碼目錄 ./configure 似乎在某些環境下./configure會造成終端退出 而使用. configure則會正常運行,如果有這個現象,就試試 . configure
通過configure程序猜測主機信息,最終建立Makefile,以完成make,所以如果./configure不成功而去make的話,就會出現"make: *** No targets specified and no makefile found. Stop." make 當./configure成功結束后,就開始正式編譯程序了. make install 編譯成功后使用make install安裝 make uninstall 某些軟體支持卸載,可能使用該方法卸載,如果支持的話,通常會在README中寫到(似乎比較少)
checking for pkg-config... /usr/bin/pkg-config checking for glib-2.0 >= 2.4.0 atk >= 1.0.1 pango >= 1.4.0... Package glib-2.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `glib-2.0.pc' to the PKG_CONFIG_PATH environment variable No package 'glib-2.0' found
configure: error: Library requirements (glib-2.0 >= 2.4.0 atk >= 1.0.1 pango >= 1.4.0) not met; consider adjusting the PKG_CONFIG_PATH environment variable if your libraries are in a nonstandard prefix so pkg-config can find them. [root@NEWLFS gtk+-2.4.13]# 很明顯,上面這段說明,沒有找到glib-2.4.x,並且提示應該將glib-2.0.pc加入到PKG_CONFIG_PATH下。 究竟這個pkg-config PKG_CONFIG_PATH glib-2.0.pc 是做什麼的呢? let me tell you ^_^ 先說說它是哪冒出來的,當安裝了pkgconfig-x.x.x這個包后,就多出了pkg-config,它就是需要PKG_CONFIG_PATH的東東 pkgconfig-x.x.x又是做什麼的? 來看一段說明:
代碼:
The pkgconfig package contains tools for passing the include path and/or library paths to build tools during the make file execution. pkg-config is a function that returns meta information for the specified library. The default setting for PKG_CONFIG_PATH is /usr/lib/pkgconfig because of the prefix we use to install pkgconfig. You may add to PKG_CONFIG_PATH by exporting additional paths on your system where pkgconfig files are installed. Note that PKG_CONFIG_PATH is only needed when compiling packages, not during run-time.
我想看過這段說明后,你已經大概了解了它是做什麼的吧。 其實pkg-config就是向configure程序提供系統信息的程序,比如軟體的版本啦,庫的版本啦,庫的路徑啦,等等 這些信息只是在編譯其間使用。你可以 ls /usr/lib/pkgconfig 下,會看到許多的*.pc,用文本編輯器打開 會發現類似下面的信息:
另外./configure 通過,make 出錯,遇到這樣的問題比較難辦,只能憑經驗查找原因,比如某個頭文件沒有找到, 這時候要順著出錯的位置一行的一行往上找錯,比如顯示xxxx.h no such file or directory 說明缺少頭文件 然後去google搜。 或者找到感覺有價值的錯誤信息,拿到google去搜,往往會找到解決的辦法。還是開始的那句話,要仔細看README,INSTALL 程序如何安裝,需要什麼依賴文件,等等。