天天看點

linux環境下安裝swig

下載下傳pcre: pcre-8.41​ 下載下傳swig :​​swig​​

1 安裝 pcre

$ tar -zxvf pcre-8.41.tar.gz 
$ chmod -R 777 pcre-8.41
$ cd pcre-8.41/
$ ./configure
$ make
$ sudo make install      

2 安裝swig到預設目錄

$ ./configure
$ make
$ sudo make install       

檢視swig版本

$ swig -version      

如果出現swig:error while loading shared libraries:libpcre.so.1異常,

确認是否安裝pcre,否則安裝pcre

如果确認安裝pcre,則運作

#ldd $(which swig)      

會看到

libpcre.so.1 => not found

手動添加連結:

#ln -s /usr/local/lib/libpcre.so.1 /lib      

完畢後再次運作

#swig -version      

可看到版本資訊。

SWIG Version 3.0.11

Compiled with g++ [x86_64-pc-linux-gnu]

Configured options: +pcre

Please see ​​​http://www.swig.org​​ for reporting bugs and further information

3 安裝swig到使用者指定目錄

$ ./configure --prefix=/usr/local/xxx/swig
$ make
$ sudo make install      
$ vim /etc/profile (可能需要管理者權限)      
$source /etc/profile      

繼續閱讀