install SWIG for OSX(10.8.2)

使用某個網友的Android audio streaming with OpenSL ES and the NDK時發現它需要SWIG來輔助完成JNI的橋接,但在osx上並沒有提供該程式,接下來就是要說明如何安裝並完成它。

什麼是SWIG?

image

SWIG是一個能將C或者C++編寫的程序與其它各種高級語言如Perl, Python, Ruby, 和 Tcl進行聯接的開發工具。其原理是從C/C++頭文件中找到申明並利用他們生成腳本語言訪問C/C++代碼所必須的封裝代碼。SWIG具有高度可自定義的特點,它能幫助你生成適合你的應用程序的封裝包。

 

  1. 下載swig原始碼swig/download.html
  2. 解開swig檔案
  3. 執行./configure進行設定,但此時卻會發生

    configure: error:
    Cannot find pcre-config script from PCRE (Perl Compatible Regular Expressions)
    library package. This dependency is needed for configure to complete,
    Either:
    - Install the PCRE developer package on your system (preferred approach).
    - Download the PCRE source tarball, build and install on your system
    as you would for any package built from source distribution.
    - Use the Tools/pcre-build.sh script to build PCRE just for SWIG to statically
    link against. Run ‘Tools/pcre-build.sh –help’ for instructions.
    (quite easy and does not require privileges to install PCRE on your system)
    - Use configure –without-pcre to disable regular expressions support in SWIG
    (not recommended).
    See `config.log’ for more details.

  4. 下載pcre(Perl Compatible Regular Expressions)原始碼PCRE source
  5. 解壓pcre並行進入目錄來編譯它

    ./configure

    make

    sudo make install

  6. 開始編譯SWIG

    ./configure

    make

    sudo make install

  7. 執行swig

    Must specify an input file. Use -help for available options.

  8. 看到此訊息就代表安裝成功!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值