【TCL】使用TCL連線Mysql資料庫之編譯mysqltcl(TCL安裝在CentOS 7中)
最近在用tcl,想著連線mysql,從網上查了一下發現用mysqltcl比較好,不過需要自己編譯,使用過程遇上一些問題,因此就總結了一下。首先是先編譯mysqltcl。說明一下,我的tcl是通過yum install tcl命令直接安裝的,因此不同安裝方式tcl路徑可能有變化,例如如果是通過rpm安裝的,請自行制定路徑。
第一步 下載mysqltcl
進入http://www.xdobry.de/mysqltcl/下載mysqltcl
下載的時候可以使用wget工具直接下載到linux中,wget工具的使用就不在這篇文章內進行講解了
下載完成後準備開始編譯,注意,需要提前安裝gcc,如果沒有安裝,請先使用
yum install gcc
進行安裝
第二步
使用
tar xvf mysqltcl-3.05.tar.gz
將下載下來的mysqltcl-3.05.tar.gz解壓
解壓完成後進入mysqltcl-3.05目錄
cd mysqltcl-3.05
執行./configure命令,發現提示
checking for Tcl configuration... configure: WARNING: Can't find Tcl configuration definitions
通過
whereis tcl
命令進行檢視,再對搜尋到的結果進行篩選,發現路徑/usr/share/tcl8.5中有檔案存在
使用
./configure --with-tcl=/usr/share/tcl8.5
發現提示checking for Tcl configuration... configure: error: /usr/share/tcl8.5 directory doesn't contain tclConfig.sh
使用
whereis tclConfig.sh
發現沒有找到檔案
使用
yum install tcl-devel tk-devel
命令安裝完畢後,再次執行
whereis tclConfig.sh
發現結果為tclConfig: /usr/lib64/tclConfig.sh
使用
./configure --with-tcl=/usr/share/tcl8.5 --with-tcl=/usr/lib64/tclConfig.sh
命令後
發現又提示checking for mysql header... configure: error: Cannot find mysql.h in /usr/include/mysql use -with-mysql-include=?
使用
yum install mysql-devel
命令,安裝完畢後執行
./configure --with-tcl=/usr/share/tcl8.5 --with-tcl=/usr/lib64/tclConfig.sh --with-mysql-lib=/usr/lib64/mysql
依次使用
make
make install
結束後使用ls命令,發現資料夾中已經存在libmysqltcl3.05.so檔案,就代表成功了
第三步
使用
cd ..
命令回到上一層
將mysqltcl-3.05資料夾移動到/usr/share/tcl8.5資料夾中
cp -r mysqltcl-3.05 /usr/share/tcl8.5
到此編譯mysqltcl就結束了