linux環境下安裝swig

下載pcre: pcre-8.41
下載swig :swiglinux

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版本web

$ swig -version

若是出現swig:error while loading shared libraries:libpcre.so.1異常,
確認是否安裝pcre,不然安裝pcrevim

若是確認安裝pcre,則運行svg

#ldd $(which swig)

會看到.net

libpcre.so.1 => not foundcode

手動添加連接:orm

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

完畢後再次運行xml

#swig -version

可看到版本信息。get

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 informationit

3 安裝swig到用戶指定目錄

$ ./configure --prefix=/usr/local/xxx/swig
$ make
$ sudo make install

路徑添加到文件,

$ vim /etc/profile (可能須要管理員權限)

在最後添加一行:PATH=/usr/local/swig2.0.9/bin:$PATH。保存後從新加載生效:

$source /etc/profile